diff mbox series

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

Message ID 20231022215113.3469-6-michael@niedermayer.cc
State New
Headers show
Series [FFmpeg-devel,1/9] avcodec/vlc: merge lost 16bit end of array check | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Michael Niedermayer Oct. 22, 2023, 9:51 p.m. UTC
No difference in my testcase in the tables content

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

Patch

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);
             }
-        }
     }
 }