diff options
author | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-10-29 20:13:56 +0100 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-12-08 17:51:45 +0100 |
commit | 354ba64f40d3d6a185765a22497eefe71aeaba99 (patch) | |
tree | 4afdd7f390a63c09d74e19b7f2ac739003692f42 /libavcodec/mpc7.c | |
parent | 949367b0ec660d2496a62f7acc359bac651bdc02 (diff) | |
download | ffmpeg-354ba64f40d3d6a185765a22497eefe71aeaba99.tar.gz |
avcodec/mpc7: Reduce size of tables used to initialize VLCs
By switching to ff_init_vlc_from_lengths() one can replace tables of
codes of type uint16_t with tables of symbols of type uint8_t, saving
space.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavcodec/mpc7.c')
-rw-r--r-- | libavcodec/mpc7.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/libavcodec/mpc7.c b/libavcodec/mpc7.c index e4aa8586d4..6e800fdccf 100644 --- a/libavcodec/mpc7.c +++ b/libavcodec/mpc7.c @@ -54,7 +54,7 @@ static av_cold int mpc7_decode_init(AVCodecContext * avctx) static VLC_TYPE quant_tables[7224][2]; VLC_TYPE (*quant_table)[2] = quant_tables; - const uint16_t *raw_quant_table = mpc7_quant_vlcs; + const uint8_t *raw_quant_table = mpc7_quant_vlcs; /* Musepack SV7 is always stereo */ if (avctx->channels != 2) { @@ -92,23 +92,24 @@ static av_cold int mpc7_decode_init(AVCodecContext * avctx) if(vlc_initialized) return 0; av_log(avctx, AV_LOG_DEBUG, "Initing VLC\n"); - INIT_VLC_STATIC(&scfi_vlc, MPC7_SCFI_BITS, MPC7_SCFI_SIZE, - &mpc7_scfi[1], 2, 1, - &mpc7_scfi[0], 2, 1, 1 << MPC7_SCFI_BITS); - INIT_VLC_STATIC(&dscf_vlc, MPC7_DSCF_BITS, MPC7_DSCF_SIZE, - &mpc7_dscf[1], 2, 1, - &mpc7_dscf[0], 2, 1, 1 << MPC7_DSCF_BITS); - INIT_VLC_STATIC(&hdr_vlc, MPC7_HDR_BITS, MPC7_HDR_SIZE, - &mpc7_hdr[1], 2, 1, - &mpc7_hdr[0], 2, 1, 1 << MPC7_HDR_BITS); + INIT_VLC_STATIC_FROM_LENGTHS(&scfi_vlc, MPC7_SCFI_BITS, MPC7_SCFI_SIZE, + &mpc7_scfi[1], 2, + &mpc7_scfi[0], 2, 1, 0, 0, 1 << MPC7_SCFI_BITS); + INIT_VLC_STATIC_FROM_LENGTHS(&dscf_vlc, MPC7_DSCF_BITS, MPC7_DSCF_SIZE, + &mpc7_dscf[1], 2, + &mpc7_dscf[0], 2, 1, 0, 0, 1 << MPC7_DSCF_BITS); + INIT_VLC_STATIC_FROM_LENGTHS(&hdr_vlc, MPC7_HDR_BITS, MPC7_HDR_SIZE, + &mpc7_hdr[1], 2, + &mpc7_hdr[0], 2, 1, 0, 0, 1 << MPC7_HDR_BITS); for(i = 0; i < MPC7_QUANT_VLC_TABLES; i++){ for(j = 0; j < 2; j++){ quant_vlc[i][j].table = quant_table; quant_vlc[i][j].table_allocated = quant_sizes[i * 2 + j]; quant_table += quant_sizes[i * 2 + j]; - init_vlc(&quant_vlc[i][j], 9, mpc7_quant_vlc_sizes[i], - raw_quant_table + 1, 4, 2, - raw_quant_table, 4, 2, INIT_VLC_USE_NEW_STATIC); + ff_init_vlc_from_lengths(&quant_vlc[i][j], 9, mpc7_quant_vlc_sizes[i], + &raw_quant_table[1], 2, + &raw_quant_table[0], 2, 1, + 0, INIT_VLC_USE_NEW_STATIC, NULL); raw_quant_table += 2 * mpc7_quant_vlc_sizes[i]; } } |