summaryrefslogtreecommitdiff
path: root/libavcodec/tscc2.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-10-29 16:13:03 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-12-08 17:51:44 +0100
commitd2e55e3aa1a1c204dc93c09018779265ac017971 (patch)
treeaa2f127aaa292f867f9d807429bea2a27bed360e /libavcodec/tscc2.c
parentf55da066ec82da220b729bd7bc5a9a836baeb68d (diff)
downloadffmpeg-d2e55e3aa1a1c204dc93c09018779265ac017971.tar.gz
avcodec/tscc2: Reduce the size of the tables used to initialize VLCs
After permuting both the codes, lengths and symbols tables so that the codes tables are ordered from left to right in the tree, the codes tables can be easily computed from the lengths tables at runtime and therefore omitted. This saves about 2KB from the binary. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavcodec/tscc2.c')
-rw-r--r--libavcodec/tscc2.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/libavcodec/tscc2.c b/libavcodec/tscc2.c
index 630e17522c..c4d275bb23 100644
--- a/libavcodec/tscc2.c
+++ b/libavcodec/tscc2.c
@@ -62,24 +62,24 @@ static av_cold int init_vlcs(TSCC2Context *c)
{
int i, ret;
- ret = ff_init_vlc_sparse(&c->dc_vlc, 9, DC_VLC_COUNT,
- tscc2_dc_vlc_bits, 1, 1,
- tscc2_dc_vlc_codes, 2, 2,
- tscc2_dc_vlc_syms, 2, 2, INIT_VLC_LE);
+ ret = ff_init_vlc_from_lengths(&c->dc_vlc, 9, DC_VLC_COUNT,
+ tscc2_dc_vlc_lens, 1,
+ tscc2_dc_vlc_syms, 2, 2,
+ 0, INIT_VLC_OUTPUT_LE, c->avctx);
if (ret)
return ret;
for (i = 0; i < NUM_VLC_SETS; i++) {
- ret = ff_init_vlc_sparse(c->nc_vlc + i, 9, 16,
- tscc2_nc_vlc_bits[i], 1, 1,
- tscc2_nc_vlc_codes[i], 2, 2,
- tscc2_nc_vlc_syms, 1, 1, INIT_VLC_LE);
+ ret = ff_init_vlc_from_lengths(c->nc_vlc + i, 9, 16,
+ tscc2_nc_vlc_lens[i], 1,
+ tscc2_nc_vlc_syms[i], 1, 1,
+ 0, INIT_VLC_OUTPUT_LE, c->avctx);
if (ret)
return ret;
- ret = ff_init_vlc_sparse(c->ac_vlc + i, 9, tscc2_ac_vlc_sizes[i],
- tscc2_ac_vlc_bits[i], 1, 1,
- tscc2_ac_vlc_codes[i], 2, 2,
- tscc2_ac_vlc_syms[i], 2, 2, INIT_VLC_LE);
+ ret = ff_init_vlc_from_lengths(c->ac_vlc + i, 9, tscc2_ac_vlc_sizes[i],
+ tscc2_ac_vlc_bits[i], 1,
+ tscc2_ac_vlc_syms[i], 2, 2,
+ 0, INIT_VLC_OUTPUT_LE, c->avctx);
if (ret)
return ret;
}