[FFmpeg-devel] [PATCH 6/9] avcodec/vlc: Remove mysterious jitter loop in multi VLC

Michael Niedermayer michael at niedermayer.cc
Mon Oct 23 00:51:10 EEST 2023


No difference in my testcase in the tables content

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 libavcodec/vlc.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/libavcodec/vlc.c b/libavcodec/vlc.c
index 4adec2da705..4c96fcddc9b 100644
--- a/libavcodec/vlc.c
+++ b/libavcodec/vlc.c
@@ -360,16 +360,14 @@ static void add_level(VLC_MULTI_ELEM *table, const int is16bit,
 {
     int max_symbols = VLC_MULTI_MAX_SYMBOLS >> is16bit;
     for (int i = num-1; i >= max; i--) {
-        for (int j = 0; j < 2; j++) {
             int newlimit, sym;
-            int t = j ? i-1 : i;
-            int l = buf[t].bits;
+            int l = buf[i].bits;
             uint32_t code;
 
-            sym = buf[t].symbol;
+            sym = buf[i].symbol;
             if (l >= curlimit)
                 return;
-            code = curcode + (buf[t].code >> curlen);
+            code = curcode + (buf[i].code >> curlen);
             newlimit = curlimit - l;
             l  += curlen;
             if (is16bit) AV_WN16(info.val+2*curlevel, sym);
@@ -390,7 +388,6 @@ static void add_level(VLC_MULTI_ELEM *table, const int is16bit,
                           code, l, newlimit, curlevel+1,
                           minlen, max, levelcnt, info);
             }
-        }
     }
 }
 
-- 
2.17.1



More information about the ffmpeg-devel mailing list