diff mbox series

[FFmpeg-devel,v2,144/162] avcodec/imm4: Don't use too big VLC table

Message ID 20201120073327.820745-45-andreas.rheinhardt@gmail.com
State Accepted
Commit 50d50653d106184b60f464eeba20e132c137090e
Headers show
Series VLC, esp. init_vlc patches
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished

Commit Message

Andreas Rheinhardt Nov. 20, 2020, 7:33 a.m. UTC
Using more bits than the longest code has makes no sense.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavcodec/imm4.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/imm4.c b/libavcodec/imm4.c
index d92bc30ddc..85d8526bc8 100644
--- a/libavcodec/imm4.c
+++ b/libavcodec/imm4.c
@@ -33,6 +33,8 @@ 
 #include "idctdsp.h"
 #include "internal.h"
 
+#define CBPLO_VLC_BITS   6
+
 typedef struct IMM4Context {
     BswapDSPContext bdsp;
     GetBitContext  gb;
@@ -488,8 +490,9 @@  static int decode_frame(AVCodecContext *avctx, void *data,
 
 static av_cold void imm4_init_static_data(void)
 {
-    INIT_VLC_SPARSE_STATIC(&cbplo_tab, 9, FF_ARRAY_ELEMS(cbplo_bits),
-                           cbplo_bits, 1, 1, cbplo_codes, 1, 1, cbplo_symbols, 1, 1, 512);
+    INIT_VLC_SPARSE_STATIC(&cbplo_tab, CBPLO_VLC_BITS, FF_ARRAY_ELEMS(cbplo_bits),
+                           cbplo_bits, 1, 1, cbplo_codes, 1, 1, cbplo_symbols, 1, 1,
+                           1 << CBPLO_VLC_BITS);
 
     INIT_VLC_SPARSE_STATIC(&cbphi_tab, 6, FF_ARRAY_ELEMS(cbphi_bits),
                            cbphi_bits, 1, 1, cbphi_codes, 1, 1, NULL, 0, 0, 64);