[FFmpeg-cvslog] get_bits: add get_bitsz for reading 0-25 bits

Andreas Cadhalpun git at videolan.org
Sun Jan 3 21:15:15 CET 2016


ffmpeg | branch: master | Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com> | Sun Jan  3 00:28:42 2016 +0100| [713654d9d3a6931a9b4cd0cffa4bb61cd1357977] | committer: Andreas Cadhalpun

get_bits: add get_bitsz for reading 0-25 bits

This can be used to simplify code in a couple of places.

Reviewed-by: Michael Niedermayer <michael at niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=713654d9d3a6931a9b4cd0cffa4bb61cd1357977
---

 libavcodec/get_bits.h              |    8 ++++++++
 libavcodec/mpegaudiodec_template.c |    7 -------
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/libavcodec/get_bits.h b/libavcodec/get_bits.h
index 0a61c80..4cf61d6 100644
--- a/libavcodec/get_bits.h
+++ b/libavcodec/get_bits.h
@@ -269,6 +269,14 @@ static inline unsigned int get_bits(GetBitContext *s, int n)
     return tmp;
 }
 
+/**
+ * Read 0-25 bits.
+ */
+static av_always_inline int get_bitsz(GetBitContext *s, int n)
+{
+    return n ? get_bits(s, n) : 0;
+}
+
 static inline unsigned int get_bits_le(GetBitContext *s, int n)
 {
     register int tmp;
diff --git a/libavcodec/mpegaudiodec_template.c b/libavcodec/mpegaudiodec_template.c
index d2420c1..5e3fe7e 100644
--- a/libavcodec/mpegaudiodec_template.c
+++ b/libavcodec/mpegaudiodec_template.c
@@ -816,13 +816,6 @@ static void exponents_from_scale_factors(MPADecodeContext *s, GranuleDef *g,
     }
 }
 
-/* handle n = 0 too */
-static inline int get_bitsz(GetBitContext *s, int n)
-{
-    return n ? get_bits(s, n) : 0;
-}
-
-
 static void switch_buffer(MPADecodeContext *s, int *pos, int *end_pos,
                           int *end_pos2)
 {



More information about the ffmpeg-cvslog mailing list