aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/4xm.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2023-09-24 17:23:47 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2023-10-31 20:47:00 +0100
commit25b9ff2780fdf1fbce914aeb68e77699d47147b6 (patch)
treef99041f4720f5b176884ebaed5cdae51cb2f19c4 /libavcodec/4xm.c
parente5dcde620d5617fbfdc1e8a699415b742245638f (diff)
downloadffmpeg-25b9ff2780fdf1fbce914aeb68e77699d47147b6.tar.gz
avcodec/4xm: Avoid unnecessary VLC structures
Everything besides VLC.table is basically write-only and even VLC.table can be removed by accessing the underlying table directly. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/4xm.c')
-rw-r--r--libavcodec/4xm.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/libavcodec/4xm.c b/libavcodec/4xm.c
index c3e3a45df5..158b37a38b 100644
--- a/libavcodec/4xm.c
+++ b/libavcodec/4xm.c
@@ -125,7 +125,7 @@ static const uint8_t dequant_table[64] = {
20, 35, 34, 32, 31, 22, 15, 8,
};
-static VLC block_type_vlc[2][4];
+static VLCElem block_type_vlc[2][4][32];
typedef struct CFrameBuffer {
@@ -250,17 +250,15 @@ static void idct(int16_t block[64])
static av_cold void init_vlcs(void)
{
- static VLCElem table[2][4][32];
int i, j;
for (i = 0; i < 2; i++) {
for (j = 0; j < 4; j++) {
- block_type_vlc[i][j].table = table[i][j];
- block_type_vlc[i][j].table_allocated = 32;
- vlc_init(&block_type_vlc[i][j], BLOCK_TYPE_VLC_BITS, 7,
- &block_type_tab[i][j][0][1], 2, 1,
- &block_type_tab[i][j][0][0], 2, 1,
- VLC_INIT_USE_STATIC);
+ ff_vlc_init_table_sparse(block_type_vlc[i][j], FF_ARRAY_ELEMS(block_type_vlc[i][j]),
+ BLOCK_TYPE_VLC_BITS, 7,
+ &block_type_tab[i][j][0][1], 2, 1,
+ &block_type_tab[i][j][0][0], 2, 1,
+ NULL, 0, 0, 0);
}
}
}
@@ -357,7 +355,7 @@ static int decode_p_block(FourXContext *f, uint16_t *dst, const uint16_t *src,
if (get_bits_left(&f->gb) < 1)
return AVERROR_INVALIDDATA;
h = 1 << log2h;
- code = get_vlc2(&f->gb, block_type_vlc[1 - (f->version > 1)][index].table,
+ code = get_vlc2(&f->gb, block_type_vlc[1 - (f->version > 1)][index],
BLOCK_TYPE_VLC_BITS, 1);
av_assert0(code >= 0 && code <= 6);