[FFmpeg-devel] [PATCH 5/5] avcodec: Replace get_bits_long() by get_bits() where possible

Michael Niedermayer michael at niedermayer.cc
Sun Nov 24 17:45:06 EET 2019


Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 libavcodec/bgmc.c          |  2 +-
 libavcodec/binkaudio.c     |  2 +-
 libavcodec/escape124.c     |  2 +-
 libavcodec/flac.c          |  4 ++--
 libavcodec/flvdec.c        |  2 +-
 libavcodec/hevc_sei.c      |  4 ++--
 libavcodec/indeo5.c        |  4 ++--
 libavcodec/intelh263dec.c  |  2 +-
 libavcodec/ivi.c           |  2 +-
 libavcodec/mjpegdec.c      |  2 +-
 libavcodec/mlp_parse.c     |  2 +-
 libavcodec/mpeg4videodec.c |  2 +-
 libavcodec/truemotion2.c   |  2 +-
 libavcodec/vp3.c           | 10 +++++-----
 libavcodec/vp9.c           |  4 ++--
 15 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/libavcodec/bgmc.c b/libavcodec/bgmc.c
index 2d59aa37ad..361f7c52e6 100644
--- a/libavcodec/bgmc.c
+++ b/libavcodec/bgmc.c
@@ -493,7 +493,7 @@ int ff_bgmc_decode_init(GetBitContext *gb, unsigned int *h,
 
     *h = TOP_VALUE;
     *l = 0;
-    *v = get_bits_long(gb, VALUE_BITS);
+    *v = get_bits(gb, VALUE_BITS);
 
     return 0;
 }
diff --git a/libavcodec/binkaudio.c b/libavcodec/binkaudio.c
index 2384ebf312..64a08b8608 100644
--- a/libavcodec/binkaudio.c
+++ b/libavcodec/binkaudio.c
@@ -153,7 +153,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
 static float get_float(GetBitContext *gb)
 {
     int power = get_bits(gb, 5);
-    float f = ldexpf(get_bits_long(gb, 23), power - 23);
+    float f = ldexpf(get_bits(gb, 23), power - 23);
     if (get_bits1(gb))
         f = -f;
     return f;
diff --git a/libavcodec/escape124.c b/libavcodec/escape124.c
index cffd3e12b1..94c2a961e6 100644
--- a/libavcodec/escape124.c
+++ b/libavcodec/escape124.c
@@ -252,7 +252,7 @@ static int escape124_decode_frame(AVCodecContext *avctx,
             if (i == 2) {
                 // This codebook can be cut off at places other than
                 // powers of 2, leaving some of the entries undefined.
-                cb_size = get_bits_long(&gb, 20);
+                cb_size = get_bits(&gb, 20);
                 if (!cb_size) {
                     av_log(avctx, AV_LOG_ERROR, "Invalid codebook size 0.\n");
                     return AVERROR_INVALIDDATA;
diff --git a/libavcodec/flac.c b/libavcodec/flac.c
index 5ffbf93190..7b075d4bd3 100644
--- a/libavcodec/flac.c
+++ b/libavcodec/flac.c
@@ -217,9 +217,9 @@ int ff_flac_parse_streaminfo(AVCodecContext *avctx, struct FLACStreaminfo *s,
     }
 
     skip_bits(&gb, 24); /* skip min frame size */
-    s->max_framesize = get_bits_long(&gb, 24);
+    s->max_framesize = get_bits(&gb, 24);
 
-    s->samplerate = get_bits_long(&gb, 20);
+    s->samplerate = get_bits(&gb, 20);
     s->channels = get_bits(&gb, 3) + 1;
     s->bps = get_bits(&gb, 5) + 1;
 
diff --git a/libavcodec/flvdec.c b/libavcodec/flvdec.c
index f9beb40afa..c19f07fe05 100644
--- a/libavcodec/flvdec.c
+++ b/libavcodec/flvdec.c
@@ -30,7 +30,7 @@ int ff_flv_decode_picture_header(MpegEncContext *s)
     int format, width, height;
 
     /* picture header */
-    if (get_bits_long(&s->gb, 17) != 1) {
+    if (get_bits(&s->gb, 17) != 1) {
         av_log(s->avctx, AV_LOG_ERROR, "Bad picture start code\n");
         return AVERROR_INVALIDDATA;
     }
diff --git a/libavcodec/hevc_sei.c b/libavcodec/hevc_sei.c
index c59bd4321e..5a83bf1346 100644
--- a/libavcodec/hevc_sei.c
+++ b/libavcodec/hevc_sei.c
@@ -76,8 +76,8 @@ static int decode_nal_sei_mastering_display_info(HEVCSEIMasteringDisplay *s, Get
 static int decode_nal_sei_content_light_info(HEVCSEIContentLight *s, GetBitContext *gb)
 {
     // Max and average light levels
-    s->max_content_light_level     = get_bits_long(gb, 16);
-    s->max_pic_average_light_level = get_bits_long(gb, 16);
+    s->max_content_light_level     = get_bits(gb, 16);
+    s->max_pic_average_light_level = get_bits(gb, 16);
     // As this SEI message comes before the first frame that references it,
     // initialize the flag to 2 and decrement on IRAP access unit so it
     // persists for the coded video sequence (e.g., between two IRAPs)
diff --git a/libavcodec/indeo5.c b/libavcodec/indeo5.c
index a7ab95a45c..4ccdbcaf0a 100644
--- a/libavcodec/indeo5.c
+++ b/libavcodec/indeo5.c
@@ -348,7 +348,7 @@ static int decode_pic_hdr(IVI45DecContext *ctx, AVCodecContext *avctx)
     if (ctx->frame_type != FRAMETYPE_NULL) {
         ctx->frame_flags = get_bits(&ctx->gb, 8);
 
-        ctx->pic_hdr_size = (ctx->frame_flags & 1) ? get_bits_long(&ctx->gb, 24) : 0;
+        ctx->pic_hdr_size = (ctx->frame_flags & 1) ? get_bits(&ctx->gb, 24) : 0;
 
         ctx->checksum = (ctx->frame_flags & 0x10) ? get_bits(&ctx->gb, 16) : 0;
 
@@ -392,7 +392,7 @@ static int decode_band_hdr(IVI45DecContext *ctx, IVIBandDesc *band,
         return 0;
     }
 
-    band->data_size = (ctx->frame_flags & 0x80) ? get_bits_long(&ctx->gb, 24) : 0;
+    band->data_size = (ctx->frame_flags & 0x80) ? get_bits(&ctx->gb, 24) : 0;
 
     band->inherit_mv     = band_flags & 2;
     band->inherit_qdelta = band_flags & 8;
diff --git a/libavcodec/intelh263dec.c b/libavcodec/intelh263dec.c
index d321dd4dba..283fb1cb0a 100644
--- a/libavcodec/intelh263dec.c
+++ b/libavcodec/intelh263dec.c
@@ -33,7 +33,7 @@ int ff_intel_h263_decode_picture_header(MpegEncContext *s)
     }
 
     /* picture header */
-    if (get_bits_long(&s->gb, 22) != 0x20) {
+    if (get_bits(&s->gb, 22) != 0x20) {
         av_log(s->avctx, AV_LOG_ERROR, "Bad picture start code\n");
         return -1;
     }
diff --git a/libavcodec/ivi.c b/libavcodec/ivi.c
index 93afabeb15..05ec06c8bf 100644
--- a/libavcodec/ivi.c
+++ b/libavcodec/ivi.c
@@ -476,7 +476,7 @@ static int ivi_dec_tile_data_size(GetBitContext *gb)
     if (get_bits1(gb)) {
         len = get_bits(gb, 8);
         if (len == 255)
-            len = get_bits_long(gb, 24);
+            len = get_bits(gb, 24);
     }
 
     /* align the bitstream reader on the byte boundary */
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 8b053613fc..d5e7c21610 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -2049,7 +2049,7 @@ static int mjpeg_decode_app(MJpegDecodeContext *s)
         unsigned nummarkers;
 
         id   = get_bits_long(&s->gb, 32);
-        id2  = get_bits_long(&s->gb, 24);
+        id2  = get_bits(&s->gb, 24);
         len -= 7;
         if (id != AV_RB32("PROF") || id2 != AV_RB24("ILE")) {
             av_log(s->avctx, AV_LOG_WARNING, "Invalid ICC_PROFILE header in APP2\n");
diff --git a/libavcodec/mlp_parse.c b/libavcodec/mlp_parse.c
index 3a71f2c0b7..45715352c2 100644
--- a/libavcodec/mlp_parse.c
+++ b/libavcodec/mlp_parse.c
@@ -102,7 +102,7 @@ int ff_mlp_read_major_sync(void *log, MLPHeaderInfo *mh, GetBitContext *gb)
         return AVERROR_INVALIDDATA;
     }
 
-    if (get_bits_long(gb, 24) != 0xf8726f) /* Sync words */
+    if (get_bits(gb, 24) != 0xf8726f) /* Sync words */
         return AVERROR_INVALIDDATA;
 
     mh->stream_type = get_bits(gb, 8);
diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index bf74bd7f09..cc03486646 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -1001,7 +1001,7 @@ int ff_mpeg4_decode_partitions(Mpeg4DecContext *ctx)
     if (s->pict_type == AV_PICTURE_TYPE_I) {
         while (show_bits(&s->gb, 9) == 1)
             skip_bits(&s->gb, 9);
-        if (get_bits_long(&s->gb, 19) != DC_MARKER) {
+        if (get_bits(&s->gb, 19) != DC_MARKER) {
             av_log(s->avctx, AV_LOG_ERROR,
                    "marker missing after first I partition at %d %d\n",
                    s->mb_x, s->mb_y);
diff --git a/libavcodec/truemotion2.c b/libavcodec/truemotion2.c
index fbdb657363..34317a9c00 100644
--- a/libavcodec/truemotion2.c
+++ b/libavcodec/truemotion2.c
@@ -155,7 +155,7 @@ static int tm2_build_huff_table(TM2Context *ctx, TM2Codes *code)
     huff.val_bits = get_bits(&ctx->gb, 5);
     huff.max_bits = get_bits(&ctx->gb, 5);
     huff.min_bits = get_bits(&ctx->gb, 5);
-    huff.nodes    = get_bits_long(&ctx->gb, 17);
+    huff.nodes    = get_bits(&ctx->gb, 17);
     huff.num      = 0;
 
     /* check for correct codes parameters */
diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c
index 9a3821a8b9..903871e93d 100644
--- a/libavcodec/vp3.c
+++ b/libavcodec/vp3.c
@@ -2967,7 +2967,7 @@ static int theora_decode_header(AVCodecContext *avctx, GetBitContext *gb)
     AVRational fps, aspect;
 
     s->theora_header = 0;
-    s->theora = get_bits_long(gb, 24);
+    s->theora = get_bits(gb, 24);
     av_log(avctx, AV_LOG_DEBUG, "Theora bitstream version %X\n", s->theora);
     if (!s->theora) {
         s->theora = 1;
@@ -2988,8 +2988,8 @@ static int theora_decode_header(AVCodecContext *avctx, GetBitContext *gb)
     s->height      = get_bits(gb, 16) << 4;
 
     if (s->theora >= 0x030200) {
-        visible_width  = get_bits_long(gb, 24);
-        visible_height = get_bits_long(gb, 24);
+        visible_width  = get_bits(gb, 24);
+        visible_height = get_bits(gb, 24);
 
         offset_x = get_bits(gb, 8); /* offset x */
         offset_y = get_bits(gb, 8); /* offset y, from bottom */
@@ -3017,8 +3017,8 @@ static int theora_decode_header(AVCodecContext *avctx, GetBitContext *gb)
                   fps.den, fps.num, 1 << 30);
     }
 
-    aspect.num = get_bits_long(gb, 24);
-    aspect.den = get_bits_long(gb, 24);
+    aspect.num = get_bits(gb, 24);
+    aspect.den = get_bits(gb, 24);
     if (aspect.num && aspect.den) {
         av_reduce(&avctx->sample_aspect_ratio.num,
                   &avctx->sample_aspect_ratio.den,
diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c
index 0fd15efed3..7aaae9b792 100644
--- a/libavcodec/vp9.c
+++ b/libavcodec/vp9.c
@@ -514,7 +514,7 @@ static int decode_frame_header(AVCodecContext *avctx,
     s->s.h.use_last_frame_mvs = !s->s.h.errorres && !last_invisible;
 
     if (s->s.h.keyframe) {
-        if (get_bits_long(&s->gb, 24) != VP9_SYNCCODE) { // synccode
+        if (get_bits(&s->gb, 24) != VP9_SYNCCODE) { // synccode
             av_log(avctx, AV_LOG_ERROR, "Invalid sync code\n");
             return AVERROR_INVALIDDATA;
         }
@@ -530,7 +530,7 @@ static int decode_frame_header(AVCodecContext *avctx,
         s->s.h.intraonly = s->s.h.invisible ? get_bits1(&s->gb) : 0;
         s->s.h.resetctx  = s->s.h.errorres ? 0 : get_bits(&s->gb, 2);
         if (s->s.h.intraonly) {
-            if (get_bits_long(&s->gb, 24) != VP9_SYNCCODE) { // synccode
+            if (get_bits(&s->gb, 24) != VP9_SYNCCODE) { // synccode
                 av_log(avctx, AV_LOG_ERROR, "Invalid sync code\n");
                 return AVERROR_INVALIDDATA;
             }
-- 
2.23.0



More information about the ffmpeg-devel mailing list