diff mbox series

[FFmpeg-devel,v2,149/162] avcodec/mv30: Reduce the size of tables used to initialize VLCs

Message ID 20201120073327.820745-50-andreas.rheinhardt@gmail.com
State New
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
By switching from ff_init_vlc_sparse() to ff_init_vlc_from_lengths() one
can remove the array of codes of type uint16_t here; given that the
symbols are the default ones (0,1,2,...), no explicit symbols table
needs to be added.

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

Patch

diff --git a/libavcodec/mv30.c b/libavcodec/mv30.c
index 5bfe4b0614..1ee6be0c99 100644
--- a/libavcodec/mv30.c
+++ b/libavcodec/mv30.c
@@ -35,6 +35,8 @@ 
 #include "internal.h"
 #include "aandcttab.h"
 
+#define CBP_VLC_BITS  9
+
 typedef struct MV30Context {
     GetBitContext  gb;
 
@@ -651,18 +653,14 @@  static int decode_frame(AVCodecContext *avctx, void *data,
     return avpkt->size;
 }
 
-static const uint16_t cbp_codes[] = {
-    0, 1, 4, 5, 6, 0xE, 0x1E, 0x3E, 0x7E, 0xFE, 0x1FE, 0x1FF,
-};
-
 static const uint8_t cbp_bits[] = {
     2, 2, 3, 3, 3, 4, 5, 6, 7, 8, 9, 9,
 };
 
 static av_cold void init_static_data(void)
 {
-    INIT_VLC_SPARSE_STATIC(&cbp_tab, 9, FF_ARRAY_ELEMS(cbp_bits),
-                           cbp_bits, 1, 1, cbp_codes, 2, 2, NULL, 0, 0, 512);
+    INIT_VLC_STATIC_FROM_LENGTHS(&cbp_tab, CBP_VLC_BITS, FF_ARRAY_ELEMS(cbp_bits),
+                                 cbp_bits, 1, NULL, 0, 0, 0, 0, 1 << CBP_VLC_BITS);
 }
 
 static av_cold int decode_init(AVCodecContext *avctx)