diff options
author | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-11-17 15:03:02 +0100 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-12-08 17:51:47 +0100 |
commit | 117575ae2622d3a42af43f76a1940239c8088292 (patch) | |
tree | d31d437afc1b1eef59b808d3bab8a837ff5811cc /libavcodec/mpegaudiodec_template.c | |
parent | 8c6a67e6c40e7b6ab089ecd53886786c86f8ec5e (diff) | |
download | ffmpeg-117575ae2622d3a42af43f76a1940239c8088292.tar.gz |
avcodec/mpegaudiodec_template: Avoid VLC size tables
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavcodec/mpegaudiodec_template.c')
-rw-r--r-- | libavcodec/mpegaudiodec_template.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/libavcodec/mpegaudiodec_template.c b/libavcodec/mpegaudiodec_template.c index 0634f70b05..53db13d0d4 100644 --- a/libavcodec/mpegaudiodec_template.c +++ b/libavcodec/mpegaudiodec_template.c @@ -103,13 +103,8 @@ static VLC_TYPE huff_vlc_tables[ 0 + 128 + 128 + 128 + 130 + 128 + 154 + 166 + 142 + 204 + 190 + 170 + 542 + 460 + 662 + 414 ][2]; -static const int huff_vlc_tables_sizes[16] = { - 0, 128, 128, 128, 130, 128, 154, 166, - 142, 204, 190, 170, 542, 460, 662, 414 -}; static VLC huff_quad_vlc[2]; static VLC_TYPE huff_quad_vlc_tables[64+16][2]; -static const int huff_quad_vlc_tables_sizes[2] = { 64, 16 }; /* computed from band_size_long */ static uint16_t band_index_long[9][23]; #include "mpegaudio_tablegen.h" @@ -309,22 +304,23 @@ static av_cold void decode_init_static(void) /* XXX: fail test */ huff_vlc[i].table = huff_vlc_tables+offset; - huff_vlc[i].table_allocated = huff_vlc_tables_sizes[i]; + huff_vlc[i].table_allocated = FF_ARRAY_ELEMS(huff_vlc_tables) - offset; init_vlc(&huff_vlc[i], 7, 512, tmp_bits, 1, 1, tmp_codes, 2, 2, - INIT_VLC_USE_NEW_STATIC); - offset += huff_vlc_tables_sizes[i]; + INIT_VLC_STATIC_OVERLONG); + offset += huff_vlc[i].table_size; } av_assert0(offset == FF_ARRAY_ELEMS(huff_vlc_tables)); offset = 0; for (i = 0; i < 2; i++) { + int bits = i == 0 ? 6 : 4; huff_quad_vlc[i].table = huff_quad_vlc_tables+offset; - huff_quad_vlc[i].table_allocated = huff_quad_vlc_tables_sizes[i]; - init_vlc(&huff_quad_vlc[i], i == 0 ? 6 : 4, 16, + huff_quad_vlc[i].table_allocated = 1 << bits; + offset += 1 << bits; + init_vlc(&huff_quad_vlc[i], bits, 16, mpa_quad_bits[i], 1, 1, mpa_quad_codes[i], 1, 1, INIT_VLC_USE_NEW_STATIC); - offset += huff_quad_vlc_tables_sizes[i]; } av_assert0(offset == FF_ARRAY_ELEMS(huff_quad_vlc_tables)); |