forge
Explore
Log in

Don't you dare go Hollow

edith_codecs

Clone
★ 0

0 watching0 forksRust370.3 MiB9b67700Tahinli3 days ago4021 commits

ps_huff.rs91 lines, 4.6 KiBHistoryRawDownload
1//! Parametric Stereo Huffman code-length tables (ISO/IEC 14496-3 subpart 8).
2//!
3//! Generated by `scripts/aac-tables/gen-ps-huff.py` from the `aacps_huff_tabs`
4//! array of FFmpeg's `libavcodec/aacpsdata.c`: one `(symbol, code length)` pair
5//! per codeword, in table order. Codes are canonical: within each length they
6//! are assigned in table order (see `ps_data::build_codes`). Do not edit by hand.
7
8/// Added to a decoded symbol to give the parameter value, per table.
9pub const OFFSETS: [i32; 10] = [-30, -30, -14, -14, -7, -7, 0, 0, 0, 0];
10/// `IID_DF1`: 61 codewords.
11pub const T_IID_DF1: [(u8, u8); 61] = [
12 (28, 4), (32, 4), (29, 3), (31, 3), (27, 5), (33, 5),
13 (26, 6), (34, 6), (25, 7), (35, 7), (24, 8), (36, 8),
14 (37, 9), (40, 11), (19, 12), (41, 12), (22, 10), (38, 10),
15 (9, 17), (51, 17), (11, 17), (49, 17), (13, 16), (47, 16),
16 (16, 14), (18, 13), (42, 13), (44, 14), (12, 17), (48, 17),
17 (4, 18), (5, 18), (2, 18), (3, 18), (15, 15), (21, 11),
18 (39, 11), (45, 15), (8, 18), (52, 18), (6, 18), (7, 18),
19 (55, 18), (56, 18), (53, 18), (54, 18), (17, 14), (43, 14),
20 (59, 18), (60, 18), (57, 18), (58, 18), (0, 18), (1, 18),
21 (10, 18), (50, 18), (14, 16), (46, 16), (20, 12), (23, 10),
22 (30, 1),
23];
24/// `IID_DT1`: 61 codewords.
25pub const T_IID_DT1: [(u8, u8); 61] = [
26 (31, 2), (26, 7), (34, 7), (27, 6), (33, 6), (35, 8),
27 (24, 9), (36, 9), (39, 11), (41, 12), (9, 15), (10, 15),
28 (48, 15), (49, 15), (17, 13), (23, 10), (37, 10), (43, 13),
29 (11, 15), (12, 15), (4, 16), (56, 16), (2, 16), (3, 16),
30 (59, 16), (60, 16), (57, 16), (58, 16), (0, 16), (1, 16),
31 (5, 16), (55, 16), (6, 16), (54, 16), (13, 15), (15, 14),
32 (20, 12), (40, 12), (22, 11), (38, 11), (45, 14), (47, 15),
33 (7, 16), (53, 16), (18, 13), (42, 13), (16, 14), (44, 14),
34 (8, 16), (52, 16), (14, 15), (46, 15), (50, 16), (51, 16),
35 (19, 13), (21, 12), (25, 9), (28, 5), (32, 5), (29, 3),
36 (30, 1),
37];
38/// `IID_DF0`: 29 codewords.
39pub const T_IID_DF0: [(u8, u8); 29] = [
40 (14, 1), (15, 3), (13, 3), (16, 4), (12, 4), (17, 5),
41 (11, 5), (10, 6), (18, 6), (19, 6), (9, 7), (20, 8),
42 (8, 9), (7, 10), (21, 11), (22, 13), (6, 13), (23, 14),
43 (24, 14), (5, 15), (25, 15), (4, 16), (3, 17), (0, 17),
44 (1, 17), (2, 17), (26, 17), (27, 18), (28, 18),
45];
46/// `IID_DT0`: 29 codewords.
47pub const T_IID_DT0: [(u8, u8); 29] = [
48 (14, 1), (13, 2), (15, 3), (12, 4), (16, 5), (11, 6),
49 (17, 7), (10, 8), (18, 9), (9, 10), (19, 11), (8, 12),
50 (20, 13), (21, 14), (7, 15), (22, 17), (6, 17), (23, 19),
51 (0, 19), (1, 19), (2, 19), (3, 20), (4, 20), (5, 20),
52 (24, 20), (25, 20), (26, 20), (27, 20), (28, 20),
53];
54/// `ICC_DF`: 15 codewords.
55pub const T_ICC_DF: [(u8, u8); 15] = [
56 (7, 1), (8, 2), (6, 3), (9, 4), (5, 5), (10, 6),
57 (4, 7), (11, 8), (12, 9), (3, 10), (13, 11), (2, 12),
58 (14, 13), (1, 14), (0, 14),
59];
60/// `ICC_DT`: 15 codewords.
61pub const T_ICC_DT: [(u8, u8); 15] = [
62 (7, 1), (8, 2), (6, 3), (9, 4), (5, 5), (10, 6),
63 (4, 7), (11, 8), (3, 9), (12, 10), (2, 11), (13, 12),
64 (1, 13), (0, 14), (14, 14),
65];
66/// `IPD_DF`: 8 codewords.
67pub const T_IPD_DF: [(u8, u8); 8] = [
68 (1, 3), (4, 4), (5, 4), (3, 4), (6, 4), (2, 4),
69 (7, 4), (0, 1),
70];
71/// `IPD_DT`: 8 codewords.
72pub const T_IPD_DT: [(u8, u8); 8] = [
73 (5, 4), (4, 5), (3, 5), (2, 4), (6, 4), (1, 3),
74 (7, 3), (0, 1),
75];
76/// `OPD_DF`: 8 codewords.
77pub const T_OPD_DF: [(u8, u8); 8] = [
78 (7, 3), (1, 3), (3, 4), (6, 4), (2, 4), (5, 5),
79 (4, 5), (0, 1),
80];
81/// `OPD_DT`: 8 codewords.
82pub const T_OPD_DT: [(u8, u8); 8] = [
83 (5, 4), (2, 4), (6, 4), (4, 5), (3, 5), (1, 3),
84 (7, 3), (0, 1),
85];
86/// The ten tables indexed by the `T_*` order above.
87pub const TABLES: [&[(u8, u8)]; 10] = [&T_IID_DF1, &T_IID_DT1, &T_IID_DF0, &T_IID_DT0, &T_ICC_DF, &T_ICC_DT, &T_IPD_DF, &T_IPD_DT, &T_OPD_DF, &T_OPD_DT];
88/// Table 8.48: sub-subband `k` (0..71) to the 20-band parameter index.
89pub const K_TO_I_20: [u8; 71] = [1, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 14, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19];
90/// Table 8.49: sub-subband `k` (0..91) to the 34-band parameter index.
91pub const K_TO_I_34: [u8; 91] = [0, 1, 2, 3, 4, 5, 6, 6, 7, 2, 1, 0, 10, 10, 4, 5, 6, 7, 8, 9, 10, 11, 12, 9, 14, 11, 12, 13, 14, 15, 16, 13, 16, 17, 18, 19, 20, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 27, 28, 28, 28, 29, 29, 29, 30, 30, 30, 31, 31, 31, 31, 32, 32, 32, 32, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33];