diff mbox series

[FFmpeg-devel,029/114] avcodec/rv10: Make VLC tables smaller

Message ID 20201110104851.321029-30-andreas.rheinhardt@gmail.com
State Superseded
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

Commit Message

Andreas Rheinhardt Nov. 10, 2020, 10:47 a.m. UTC
These tables were huge (14 bits) because one needed 14 bits in order to
find out whether a code is valid and in the VLC table or a valid code that
required hacky workarounds due to RealVideo 1.0 using multiple codes
for the same symbol and the code predating the introduction of symbols
tables for VLCs.

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

Patch

diff --git a/libavcodec/rv10.c b/libavcodec/rv10.c
index 08887c121b..a7cb8118e5 100644
--- a/libavcodec/rv10.c
+++ b/libavcodec/rv10.c
@@ -46,7 +46,7 @@ 
 #define RV_GET_MICRO_VER(x) (((x) >> 12) & 0xFF)
 
 #define MAX_VLC_ENTRIES 1023 // Note: Does not include the skip entries.
-#define DC_VLC_BITS 14 // FIXME find a better solution
+#define DC_VLC_BITS        9
 
 typedef struct RVDecContext {
     MpegEncContext m;
@@ -409,14 +409,14 @@  static av_cold int rv10_decode_init(AVCodecContext *avctx)
 
     /* init rv vlc */
     if (!done) {
-        static VLC_TYPE table[16896 + 16640][2];
+        static VLC_TYPE table[1472 + 992][2];
 
         rv_dc_lum.table             = table;
-        rv_dc_lum.table_allocated   = 16896;
+        rv_dc_lum.table_allocated   = 1472;
         rv10_build_vlc(&rv_dc_lum, rv_lum_len_count,
                        rv_sym_run_len, FF_ARRAY_ELEMS(rv_sym_run_len));
-        rv_dc_chrom.table           = &table[16896];
-        rv_dc_chrom.table_allocated = 16640;
+        rv_dc_chrom.table           = &table[1472];
+        rv_dc_chrom.table_allocated = 992;
         rv10_build_vlc(&rv_dc_chrom, rv_chrom_len_count,
                        rv_sym_run_len, FF_ARRAY_ELEMS(rv_sym_run_len) - 2);
         done = 1;