summaryrefslogtreecommitdiff
path: root/libavcodec/on2avcdata.h
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-10-25 12:48:41 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-12-08 17:51:44 +0100
commit71753c5235d7a3461404847aeaf3df9fae8bacf1 (patch)
treed8ff675b26c0a37618898c98715164bca1a0f367 /libavcodec/on2avcdata.h
parentfefe2cbbf2a50039bc6f212a5d1ab92781662665 (diff)
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/on2avcdata.h')
-rw-r--r--libavcodec/on2avcdata.h6
1 files changed, 2 insertions, 4 deletions
diff --git a/libavcodec/on2avcdata.h b/libavcodec/on2avcdata.h
index 2395b80e68..dee8c3e102 100644
--- a/libavcodec/on2avcdata.h
+++ b/libavcodec/on2avcdata.h
@@ -38,13 +38,11 @@ extern const On2AVCMode ff_on2avc_modes_40[8];
extern const On2AVCMode ff_on2avc_modes_44[8];
#define ON2AVC_SCALE_DIFFS 121
-extern const uint32_t ff_on2avc_scale_diff_codes[];
-extern const uint8_t ff_on2avc_scale_diff_bits[];
+extern const uint8_t ff_on2avc_scale_diff_syms[];
+extern const uint8_t ff_on2avc_scale_diff_bits[];
-extern const void * const ff_on2avc_cb_codes[];
extern const uint8_t * const ff_on2avc_cb_bits[];
extern const uint16_t * const ff_on2avc_cb_syms[];
-extern const uint8_t ff_on2avc_cb_codes_sizes[];
extern const int ff_on2avc_cb_elems[];
extern const float ff_on2avc_window_long_32000[1024];