[FFmpeg-cvslog] golomb: Give svq3_get_se_golomb()/svq3_get_ue_golomb() better names

Diego Biurrun git at videolan.org
Sun Jun 26 20:23:45 CEST 2016


ffmpeg | branch: release/3.1 | Diego Biurrun <diego at biurrun.de> | Tue May 24 01:20:34 2016 +0200| [4024b566d664a4b161d677554be52f32e7ad4236] | committer: Diego Biurrun

golomb: Give svq3_get_se_golomb()/svq3_get_ue_golomb() better names

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

 libavcodec/dirac.c  |   58 +++++++++++++++++++++++++--------------------------
 libavcodec/golomb.h |    6 +++---
 libavcodec/rv30.c   |    4 ++--
 libavcodec/rv34.c   |    4 ++--
 libavcodec/rv40.c   |    2 +-
 libavcodec/svq3.c   |   24 ++++++++++-----------
 6 files changed, 49 insertions(+), 49 deletions(-)

diff --git a/libavcodec/dirac.c b/libavcodec/dirac.c
index aced2ac..142af20 100644
--- a/libavcodec/dirac.c
+++ b/libavcodec/dirac.c
@@ -148,8 +148,8 @@ static int parse_source_parameters(AVDiracSeqHeader *dsh, GetBitContext *gb,
     /* [DIRAC_STD] 10.3.2 Frame size. frame_size(video_params) */
     /* [DIRAC_STD] custom_dimensions_flag */
     if (get_bits1(gb)) {
-        dsh->width  = svq3_get_ue_golomb(gb); /* [DIRAC_STD] FRAME_WIDTH  */
-        dsh->height = svq3_get_ue_golomb(gb); /* [DIRAC_STD] FRAME_HEIGHT */
+        dsh->width  = get_interleaved_ue_golomb(gb); /* [DIRAC_STD] FRAME_WIDTH  */
+        dsh->height = get_interleaved_ue_golomb(gb); /* [DIRAC_STD] FRAME_HEIGHT */
     }
 
     /* [DIRAC_STD] 10.3.3 Chroma Sampling Format.
@@ -157,7 +157,7 @@ static int parse_source_parameters(AVDiracSeqHeader *dsh, GetBitContext *gb,
     /* [DIRAC_STD] custom_chroma_format_flag */
     if (get_bits1(gb))
         /* [DIRAC_STD] CHROMA_FORMAT_INDEX */
-        dsh->chroma_format = svq3_get_ue_golomb(gb);
+        dsh->chroma_format = get_interleaved_ue_golomb(gb);
     if (dsh->chroma_format > 2) {
         if (log_ctx)
             av_log(log_ctx, AV_LOG_ERROR, "Unknown chroma format %d\n",
@@ -169,22 +169,22 @@ static int parse_source_parameters(AVDiracSeqHeader *dsh, GetBitContext *gb,
     /* [DIRAC_STD] custom_scan_format_flag */
     if (get_bits1(gb))
         /* [DIRAC_STD] SOURCE_SAMPLING */
-        dsh->interlaced = svq3_get_ue_golomb(gb);
+        dsh->interlaced = get_interleaved_ue_golomb(gb);
     if (dsh->interlaced > 1)
         return AVERROR_INVALIDDATA;
 
     /* [DIRAC_STD] 10.3.5 Frame Rate. frame_rate(video_params) */
     if (get_bits1(gb)) { /* [DIRAC_STD] custom_frame_rate_flag */
-        dsh->frame_rate_index = svq3_get_ue_golomb(gb);
+        dsh->frame_rate_index = get_interleaved_ue_golomb(gb);
 
         if (dsh->frame_rate_index > 10)
             return AVERROR_INVALIDDATA;
 
         if (!dsh->frame_rate_index) {
             /* [DIRAC_STD] FRAME_RATE_NUMER */
-            frame_rate.num = svq3_get_ue_golomb(gb);
+            frame_rate.num = get_interleaved_ue_golomb(gb);
             /* [DIRAC_STD] FRAME_RATE_DENOM */
-            frame_rate.den = svq3_get_ue_golomb(gb);
+            frame_rate.den = get_interleaved_ue_golomb(gb);
         }
     }
     /* [DIRAC_STD] preset_frame_rate(video_params, index) */
@@ -201,14 +201,14 @@ static int parse_source_parameters(AVDiracSeqHeader *dsh, GetBitContext *gb,
      * pixel_aspect_ratio(video_params) */
     if (get_bits1(gb)) { /* [DIRAC_STD] custom_pixel_aspect_ratio_flag */
         /* [DIRAC_STD] index */
-        dsh->aspect_ratio_index = svq3_get_ue_golomb(gb);
+        dsh->aspect_ratio_index = get_interleaved_ue_golomb(gb);
 
         if (dsh->aspect_ratio_index > 6)
             return AVERROR_INVALIDDATA;
 
         if (!dsh->aspect_ratio_index) {
-            dsh->sample_aspect_ratio.num = svq3_get_ue_golomb(gb);
-            dsh->sample_aspect_ratio.den = svq3_get_ue_golomb(gb);
+            dsh->sample_aspect_ratio.num = get_interleaved_ue_golomb(gb);
+            dsh->sample_aspect_ratio.den = get_interleaved_ue_golomb(gb);
         }
     }
     /* [DIRAC_STD] Take value from Table 10.4 Available preset pixel
@@ -220,13 +220,13 @@ static int parse_source_parameters(AVDiracSeqHeader *dsh, GetBitContext *gb,
     /* [DIRAC_STD] 10.3.7 Clean area. clean_area(video_params) */
     if (get_bits1(gb)) { /* [DIRAC_STD] custom_clean_area_flag */
         /* [DIRAC_STD] CLEAN_WIDTH */
-        dsh->clean_width = svq3_get_ue_golomb(gb);
+        dsh->clean_width = get_interleaved_ue_golomb(gb);
         /* [DIRAC_STD] CLEAN_HEIGHT */
-        dsh->clean_height = svq3_get_ue_golomb(gb);
+        dsh->clean_height = get_interleaved_ue_golomb(gb);
         /* [DIRAC_STD] CLEAN_LEFT_OFFSET */
-        dsh->clean_left_offset = svq3_get_ue_golomb(gb);
+        dsh->clean_left_offset = get_interleaved_ue_golomb(gb);
         /* [DIRAC_STD] CLEAN_RIGHT_OFFSET */
-        dsh->clean_right_offset = svq3_get_ue_golomb(gb);
+        dsh->clean_right_offset = get_interleaved_ue_golomb(gb);
     }
 
     /* [DIRAC_STD] 10.3.8 Signal range. signal_range(video_params)
@@ -234,17 +234,17 @@ static int parse_source_parameters(AVDiracSeqHeader *dsh, GetBitContext *gb,
      * AVCOL_RANGE_MPEG/JPEG values */
     if (get_bits1(gb)) { /* [DIRAC_STD] custom_signal_range_flag */
         /* [DIRAC_STD] index */
-        dsh->pixel_range_index = svq3_get_ue_golomb(gb);
+        dsh->pixel_range_index = get_interleaved_ue_golomb(gb);
 
         if (dsh->pixel_range_index > 4)
             return AVERROR_INVALIDDATA;
 
         // This assumes either fullrange or MPEG levels only
         if (!dsh->pixel_range_index) {
-            luma_offset = svq3_get_ue_golomb(gb);
-            luma_depth  = av_log2(svq3_get_ue_golomb(gb)) + 1;
-            svq3_get_ue_golomb(gb); /* chroma offset    */
-            svq3_get_ue_golomb(gb); /* chroma excursion */
+            luma_offset = get_interleaved_ue_golomb(gb);
+            luma_depth  = av_log2(get_interleaved_ue_golomb(gb)) + 1;
+            get_interleaved_ue_golomb(gb); /* chroma offset    */
+            get_interleaved_ue_golomb(gb); /* chroma excursion */
             dsh->color_range = luma_offset ? AVCOL_RANGE_MPEG
                                            : AVCOL_RANGE_JPEG;
         }
@@ -265,7 +265,7 @@ static int parse_source_parameters(AVDiracSeqHeader *dsh, GetBitContext *gb,
     /* [DIRAC_STD] 10.3.9 Colour specification. colour_spec(video_params) */
     if (get_bits1(gb)) { /* [DIRAC_STD] custom_colour_spec_flag */
         /* [DIRAC_STD] index */
-        idx = dsh->color_spec_index = svq3_get_ue_golomb(gb);
+        idx = dsh->color_spec_index = get_interleaved_ue_golomb(gb);
 
         if (dsh->color_spec_index > 4)
             return AVERROR_INVALIDDATA;
@@ -277,20 +277,20 @@ static int parse_source_parameters(AVDiracSeqHeader *dsh, GetBitContext *gb,
         if (!dsh->color_spec_index) {
             /* [DIRAC_STD] 10.3.9.1 Colour primaries */
             if (get_bits1(gb)) {
-                idx = svq3_get_ue_golomb(gb);
+                idx = get_interleaved_ue_golomb(gb);
                 if (idx < 3)
                     dsh->color_primaries = dirac_primaries[idx];
             }
             /* [DIRAC_STD] 10.3.9.2 Colour matrix */
             if (get_bits1(gb)) {
-                idx = svq3_get_ue_golomb(gb);
+                idx = get_interleaved_ue_golomb(gb);
                 if (!idx)
                     dsh->colorspace = AVCOL_SPC_BT709;
                 else if (idx == 1)
                     dsh->colorspace = AVCOL_SPC_BT470BG;
             }
             /* [DIRAC_STD] 10.3.9.3 Transfer function */
-            if (get_bits1(gb) && !svq3_get_ue_golomb(gb))
+            if (get_bits1(gb) && !get_interleaved_ue_golomb(gb))
                 dsh->color_trc = AVCOL_TRC_BT709;
         }
     } else {
@@ -323,13 +323,13 @@ int av_dirac_parse_sequence_header(AVDiracSeqHeader **pdsh,
         goto fail;
 
     /* [DIRAC_SPEC] 10.1 Parse Parameters. parse_parameters() */
-    version_major  = svq3_get_ue_golomb(&gb);
-    svq3_get_ue_golomb(&gb); /* version_minor */
-    dsh->profile = svq3_get_ue_golomb(&gb);
-    dsh->level   = svq3_get_ue_golomb(&gb);
+    version_major = get_interleaved_ue_golomb(&gb);
+    get_interleaved_ue_golomb(&gb); /* version_minor */
+    dsh->profile = get_interleaved_ue_golomb(&gb);
+    dsh->level   = get_interleaved_ue_golomb(&gb);
     /* [DIRAC_SPEC] sequence_header() -> base_video_format as defined in
      * 10.2 Base Video Format, table 10.1 Dirac predefined video formats */
-    video_format   = svq3_get_ue_golomb(&gb);
+    video_format = get_interleaved_ue_golomb(&gb);
 
     if (log_ctx) {
         if (version_major < 2)
@@ -366,7 +366,7 @@ int av_dirac_parse_sequence_header(AVDiracSeqHeader **pdsh,
 
     /* [DIRAC_STD] picture_coding_mode shall be 0 for fields and 1 for frames
      * currently only used to signal field coding */
-    picture_coding_mode = svq3_get_ue_golomb(&gb);
+    picture_coding_mode = get_interleaved_ue_golomb(&gb);
     if (picture_coding_mode != 0) {
         if (log_ctx) {
             av_log(log_ctx, AV_LOG_ERROR, "Unsupported picture coding mode %d",
diff --git a/libavcodec/golomb.h b/libavcodec/golomb.h
index 398fe3b..2d0be89 100644
--- a/libavcodec/golomb.h
+++ b/libavcodec/golomb.h
@@ -108,7 +108,7 @@ static inline int get_ue_golomb_31(GetBitContext *gb)
     return ff_ue_golomb_vlc_code[buf];
 }
 
-static inline unsigned svq3_get_ue_golomb(GetBitContext *gb)
+static inline unsigned get_interleaved_ue_golomb(GetBitContext *gb)
 {
     uint32_t buf;
 
@@ -218,7 +218,7 @@ static inline int get_se_golomb_long(GetBitContext *gb)
     return buf;
 }
 
-static inline int svq3_get_se_golomb(GetBitContext *gb)
+static inline int get_interleaved_se_golomb(GetBitContext *gb)
 {
     unsigned int buf;
 
@@ -253,7 +253,7 @@ static inline int svq3_get_se_golomb(GetBitContext *gb)
 
 static inline int dirac_get_se_golomb(GetBitContext *gb)
 {
-    uint32_t ret = svq3_get_ue_golomb(gb);
+    uint32_t ret = get_interleaved_ue_golomb(gb);
 
     if (ret) {
         uint32_t buf;
diff --git a/libavcodec/rv30.c b/libavcodec/rv30.c
index bf22df5..7218fa3 100644
--- a/libavcodec/rv30.c
+++ b/libavcodec/rv30.c
@@ -81,7 +81,7 @@ static int rv30_decode_intra_types(RV34DecContext *r, GetBitContext *gb, int8_t
 
     for(i = 0; i < 4; i++, dst += r->intra_types_stride - 4){
         for(j = 0; j < 4; j+= 2){
-            unsigned code = svq3_get_ue_golomb(gb) << 1;
+            unsigned code = get_interleaved_ue_golomb(gb) << 1;
             if(code >= 81*2){
                 av_log(r->s.avctx, AV_LOG_ERROR, "Incorrect intra prediction code\n");
                 return -1;
@@ -109,7 +109,7 @@ static int rv30_decode_mb_info(RV34DecContext *r)
     static const int rv30_b_types[6] = { RV34_MB_SKIP, RV34_MB_B_DIRECT, RV34_MB_B_FORWARD, RV34_MB_B_BACKWARD, RV34_MB_TYPE_INTRA, RV34_MB_TYPE_INTRA16x16 };
     MpegEncContext *s = &r->s;
     GetBitContext *gb = &s->gb;
-    unsigned code     = svq3_get_ue_golomb(gb);
+    unsigned code = get_interleaved_ue_golomb(gb);
 
     if (code > 11) {
         av_log(s->avctx, AV_LOG_ERROR, "Incorrect MB type code\n");
diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c
index 5fa71d8..4220195 100644
--- a/libavcodec/rv34.c
+++ b/libavcodec/rv34.c
@@ -854,8 +854,8 @@ static int rv34_decode_mv(RV34DecContext *r, int block_type)
 
     memset(r->dmv, 0, sizeof(r->dmv));
     for(i = 0; i < num_mvs[block_type]; i++){
-        r->dmv[i][0] = svq3_get_se_golomb(gb);
-        r->dmv[i][1] = svq3_get_se_golomb(gb);
+        r->dmv[i][0] = get_interleaved_se_golomb(gb);
+        r->dmv[i][1] = get_interleaved_se_golomb(gb);
     }
     switch(block_type){
     case RV34_MB_TYPE_INTRA:
diff --git a/libavcodec/rv40.c b/libavcodec/rv40.c
index e6c77e8..0da1312 100644
--- a/libavcodec/rv40.c
+++ b/libavcodec/rv40.c
@@ -231,7 +231,7 @@ static int rv40_decode_mb_info(RV34DecContext *r)
     int mb_pos = s->mb_x + s->mb_y * s->mb_stride;
 
     if(!r->s.mb_skip_run)
-        r->s.mb_skip_run = svq3_get_ue_golomb(gb) + 1;
+        r->s.mb_skip_run = get_interleaved_ue_golomb(gb) + 1;
 
     if(--r->s.mb_skip_run)
          return RV34_MB_SKIP;
diff --git a/libavcodec/svq3.c b/libavcodec/svq3.c
index b11e6ff..9dc1fb5 100644
--- a/libavcodec/svq3.c
+++ b/libavcodec/svq3.c
@@ -290,7 +290,7 @@ static inline int svq3_decode_block(GetBitContext *gb, int16_t *block,
     const uint8_t *const scan = scan_patterns[type];
 
     for (limit = (16 >> intra); index < 16; index = limit, limit += 8) {
-        for (; (vlc = svq3_get_ue_golomb(gb)) != 0; index++) {
+        for (; (vlc = get_interleaved_ue_golomb(gb)) != 0; index++) {
             int sign = (vlc & 1) ? 0 : -1;
             vlc      = vlc + 1 >> 1;
 
@@ -527,8 +527,8 @@ static inline int svq3_mc_dir(SVQ3Context *s, int size, int mode,
             if (mode == PREDICT_MODE) {
                 dx = dy = 0;
             } else {
-                dy = svq3_get_se_golomb(&s->gb_slice);
-                dx = svq3_get_se_golomb(&s->gb_slice);
+                dy = get_interleaved_se_golomb(&s->gb_slice);
+                dx = get_interleaved_se_golomb(&s->gb_slice);
 
                 if (dx == INVALID_VLC || dy == INVALID_VLC) {
                     av_log(s->avctx, AV_LOG_ERROR, "invalid MV vlc\n");
@@ -839,7 +839,7 @@ static int svq3_decode_mb(SVQ3Context *s, unsigned int mb_type)
 
             /* decode prediction codes for luma blocks */
             for (i = 0; i < 16; i += 2) {
-                vlc = svq3_get_ue_golomb(&s->gb_slice);
+                vlc = get_interleaved_ue_golomb(&s->gb_slice);
 
                 if (vlc >= 25) {
                     av_log(s->avctx, AV_LOG_ERROR,
@@ -917,7 +917,7 @@ static int svq3_decode_mb(SVQ3Context *s, unsigned int mb_type)
 
     if (!IS_INTRA16x16(mb_type) &&
         (!IS_SKIP(mb_type) || s->pict_type == AV_PICTURE_TYPE_B)) {
-        if ((vlc = svq3_get_ue_golomb(&s->gb_slice)) >= 48) {
+        if ((vlc = get_interleaved_ue_golomb(&s->gb_slice)) >= 48) {
             av_log(s->avctx, AV_LOG_ERROR, "cbp_vlc=%"PRIu32"\n", vlc);
             return -1;
         }
@@ -927,7 +927,7 @@ static int svq3_decode_mb(SVQ3Context *s, unsigned int mb_type)
     }
     if (IS_INTRA16x16(mb_type) ||
         (s->pict_type != AV_PICTURE_TYPE_I && s->adaptive_quant && cbp)) {
-        s->qscale += svq3_get_se_golomb(&s->gb_slice);
+        s->qscale += get_interleaved_se_golomb(&s->gb_slice);
 
         if (s->qscale > 31u) {
             av_log(s->avctx, AV_LOG_ERROR, "qscale:%d\n", s->qscale);
@@ -1045,7 +1045,7 @@ static int svq3_decode_slice_header(AVCodecContext *avctx)
         skip_bits_long(&s->gb, slice_bytes * 8);
     }
 
-    if ((slice_id = svq3_get_ue_golomb(&s->gb_slice)) >= 3) {
+    if ((slice_id = get_interleaved_ue_golomb(&s->gb_slice)) >= 3) {
         av_log(s->avctx, AV_LOG_ERROR, "illegal slice type %u \n", slice_id);
         return -1;
     }
@@ -1228,12 +1228,12 @@ static av_cold int svq3_decode_init(AVCodecContext *avctx)
         avctx->has_b_frames = !s->low_delay;
         if (s->unknown_flag) {
 #if CONFIG_ZLIB
-            unsigned watermark_width  = svq3_get_ue_golomb(&gb);
-            unsigned watermark_height = svq3_get_ue_golomb(&gb);
-            int u1                    = svq3_get_ue_golomb(&gb);
+            unsigned watermark_width  = get_interleaved_ue_golomb(&gb);
+            unsigned watermark_height = get_interleaved_ue_golomb(&gb);
+            int u1                    = get_interleaved_ue_golomb(&gb);
             int u2                    = get_bits(&gb, 8);
             int u3                    = get_bits(&gb, 2);
-            int u4                    = svq3_get_ue_golomb(&gb);
+            int u4                    = get_interleaved_ue_golomb(&gb);
             unsigned long buf_len     = watermark_width *
                                         watermark_height * 4;
             int offset                = get_bits_count(&gb) + 7 >> 3;
@@ -1501,7 +1501,7 @@ static int svq3_decode_frame(AVCodecContext *avctx, void *data,
                 /* TODO: support s->mb_skip_run */
             }
 
-            mb_type = svq3_get_ue_golomb(&s->gb_slice);
+            mb_type = get_interleaved_ue_golomb(&s->gb_slice);
 
             if (s->pict_type == AV_PICTURE_TYPE_I)
                 mb_type += 8;



More information about the ffmpeg-cvslog mailing list