avcodec/mv30: Reduce the size of tables used to initialize VLCs

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>
This commit is contained in:
Andreas Rheinhardt 2020-11-16 14:56:13 +01:00
parent 0ecd6879b3
commit 90c4958640
1 changed files with 4 additions and 6 deletions

View File

@ -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)