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-10-27 17:21:27 +0300
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-12-08 19:51:45 +0300
commit3ff0179b196106b97f8b53b3e4685837e57196cb (patch)
tree3d50aad777329581644317398ee94e52d04fef8f /libavcodec/cookdata.h
parent3f4cfc48dd8eabd8f78a2bcb5ed121bc936fd4cc (diff)
avcodec/cook: Avoid big length tables for VLC initialization
Permuting the tables used to initialize the Cook VLCs so that the code tables are ordered from left to right in the tree revealed that the length of the codes are ascending from left to right. Therefore one can run-length encode them to avoid the big length tables; this saves a bit more than 1KB. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavcodec/cookdata.h')
-rw-r--r--libavcodec/cookdata.h187
1 files changed, 29 insertions, 158 deletions
diff --git a/libavcodec/cookdata.h b/libavcodec/cookdata.h
index 05d1eef23b..a4ca1201bf 100644
--- a/libavcodec/cookdata.h
+++ b/libavcodec/cookdata.h
@@ -70,41 +70,26 @@ static const int vpr_tab[7] = {
/* VLC data */
-static const int vhsize_tab[7] = {
- 181, 94, 48, 520, 209, 192, 32,
-};
+#define MAX_COOK_VLC_ENTRIES 520
static const int vhvlcsize_tab[7] = {
8, 7, 7, 10, 9, 9, 6,
};
-static const uint8_t envelope_quant_index_huffbits[13][24] = {
- { 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5,
- 5, 5, 6, 7, 8, 9, 11, 11, 12, 12, 12, 12 },
- { 3, 3, 3, 3, 3, 3, 4, 4, 5, 5, 5, 6,
- 7, 8, 9, 10, 11, 12, 13, 15, 15, 15, 16, 16 },
- { 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5,
- 5, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 14 },
- { 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5,
- 7, 7, 7, 9, 9, 9, 10, 11, 13, 13, 13, 13 },
- { 3, 3, 3, 3, 3, 4, 4, 4, 5, 5, 5, 5,
- 6, 6, 6, 7, 8, 9, 10, 11, 12, 13, 14, 14 },
- { 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5,
- 7, 7, 8, 8, 8, 9, 10, 11, 12, 13, 14, 14 },
- { 2, 3, 3, 3, 3, 4, 4, 5, 5, 5, 6, 7,
- 8, 9, 10, 11, 12, 13, 15, 15, 16, 16, 16, 16 },
- { 2, 3, 3, 3, 3, 4, 4, 5, 5, 5, 7, 7,
- 7, 9, 9, 9, 10, 11, 12, 14, 14, 14, 15, 15 },
- { 3, 3, 3, 3, 3, 3, 4, 4, 5, 5, 6, 6,
- 7, 7, 8, 8, 9, 9, 9, 10, 11, 12, 13, 13 },
- { 3, 3, 3, 3, 3, 3, 4, 4, 5, 5, 6, 6,
- 6, 8, 8, 8, 9, 10, 11, 12, 14, 14, 14, 14 },
- { 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 6, 6,
- 6, 8, 8, 9, 9, 9, 10, 11, 12, 13, 14, 14 },
- { 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 6,
- 7, 8, 9, 10, 11, 12, 13, 14, 16, 16, 16, 16 },
- { 2, 3, 3, 3, 3, 4, 4, 5, 5, 5, 7, 7,
- 7, 8, 9, 10, 11, 13, 14, 14, 14, 14, 14, 14 },
+static const uint8_t envelope_quant_index_huffcounts[13][16] = {
+ { 0, 0, 3, 8, 3, 1, 1, 1, 1, 0, 2, 4, 0, 0, 0, 0 },
+ { 0, 0, 6, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 0, 3, 2 },
+ { 0, 0, 3, 8, 3, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 0 },
+ { 0, 0, 5, 4, 3, 0, 3, 0, 3, 1, 1, 0, 4, 0, 0, 0 },
+ { 0, 0, 5, 3, 4, 3, 1, 1, 1, 1, 1, 1, 1, 2, 0, 0 },
+ { 0, 0, 5, 4, 3, 0, 2, 3, 1, 1, 1, 1, 1, 2, 0, 0 },
+ { 0, 1, 4, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 0, 2, 4 },
+ { 0, 1, 4, 2, 3, 0, 3, 0, 3, 1, 1, 1, 0, 3, 2, 0 },
+ { 0, 0, 6, 2, 2, 2, 2, 2, 3, 1, 1, 1, 2, 0, 0, 0 },
+ { 0, 0, 6, 2, 2, 3, 0, 3, 1, 1, 1, 1, 0, 4, 0, 0 },
+ { 0, 1, 3, 4, 2, 3, 0, 2, 3, 1, 1, 1, 1, 2, 0, 0 },
+ { 0, 1, 3, 4, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 4 },
+ { 0, 1, 4, 2, 3, 0, 3, 1, 1, 1, 1, 0, 1, 6, 0, 0 },
};
static const uint8_t envelope_quant_index_huffsyms[13][24] = {
@@ -137,18 +122,14 @@ static const uint8_t envelope_quant_index_huffsyms[13][24] = {
};
-static const uint8_t cvh_huffbits0[181] = {
- 1, 4, 4, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7,
- 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9,
- 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
- 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
- 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12,
- 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14,
- 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16,
- 16,
+static const uint8_t cvh_huffcounts[7][16] = {
+ { 1, 0, 0, 2, 2, 5, 8, 15, 31, 33, 28, 17, 15, 8, 8, 8 },
+ { 1, 0, 0, 2, 4, 5, 7, 16, 18, 12, 11, 7, 3, 5, 1, 2 },
+ { 1, 0, 1, 2, 4, 2, 5, 8, 7, 8, 2, 3, 1, 1, 1, 2 },
+ { 0, 1, 0, 2, 5, 12, 7, 27, 22, 41, 32, 41, 55, 23, 32, 220 },
+ { 0, 1, 0, 5, 7, 4, 8, 9, 17, 10, 13, 17, 12, 14, 92, 0 },
+ { 0, 1, 0, 5, 6, 8, 8, 8, 4, 7, 11, 23, 21, 10, 80, 0 },
+ { 1, 0, 0, 5, 0, 9, 1, 7, 4, 3, 2, 0, 0, 0, 0, 0 },
};
static const uint8_t cvh_huffsyms0[181] = {
@@ -167,16 +148,6 @@ static const uint8_t cvh_huffsyms0[181] = {
190,
};
-static const uint8_t cvh_huffbits1[94] = {
- 1, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7,
- 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9,
- 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10,
- 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11,
- 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 14, 14, 14, 14,
- 14, 15, 16, 16,
-};
-
-
static const uint8_t cvh_huffsyms1[94] = {
0, 1, 10, 2, 11, 20, 21, 3, 12, 22, 30, 31, 4, 13, 14, 23, 32, 40, 41,
5, 6, 15, 16, 24, 25, 33, 34, 42, 43, 50, 51, 52, 60, 61, 62, 7, 17, 18,
@@ -185,50 +156,12 @@ static const uint8_t cvh_huffsyms1[94] = {
39, 58, 67, 75, 76, 85, 93, 49, 68, 94, 59, 77, 78, 86, 95, 69, 87, 96,
};
-static const uint8_t cvh_huffbits2[48] = {
- 1, 3, 4, 4, 5, 5, 5, 5, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8,
- 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10,
- 10, 10, 11, 11, 12, 12, 12, 13, 14, 15, 16, 16,
-};
-
static const uint8_t cvh_huffsyms2[48] = {
0, 7, 1, 8, 2, 9, 14, 15, 16, 22, 3, 10, 17, 21, 23, 4, 11, 18, 24,
28, 29, 30, 35, 5, 12, 25, 31, 36, 37, 42, 6, 13, 19, 20, 26, 32, 38, 43,
39, 44, 27, 33, 45, 46, 34, 40, 41, 47,
};
-static const uint8_t cvh_huffbits3[520] = {
- 2, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8,
- 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
- 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
- 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11,
- 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
- 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-};
-
static const uint16_t cvh_huffsyms3[520] = {
0, 1, 125, 5, 6, 25, 30, 150, 2, 7, 26, 31, 126, 130, 131,
151, 155, 156, 250, 275, 10, 35, 36, 50, 55, 175, 180, 3, 8, 11,
@@ -267,21 +200,6 @@ static const uint16_t cvh_huffsyms3[520] = {
583, 585, 586, 587, 590, 591, 600, 601, 605, 606,
};
-static const uint8_t cvh_huffbits4[209] = {
- 2, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 7,
- 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9,
- 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
- 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
-};
-
static const uint8_t cvh_huffsyms4[209] = {
0, 1, 4, 16, 64, 80, 5, 17, 20, 21, 65, 68, 84, 69, 81,
85, 128, 2, 6, 8, 25, 32, 96, 100, 144, 9, 22, 24, 36, 37,
@@ -299,20 +217,6 @@ static const uint8_t cvh_huffsyms4[209] = {
218, 220, 221, 225, 226, 228, 229, 230, 232, 233, 240, 241, 244, 245,
};
-static const uint8_t cvh_huffbits5[192] = {
- 2, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6,
- 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8,
- 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11,
- 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
-};
-
static const uint8_t cvh_huffsyms5[192] = {
0, 1, 3, 9, 27, 81, 4, 12, 36, 82, 84, 108, 10, 13, 28,
30, 39, 90, 109, 117, 31, 37, 40, 85, 91, 93, 111, 120, 2, 54,
@@ -329,11 +233,6 @@ static const uint8_t cvh_huffsyms5[192] = {
205, 207, 208, 210, 211, 217, 219, 220, 225, 226, 228, 229,
};
-static const uint8_t cvh_huffbits6[32] = {
- 1, 4, 4, 4, 4, 4, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 8, 8,
- 8, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 11, 11,
-};
-
static const uint8_t cvh_huffsyms6[32] = {
0, 1, 2, 4, 8, 16, 3, 5, 6, 9, 10, 12, 17, 20, 24, 18, 7, 11, 14,
19, 22, 26, 28, 13, 21, 25, 30, 15, 27, 29, 23, 31,
@@ -344,12 +243,6 @@ static const void* const cvh_huffsyms[7] = {
cvh_huffsyms4, cvh_huffsyms5, cvh_huffsyms6,
};
-static const uint8_t* const cvh_huffbits[7] = {
- cvh_huffbits0, cvh_huffbits1, cvh_huffbits2, cvh_huffbits3,
- cvh_huffbits4, cvh_huffbits5, cvh_huffbits6,
-};
-
-
static const uint8_t ccpl_huffsyms2[3] = {
1, 0, 2,
};
@@ -374,28 +267,12 @@ static const uint8_t ccpl_huffsyms6[63] = {
2, 60, 61, 1, 0, 62,
};
-static const uint8_t ccpl_huffbits2[3] = {
- 1, 2, 2,
-};
-
-static const uint8_t ccpl_huffbits3[7] = {
- 1, 2, 3, 4, 5, 6, 6,
-};
-
-static const uint8_t ccpl_huffbits4[15] = {
- 1, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 8, 8,
-};
-
-static const uint8_t ccpl_huffbits5[31] = {
- 1, 3, 3, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8,
- 8, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10,
-};
-
-static const uint8_t ccpl_huffbits6[63] = {
- 1, 3, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7,
- 7, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9,
- 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 12,
- 12, 13, 13, 14, 14, 14, 15, 16, 16,
+static const uint8_t ccpl_huffcounts[5][16] = {
+ { 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 1, 1, 1, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 1, 0, 2, 2, 2, 2, 2, 4, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 1, 0, 2, 0, 4, 4, 4, 4, 4, 8, 0, 0, 0, 0, 0, 0 },
+ { 1, 0, 1, 1, 4, 4, 8, 8, 9, 9, 8, 2, 2, 3, 1, 2 },
};
static const uint8_t *const ccpl_huffsyms[5] = {
@@ -403,12 +280,6 @@ static const uint8_t *const ccpl_huffsyms[5] = {
ccpl_huffsyms4, ccpl_huffsyms5, ccpl_huffsyms6
};
-static const uint8_t* const ccpl_huffbits[5] = {
- ccpl_huffbits2,ccpl_huffbits3,
- ccpl_huffbits4,ccpl_huffbits5,ccpl_huffbits6
-};
-
-
//Coupling tables
static const int cplband[51] = {