diff options
author | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-11-17 17:34:04 +0100 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-12-08 17:51:47 +0100 |
commit | b29a3f3e0f6128f3effa854a3a7bfed62feeeb1c (patch) | |
tree | debc3c2f32bfd963e9b9dc2eac9249172b70827a /libavcodec/mpegaudiodec_template.c | |
parent | db234dbf73fe97611a75163bbb3b7c22ff953696 (diff) | |
download | ffmpeg-b29a3f3e0f6128f3effa854a3a7bfed62feeeb1c.tar.gz |
avcodec/mpegaudiodec: Combine tables used to initialize VLCs
Up until now, there were several indiviual tables which were accessed
via pointers to them; by combining the tables, one can avoid said
pointers, saving space.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavcodec/mpegaudiodec_template.c')
-rw-r--r-- | libavcodec/mpegaudiodec_template.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/libavcodec/mpegaudiodec_template.c b/libavcodec/mpegaudiodec_template.c index edd69684da..b03f7cfc33 100644 --- a/libavcodec/mpegaudiodec_template.c +++ b/libavcodec/mpegaudiodec_template.c @@ -257,6 +257,7 @@ static inline int l3_unscale(int value, int exponent) static av_cold void decode_init_static(void) { + const uint8_t *huff_sym = mpa_huffsymbols, *huff_lens = mpa_hufflens; int i, j, k; int offset; @@ -287,12 +288,12 @@ static av_cold void decode_init_static(void) /* huffman decode tables */ offset = 0; for (int i = 0; i < 15;) { - const HuffTable *h = &mpa_huff_tables[i]; uint16_t tmp_symbols[256]; - int nb_codes = h->nb_codes; + int nb_codes_minus_one = mpa_huff_sizes_minus_one[i]; + int j; - for (int j = 0; j < nb_codes; j++) { - uint8_t high = h->symbols[j] & 0xF0, low = h->symbols[j] & 0xF; + for (j = 0; j <= nb_codes_minus_one; j++) { + uint8_t high = huff_sym[j] & 0xF0, low = huff_sym[j] & 0xF; tmp_symbols[j] = high << 1 | ((high && low) << 4) | low; } @@ -300,10 +301,12 @@ static av_cold void decode_init_static(void) /* XXX: fail test */ huff_vlc[++i].table = huff_vlc_tables + offset; huff_vlc[i].table_allocated = FF_ARRAY_ELEMS(huff_vlc_tables) - offset; - ff_init_vlc_from_lengths(&huff_vlc[i], 7, nb_codes, - h->bits, 1, tmp_symbols, 2, 2, + ff_init_vlc_from_lengths(&huff_vlc[i], 7, j, + huff_lens, 1, tmp_symbols, 2, 2, 0, INIT_VLC_STATIC_OVERLONG, NULL); offset += huff_vlc[i].table_size; + huff_lens += j; + huff_sym += j; } av_assert0(offset == FF_ARRAY_ELEMS(huff_vlc_tables)); |