[FFmpeg-devel] [PATCH 3/7] avcodec/msmpeg4enc: Remove dead code for inexistent VC-1 encoder

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Thu Apr 8 22:42:16 EEST 2021


Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
 libavcodec/msmpeg4enc.c | 23 ++++-------------------
 1 file changed, 4 insertions(+), 19 deletions(-)

diff --git a/libavcodec/msmpeg4enc.c b/libavcodec/msmpeg4enc.c
index 59a18532c2..7147015042 100644
--- a/libavcodec/msmpeg4enc.c
+++ b/libavcodec/msmpeg4enc.c
@@ -492,8 +492,7 @@ void ff_msmpeg4_encode_mb(MpegEncContext * s,
 static void msmpeg4_encode_dc(MpegEncContext * s, int level, int n, int *dir_ptr)
 {
     int sign, code;
-    int pred, av_uninit(extquant);
-    int extrabits = 0;
+    int pred;
 
     int16_t *dc_val;
     pred = ff_msmpeg4_pred_dc(s, n, &dc_val, dir_ptr);
@@ -527,15 +526,6 @@ static void msmpeg4_encode_dc(MpegEncContext * s, int level, int n, int *dir_ptr
         code = level;
         if (code > DC_MAX)
             code = DC_MAX;
-        else if( s->msmpeg4_version>=6 ) {
-            if( s->qscale == 1 ) {
-                extquant = (level + 3) & 0x3;
-                code  = ((level+3)>>2);
-            } else if( s->qscale == 2 ) {
-                extquant = (level + 1) & 0x1;
-                code  = ((level+1)>>1);
-            }
-        }
 
         if (s->dc_table_index == 0) {
             if (n < 4) {
@@ -551,13 +541,8 @@ static void msmpeg4_encode_dc(MpegEncContext * s, int level, int n, int *dir_ptr
             }
         }
 
-        if(s->msmpeg4_version>=6 && s->qscale<=2)
-            extrabits = 3 - s->qscale;
-
         if (code == DC_MAX)
-            put_bits(&s->pb, 8 + extrabits, level);
-        else if(extrabits > 0)//== VC1 && s->qscale<=2
-            put_bits(&s->pb, extrabits, extquant);
+            put_bits(&s->pb, 8, level);
 
         if (level != 0) {
             put_bits(&s->pb, 1, sign);
@@ -596,7 +581,7 @@ void ff_msmpeg4_encode_block(MpegEncContext * s, int16_t * block, int n)
     }
 
     /* recalculate block_last_index for M$ wmv1 */
-    if(s->msmpeg4_version>=4 && s->msmpeg4_version<6 && s->block_last_index[n]>0){
+    if (s->msmpeg4_version >= 4 && s->block_last_index[n] > 0) {
         for(last_index=63; last_index>=0; last_index--){
             if(block[scantable[last_index]]) break;
         }
@@ -656,7 +641,7 @@ void ff_msmpeg4_encode_block(MpegEncContext * s, int16_t * block, int n)
                                 s->esc3_run_length= 6;
                                 //ESCLVLSZ + ESCRUNSZ
                                 if(s->qscale<8)
-                                    put_bits(&s->pb, 6 + (s->msmpeg4_version>=6), 3);
+                                    put_bits(&s->pb, 6, 3);
                                 else
                                     put_bits(&s->pb, 8, 3);
                             }
-- 
2.27.0



More information about the ffmpeg-devel mailing list