diff mbox series

[FFmpeg-devel,4/7] proresdec2: offset VLCs by 1 to avoid 1 add

Message ID 20230908081508.510-4-christophe.gisquet@gmail.com
State New
Headers show
Series [FFmpeg-devel,1/7] proresdec2: port and fix for cached reader | expand

Checks

Context Check Description
andriy/make_x86 fail Make failed

Commit Message

Christophe Gisquet Sept. 8, 2023, 8:15 a.m. UTC
Pretty harmless, but not much gained either.
---
 libavcodec/proresdec2.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/proresdec2.c b/libavcodec/proresdec2.c
index 91c689d9ef..e3cef402d7 100644
--- a/libavcodec/proresdec2.c
+++ b/libavcodec/proresdec2.c
@@ -152,7 +152,9 @@  static av_cold void init_vlcs(void)
         switch_val  = (switch_bits+1) << rice_order;
 
         // Values are actually transformed, but this is more a wrapping
-        for (ac = 0; ac <1<<AC_BITS; ac++) {
+        ac_codes[0] = 0;
+        ac_bits[0] = 0;
+        for (ac = 0; ac < (1<<AC_BITS)-1; ac++) {
             int exponent, bits, val = ac;
             unsigned int code;
 
@@ -169,8 +171,8 @@  static av_cold void init_vlcs(void)
                 code = 1;
             }
             if (bits > max_bits) max_bits = bits;
-            ac_bits [ac] = bits;
-            ac_codes[ac] = code;
+            ac_bits [ac+1] = bits;
+            ac_codes[ac+1] = code;
         }
 
         ff_free_vlc(ac_vlc+i);
@@ -609,7 +611,6 @@  static av_always_inline int decode_ac_coeffs(AVCodecContext *avctx, GetBitContex
         }
 
         level = get_vlc2(gb, tbl->table, PRORES_LEV_BITS, 3);
-        level += 1;
 
         i = pos >> log2_block_count;