diff options
author | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-10-25 12:48:41 +0100 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-12-08 17:51:44 +0100 |
commit | 71753c5235d7a3461404847aeaf3df9fae8bacf1 (patch) | |
tree | d8ff675b26c0a37618898c98715164bca1a0f367 /libavcodec/g722enc.c | |
parent | fefe2cbbf2a50039bc6f212a5d1ab92781662665 (diff) | |
download | ffmpeg-71753c5235d7a3461404847aeaf3df9fae8bacf1.tar.gz |
avcodec/on2avc: Use smaller tables for VLCs
The On2 audio decoder uses huge tables to initialize VLC tables. These
tables (mostly) use symbols tables in addition to the codes tables and
the lengths tables. This commit makes the codes tables redundant and
removes them: If all tables are permuted so that the codes are ordered
from left to right in the Huffman tree, the codes become redundant and
can be easily calculated at runtime from the lengths
(via ff_init_vlc_from_lengths()); this also avoids sorting the codes in
ff_init_vlc_sparse()*.
The symbols tables are always 16bit, the codes tables are 32bit, 16bit
or (rarely) 8bit, the lengths tables are always 8bit. Even though some
symbols tables have been used twice (which is no longer possible now
because different permutations need to be performed on the code tables
sharing the same symbol table in order to order them from left to right),
this nevertheless saves about 28KB.
*: If the initializations of the VLCs are repeated 2048 times
(interleaved with calls to free the VLCs which have not been timed), the
number of decicycles spent on each round of initializations improves
from 27669656 to 7356159.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavcodec/g722enc.c')
0 files changed, 0 insertions, 0 deletions