Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-11-02 01:19:18 +0300
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-12-08 19:51:46 +0300
commit58fc810d42fde26ed6c1f2996122e98ab7005849 (patch)
treedde8b38c8528eef903cd46993cbddca4e69cca55 /libavcodec/atrac3plus_data.h
parenta7dbeb77c3c30ac4904928978938b209ff6e1ab1 (diff)
avcodec/atrac3plus: Run-length encode length tables to make them smaller
This is very beneficial for the scale factor tables where 4*64+4*15 bytes of length information can be replaced by eight codebooks of 12 bytes each; furthermore the number of codes as well as the maximum length of a code can be easily derived from said codebooks, making tables containing said information superfluous. This and combining the symbols into one big array also made an array of pointers to the tables redundant. For the wordlen and code table tables the benefits are not that big (given these tables don't contain that many elements), but all in all using codebooks is also advantageouos for them. Therefore it has been done. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavcodec/atrac3plus_data.h')
-rw-r--r--libavcodec/atrac3plus_data.h157
1 files changed, 67 insertions, 90 deletions
diff --git a/libavcodec/atrac3plus_data.h b/libavcodec/atrac3plus_data.h
index 6b9109cb70..7039936ba3 100644
--- a/libavcodec/atrac3plus_data.h
+++ b/libavcodec/atrac3plus_data.h
@@ -27,106 +27,83 @@
#include <stdint.h>
/** VLC tables for wordlen */
-static const uint8_t atrac3p_wl_huff1[3][2] = {
- { 0, 1 }, { 1, 2 }, { 7, 2 },
+static const uint8_t atrac3p_wl_cbs[][12] = {
+ { 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 1, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 1, 0, 2, 3, 2, 0, 0, 0, 0, 0, 0, 0 },
+ { 1, 0, 2, 3, 2, 0, 0, 0, 0, 0, 0, 0 },
};
-static const uint8_t atrac3p_wl_huff2[5][2] = {
- { 0, 1 }, { 1, 3 }, { 2, 3 }, { 6, 3 }, { 7, 3 },
-};
-
-static const uint8_t atrac3p_wl_huff3[8][2] = {
- { 0, 1 }, { 1, 3 }, { 7, 3 }, { 2, 4 }, { 5, 4 }, { 6, 4 }, { 3, 5 },
- { 4, 5 },
+/** VLC tables for code table indexes */
+static const uint8_t atrac3p_ct_cbs[][12] = {
+ { 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 1, 5, 2, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 1, 5, 2, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 1, 0, 1, 6, 0, 0, 0, 0, 0, 0, 0, 0 },
};
-
-static const uint8_t atrac3p_wl_huff4[8][2] = {
- { 0, 1 }, { 1, 3 }, { 7, 3 }, { 2, 4 }, { 3, 4 }, { 6, 4 }, { 4, 5 },
- { 5, 5 },
+/* Symbols for wordlen interleaved with symbols for code table */
+static const uint8_t atrac3p_wl_ct_xlats[] = {
+ /* wordlen table 1 - 3 entries */
+ 0, 1, 7,
+ /* code table 1 - 4 entries */
+ 0, 1, 2, 3,
+ /* wordlen table 2 - 5 entries */
+ 0, 1, 2, 6, 7,
+ /* code table 2 - 8 entries */
+ 0, 1, 2, 3, 4, 5, 6, 7,
+ /* wordlen table 3 - 8 entries */
+ 0, 1, 7, 2, 5, 6, 3, 4,
+ /* code table 3 - 8 entries */
+ 0, 1, 2, 3, 6, 7, 4, 5,
+ /* wordlen table 4 - 8 entries */
+ 0, 1, 7, 2, 3, 6, 4, 5,
+ /* code table 4 - 8 entries */
+ 0, 1, 2, 3, 4, 5, 6, 7,
};
/** VLC tables for scale factor indexes */
-static const uint8_t atrac3p_sf_huff1[64][2] = {
- { 0, 2 }, { 1, 3 }, { 61, 3 }, { 62, 3 }, { 63, 3 }, { 2, 4 },
- { 60, 4 }, { 3, 8 }, { 4, 8 }, { 5, 8 }, { 6, 8 }, { 57, 8 },
- { 58, 8 }, { 59, 8 }, { 7, 9 }, { 8, 9 }, { 9, 9 }, { 10, 9 },
- { 11, 9 }, { 12, 9 }, { 13, 9 }, { 14, 9 }, { 15, 9 }, { 16, 9 },
- { 17, 9 }, { 18, 9 }, { 19, 9 }, { 20, 9 }, { 21, 9 }, { 22, 9 },
- { 23, 9 }, { 24, 9 }, { 25, 9 }, { 26, 9 }, { 27, 9 }, { 28, 9 },
- { 29, 9 }, { 30, 9 }, { 31, 9 }, { 32, 9 }, { 33, 9 }, { 34, 9 },
- { 35, 9 }, { 36, 9 }, { 37, 9 }, { 38, 9 }, { 39, 9 }, { 40, 9 },
- { 41, 9 }, { 42, 9 }, { 43, 9 }, { 44, 9 }, { 45, 9 }, { 46, 9 },
- { 47, 9 }, { 48, 9 }, { 49, 9 }, { 50, 9 }, { 51, 9 }, { 52, 9 },
- { 53, 9 }, { 54, 9 }, { 55, 9 }, { 56, 9 },
-};
-
-static const uint8_t atrac3p_sf_huff2[64][2] = {
- { 0, 2 }, { 1, 3 }, { 2, 3 }, { 62, 3 }, { 63, 3 }, { 3, 4 },
- { 61, 4 }, { 4, 8 }, { 5, 8 }, { 6, 8 }, { 57, 8 }, { 58, 8 },
- { 59, 8 }, { 60, 8 }, { 7, 9 }, { 8, 9 }, { 9, 9 }, { 10, 9 },
- { 11, 9 }, { 12, 9 }, { 13, 9 }, { 14, 9 }, { 15, 9 }, { 16, 9 },
- { 17, 9 }, { 18, 9 }, { 19, 9 }, { 20, 9 }, { 21, 9 }, { 22, 9 },
- { 23, 9 }, { 24, 9 }, { 25, 9 }, { 26, 9 }, { 27, 9 }, { 28, 9 },
- { 29, 9 }, { 30, 9 }, { 31, 9 }, { 32, 9 }, { 33, 9 }, { 34, 9 },
- { 35, 9 }, { 36, 9 }, { 37, 9 }, { 38, 9 }, { 39, 9 }, { 40, 9 },
- { 41, 9 }, { 42, 9 }, { 43, 9 }, { 44, 9 }, { 45, 9 }, { 46, 9 },
- { 47, 9 }, { 48, 9 }, { 49, 9 }, { 50, 9 }, { 51, 9 }, { 52, 9 },
- { 53, 9 }, { 54, 9 }, { 55, 9 }, { 56, 9 },
-};
-
-static const uint8_t atrac3p_sf_huff3[64][2] = {
- { 0, 1 }, { 1, 3 }, { 63, 3 }, { 2, 5 }, { 3, 5 }, { 61, 5 },
- { 62, 5 }, { 4, 7 }, { 60, 7 }, { 59, 8 }, { 5, 9 }, { 6, 9 },
- { 7, 9 }, { 8, 9 }, { 9, 9 }, { 10, 9 }, { 11, 9 }, { 12, 9 },
- { 13, 9 }, { 14, 9 }, { 15, 9 }, { 16, 9 }, { 17, 9 }, { 18, 9 },
- { 19, 9 }, { 20, 9 }, { 21, 9 }, { 22, 9 }, { 23, 9 }, { 24, 9 },
- { 25, 9 }, { 26, 9 }, { 27, 9 }, { 28, 9 }, { 29, 9 }, { 30, 9 },
- { 31, 9 }, { 32, 9 }, { 33, 9 }, { 34, 9 }, { 35, 9 }, { 36, 9 },
- { 37, 9 }, { 38, 9 }, { 39, 9 }, { 40, 9 }, { 41, 9 }, { 42, 9 },
- { 43, 9 }, { 44, 9 }, { 45, 9 }, { 46, 9 }, { 47, 9 }, { 48, 9 },
- { 49, 9 }, { 50, 9 }, { 51, 9 }, { 52, 9 }, { 53, 9 }, { 54, 9 },
- { 55, 9 }, { 56, 9 }, { 57, 9 }, { 58, 9 },
-};
-
-static const uint8_t atrac3p_sf_huff4[64][2] = {
- { 0, 2 }, { 1, 3 }, { 2, 3 }, { 62, 3 }, { 63, 3 }, { 3, 5 },
- { 4, 5 }, { 60, 5 }, { 61, 5 }, { 5, 7 }, { 58, 7 }, { 59, 7 },
- { 6, 9 }, { 7, 9 }, { 8, 9 }, { 9, 9 }, { 10, 9 }, { 11, 9 },
- { 12, 9 }, { 13, 9 }, { 14, 9 }, { 15, 9 }, { 16, 9 }, { 17, 9 },
- { 18, 9 }, { 19, 9 }, { 20, 9 }, { 21, 9 }, { 22, 9 }, { 23, 9 },
- { 24, 9 }, { 25, 9 }, { 26, 9 }, { 27, 9 }, { 28, 9 }, { 29, 9 },
- { 30, 9 }, { 31, 9 }, { 32, 9 }, { 33, 9 }, { 34, 9 }, { 35, 9 },
- { 36, 9 }, { 37, 9 }, { 38, 9 }, { 39, 9 }, { 40, 9 }, { 41, 9 },
- { 42, 9 }, { 43, 9 }, { 44, 9 }, { 45, 9 }, { 46, 9 }, { 47, 9 },
- { 48, 9 }, { 49, 9 }, { 50, 9 }, { 51, 9 }, { 52, 9 }, { 53, 9 },
- { 54, 9 }, { 55, 9 }, { 56, 9 }, { 57, 9 },
-};
-
-static const uint8_t atrac3p_sf_huff5[15][2] = {
- { 0, 2 }, { 1, 3 }, { 13, 3 }, { 14, 3 }, { 15, 3 }, { 2, 4 },
- { 12, 4 }, { 3, 6 }, { 4, 6 }, { 5, 6 }, { 6, 6 }, { 7, 6 },
- { 9, 6 }, { 10, 6 }, { 11, 6 },
+static const uint8_t atrac3p_sf_cbs[][12] = {
+ { 0, 1, 4, 2, 0, 0, 0, 7, 50, 0, 0, 0 },
+ { 0, 1, 4, 2, 0, 0, 0, 7, 50, 0, 0, 0 },
+ { 1, 0, 2, 0, 4, 0, 2, 1, 54, 0, 0, 0 },
+ { 0, 1, 4, 0, 4, 0, 3, 0, 52, 0, 0, 0 },
+ { 0, 1, 4, 2, 0, 8, 0, 0, 0, 0, 0, 0 },
+ { 0, 1, 4, 2, 0, 8, 0, 0, 0, 0, 0, 0 },
+ { 1, 0, 2, 2, 2, 0, 8, 0, 0, 0, 0, 0 },
+ { 0, 1, 4, 2, 2, 2, 4, 0, 0, 0, 0, 0 },
};
-static const uint8_t atrac3p_sf_huff6[15][2] = {
- { 0, 2 }, { 1, 3 }, { 2, 3 }, { 14, 3 }, { 15, 3 }, { 3, 4 },
- { 13, 4 }, { 4, 6 }, { 5, 6 }, { 6, 6 }, { 7, 6 }, { 9, 6 },
- { 10, 6 }, { 11, 6 }, { 12, 6 },
+static const uint8_t atrac3p_sf_xlats[] = {
+ /* Scale factor index 1 - 64 entries */
+ 0, 1, 61, 62, 63, 2, 60, 3, 4, 5, 6, 57, 58, 59, 7, 8,
+ 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
+ 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
+ 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
+ /* Scale factor index 2 - 64 entries */
+ 0, 1, 2, 62, 63, 3, 61, 4, 5, 6, 57, 58, 59, 60, 7, 8,
+ 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
+ 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
+ 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
+ /* Scale factor index 3 - 64 entries */
+ 0, 1, 63, 2, 3, 61, 62, 4, 60, 59, 5, 6, 7, 8, 9, 10,
+ 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
+ 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42,
+ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
+ /* Scale factor index 4 - 64 entries */
+ 0, 1, 2, 62, 63, 3, 4, 60, 61, 5, 58, 59, 6, 7, 8, 9,
+ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
+ 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
+ 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
+ /* Scale factor index 5 - 15 entries */
+ 0, 1, 13, 14, 15, 2, 12, 3, 4, 5, 6, 7, 9, 10, 11,
+ /* Scale factor index 6 - 15 entries */
+ 0, 1, 2, 14, 15, 3, 13, 4, 5, 6, 7, 9, 10, 11, 12,
+ /* Scale factor index 7 - 15 entries */
+ 0, 1, 15, 2, 14, 3, 13, 4, 5, 6, 7, 9, 10, 11, 12,
+ /* Scale factor index 8 - 15 entries */
+ 0, 1, 2, 14, 15, 3, 13, 4, 12, 5, 11, 6, 7, 9, 10,
};
-static const uint8_t atrac3p_sf_huff7[15][2] = {
- { 0, 1 }, { 1, 3 }, { 15, 3 }, { 2, 4 }, { 14, 4 }, { 3, 5 },
- { 13, 5 }, { 4, 7 }, { 5, 7 }, { 6, 7 }, { 7, 7 }, { 9, 7 },
- { 10, 7 }, { 11, 7 }, { 12, 7 },
-};
-
-static const uint8_t atrac3p_sf_huff8[15][2] = {
- { 0, 2 }, { 1, 3 }, { 2, 3 }, { 14, 3 }, { 15, 3 }, { 3, 4 },
- { 13, 4 }, { 4, 5 }, { 12, 5 }, { 5, 6 }, { 11, 6 }, { 6, 7 },
- { 7, 7 }, { 9, 7 }, { 10, 7 },
-};
-
-/** VLC tables for code table indexes */
static const uint8_t atrac3p_ct_huff1[4][2] = {
{ 0, 1 }, { 1, 2 }, { 2, 3 }, { 3, 3 },
};