]> git.nihav.org Git - nihav.git/blame_incremental - nihav-mpeg/src/codecs/mpegaudio/mp3data.rs
nihav_itu: ignore high-profile extradata tail when it is not correct
[nihav.git] / nihav-mpeg / src / codecs / mpegaudio / mp3data.rs
... / ...
CommitLineData
1use nihav_core::io::codebook::*;
2
3pub const MP3_BANDS: usize = 21;
4pub const MP3_BANDS_SHORT: usize = 12;
5
6pub const MP3_PREEMP_SCALES: [i8; MP3_BANDS + 1] = [
7 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 3, 3, 3, 2, 0
8];
9
10pub const MP3_ISTEREO_COEFFS: [f32; 7] = [
11 1.0, 0.78867513459481288226, 0.63397459621556135323, 0.5,
12 0.36602540378443864677, 0.21132486540518711774, 0.0
13];
14
15pub const SCFSI_FROM_BAND: [usize; MP3_BANDS] = [
16 0, 0, 0, 0, 0, 0,
17 1, 1, 1, 1, 1,
18 2, 2, 2, 2, 2,
19 3, 3, 3, 3, 3
20];
21
22pub const MP3_SCALEFAC_BITS1: [u8; 16] = [ 0, 0, 0, 0, 3, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4 ];
23pub const MP3_SCALEFAC_BITS2: [u8; 16] = [ 0, 1, 2, 3, 0, 1, 2, 3, 1, 2, 3, 1, 2, 3, 2, 3 ];
24
25pub const MP3_SFB_LONG_OFFS: [[usize; MP3_BANDS + 2]; 9] = [
26 [ // 44.1
27 0, 4, 8, 12, 16, 20, 24, 30, 36, 44, 52, 62, 74, 90, 110, 134, 162, 196, 238, 288, 342, 418, 576
28 ], [ // 48
29 0, 4, 8, 12, 16, 20, 24, 30, 36, 42, 50, 60, 72, 88, 106, 128, 156, 190, 230, 276, 330, 384, 576
30 ], [ // 32
31 0, 4, 8, 12, 16, 20, 24, 30, 36, 44, 54, 66, 82, 102, 126, 156, 194, 240, 296, 364, 448, 550, 576
32 ], [ // 22.05
33 0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 116, 140, 168, 200, 238, 284, 336, 396, 464, 522, 576
34 ], [ // 24
35 0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 114, 136, 162, 194, 232, 278, 332, 394, 464, 540, 576
36 ], [ // 16
37 0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 116, 140, 168, 200, 238, 284, 336, 396, 464, 522, 576
38 ], [ // 11.025
39 0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 116, 140, 168, 200, 238, 284, 336, 396, 464, 522, 576
40 ], [ // 12
41 0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 116, 140, 168, 200, 238, 284, 336, 396, 464, 522, 576
42 ], [ // 8
43 0, 12, 24, 36, 48, 60, 72, 88, 108, 132, 160, 192, 232, 280, 336, 400, 476, 566, 568, 570, 572, 574, 576
44 ]
45];
46
47pub const MP3_SFB_SHORT_OFFS: [[usize; MP3_BANDS_SHORT + 2]; 9] = [
48 [ 0, 4, 8, 12, 16, 22, 30, 40, 52, 66, 84, 106, 136, 192 ], // 44.1
49 [ 0, 4, 8, 12, 16, 22, 28, 38, 50, 64, 80, 100, 126, 192 ], // 48
50 [ 0, 4, 8, 12, 16, 22, 30, 42, 58, 78, 104, 138, 180, 192 ], // 32
51 [ 0, 4, 8, 12, 18, 24, 32, 42, 56, 74, 100, 132, 174, 192 ], // 22.05
52 [ 0, 4, 8, 12, 18, 26, 36, 48, 62, 80, 104, 136, 180, 192 ], // 24
53 [ 0, 4, 8, 12, 18, 26, 36, 48, 62, 80, 104, 134, 174, 192 ], // 16
54 [ 0, 4, 8, 12, 18, 26, 36, 48, 62, 80, 104, 134, 174, 192 ], // 11.025
55 [ 0, 4, 8, 12, 18, 26, 36, 48, 62, 80, 104, 134, 174, 192 ], // 12
56 [ 0, 8, 16, 24, 36, 52, 72, 96, 124, 160, 162, 164, 166, 192 ], // 8
57];
58pub const MP3_SFB_SHORT_SIZE: [[usize; MP3_BANDS_SHORT + 1]; 9] = [
59 [ 4, 4, 4, 4, 6, 8, 10, 12, 14, 18, 22, 30, 56 ], // 44.1
60 [ 4, 4, 4, 4, 6, 6, 10, 12, 14, 16, 20, 26, 66 ], // 48
61 [ 4, 4, 4, 4, 6, 8, 12, 16, 20, 26, 34, 42, 12 ], // 32
62 [ 4, 4, 4, 6, 6, 8, 10, 14, 18, 26, 32, 42, 18 ], // 22.05
63 [ 4, 4, 4, 6, 8, 10, 12, 14, 18, 24, 32, 44, 12 ], // 24
64 [ 4, 4, 4, 6, 8, 10, 12, 14, 18, 24, 30, 40, 18 ], // 16
65 [ 4, 4, 4, 6, 8, 10, 12, 14, 18, 24, 30, 40, 18 ], // 11.025
66 [ 4, 4, 4, 6, 8, 10, 12, 14, 18, 24, 30, 40, 18 ], // 12
67 [ 8, 8, 8, 12, 16, 20, 24, 28, 36, 2, 2, 2, 26 ], // 8
68];
69
70pub const MP3_SCF_BITS3: [u8; 12 * 2] = [
71 0, 0, 0, 1, 0, 2,
72 1, 0, 1, 1, 1, 2,
73 2, 0, 2, 1, 2, 2,
74 3, 0, 3, 1, 3, 2
75];
76pub const MP3_SCF_BITS5: [u8; 25 * 2] = [
77 0, 0, 0, 1, 0, 2, 0, 3, 0, 4,
78 1, 0, 1, 1, 1, 2, 1, 3, 1, 4,
79 2, 0, 2, 1, 2, 2, 2, 3, 2, 4,
80 3, 0, 3, 1, 3, 2, 3, 3, 3, 4,
81 4, 0, 4, 1, 4, 2, 4, 3, 4, 4
82];
83pub const MP3_SCF_BITS6: [u8; 180 * 3] = [
84 0, 0, 0, 0, 0, 1, 0, 0, 2, 0, 0, 3, 0, 0, 4, 0, 0, 5,
85 0, 1, 0, 0, 1, 1, 0, 1, 2, 0, 1, 3, 0, 1, 4, 0, 1, 5,
86 0, 2, 0, 0, 2, 1, 0, 2, 2, 0, 2, 3, 0, 2, 4, 0, 2, 5,
87 0, 3, 0, 0, 3, 1, 0, 3, 2, 0, 3, 3, 0, 3, 4, 0, 3, 5,
88 0, 4, 0, 0, 4, 1, 0, 4, 2, 0, 4, 3, 0, 4, 4, 0, 4, 5,
89 0, 5, 0, 0, 5, 1, 0, 5, 2, 0, 5, 3, 0, 5, 4, 0, 5, 5,
90 1, 0, 0, 1, 0, 1, 1, 0, 2, 1, 0, 3, 1, 0, 4, 1, 0, 5,
91 1, 1, 0, 1, 1, 1, 1, 1, 2, 1, 1, 3, 1, 1, 4, 1, 1, 5,
92 1, 2, 0, 1, 2, 1, 1, 2, 2, 1, 2, 3, 1, 2, 4, 1, 2, 5,
93 1, 3, 0, 1, 3, 1, 1, 3, 2, 1, 3, 3, 1, 3, 4, 1, 3, 5,
94 1, 4, 0, 1, 4, 1, 1, 4, 2, 1, 4, 3, 1, 4, 4, 1, 4, 5,
95 1, 5, 0, 1, 5, 1, 1, 5, 2, 1, 5, 3, 1, 5, 4, 1, 5, 5,
96 2, 0, 0, 2, 0, 1, 2, 0, 2, 2, 0, 3, 2, 0, 4, 2, 0, 5,
97 2, 1, 0, 2, 1, 1, 2, 1, 2, 2, 1, 3, 2, 1, 4, 2, 1, 5,
98 2, 2, 0, 2, 2, 1, 2, 2, 2, 2, 2, 3, 2, 2, 4, 2, 2, 5,
99 2, 3, 0, 2, 3, 1, 2, 3, 2, 2, 3, 3, 2, 3, 4, 2, 3, 5,
100 2, 4, 0, 2, 4, 1, 2, 4, 2, 2, 4, 3, 2, 4, 4, 2, 4, 5,
101 2, 5, 0, 2, 5, 1, 2, 5, 2, 2, 5, 3, 2, 5, 4, 2, 5, 5,
102 3, 0, 0, 3, 0, 1, 3, 0, 2, 3, 0, 3, 3, 0, 4, 3, 0, 5,
103 3, 1, 0, 3, 1, 1, 3, 1, 2, 3, 1, 3, 3, 1, 4, 3, 1, 5,
104 3, 2, 0, 3, 2, 1, 3, 2, 2, 3, 2, 3, 3, 2, 4, 3, 2, 5,
105 3, 3, 0, 3, 3, 1, 3, 3, 2, 3, 3, 3, 3, 3, 4, 3, 3, 5,
106 3, 4, 0, 3, 4, 1, 3, 4, 2, 3, 4, 3, 3, 4, 4, 3, 4, 5,
107 3, 5, 0, 3, 5, 1, 3, 5, 2, 3, 5, 3, 3, 5, 4, 3, 5, 5,
108 4, 0, 0, 4, 0, 1, 4, 0, 2, 4, 0, 3, 4, 0, 4, 4, 0, 5,
109 4, 1, 0, 4, 1, 1, 4, 1, 2, 4, 1, 3, 4, 1, 4, 4, 1, 5,
110 4, 2, 0, 4, 2, 1, 4, 2, 2, 4, 2, 3, 4, 2, 4, 4, 2, 5,
111 4, 3, 0, 4, 3, 1, 4, 3, 2, 4, 3, 3, 4, 3, 4, 4, 3, 5,
112 4, 4, 0, 4, 4, 1, 4, 4, 2, 4, 4, 3, 4, 4, 4, 4, 4, 5,
113 4, 5, 0, 4, 5, 1, 4, 5, 2, 4, 5, 3, 4, 5, 4, 4, 5, 5
114];
115
116pub const MP3_SCF_ENDS: [[[usize; 4]; 3]; 6] = [
117 [ [ 6, 11, 16, 21 ], [ 9, 18, 27, 36 ], [ 6, 15, 27, 33 ] ],
118 [ [ 6, 11, 18, 21 ], [ 9, 18, 30, 36 ], [ 6, 15, 27, 33 ] ],
119 [ [ 11, 21, 21, 21 ], [ 18, 36, 36, 36 ], [ 15, 33, 33, 33 ] ],
120 [ [ 7, 14, 21, 21 ], [ 12, 24, 36, 36 ], [ 6, 21, 33, 33 ] ],
121 [ [ 6, 12, 18, 21 ], [ 12, 21, 30, 36 ], [ 6, 18, 27, 33 ] ],
122 [ [ 8, 16, 21, 21 ], [ 15, 27, 36, 36 ], [ 6, 24, 33, 33 ] ]
123];
124
125const MP3_HUFF_QUAD_A_BITS: [u8; 16] = [ 1, 5, 4, 5, 6, 5, 4, 4, 7, 3, 6, 0, 7, 2, 3, 1 ];
126const MP3_HUFF_QUAD_A_LENS: [u8; 16] = [ 1, 4, 4, 5, 4, 6, 5, 6, 4, 5, 5, 6, 5, 6, 6, 6 ];
127
128const MP3_HUFF1_BITS: [u8; 4] = [ 1, 1, 1, 0 ];
129const MP3_HUFF1_LENS: [u8; 4] = [ 1, 3, 2, 3 ];
130const MP3_HUFF2_BITS: [u8; 9] = [ 1, 2, 1, 3, 1, 1, 3, 2, 0 ];
131const MP3_HUFF2_LENS: [u8; 9] = [ 1, 3, 6, 3, 3, 5, 5, 5, 6 ];
132const MP3_HUFF3_BITS: [u8; 9] = [ 3, 2, 1, 1, 1, 1, 3, 2, 0 ];
133const MP3_HUFF3_LENS: [u8; 9] = [ 2, 2, 6, 3, 2, 5, 5, 5, 6 ];
134const MP3_HUFF5_BITS: [u8; 16] = [ 1, 2, 6, 5, 3, 1, 4, 4, 7, 5, 7, 1, 6, 1, 1, 0 ];
135const MP3_HUFF5_LENS: [u8; 16] = [ 1, 3, 6, 7, 3, 3, 6, 7, 6, 6, 7, 8, 7, 6, 7, 8 ];
136const MP3_HUFF6_BITS: [u8; 16] = [ 7, 3, 5, 1, 6, 2, 3, 2, 5, 4, 4, 1, 3, 3, 2, 0 ];
137const MP3_HUFF6_LENS: [u8; 16] = [ 3, 3, 5, 7, 3, 2, 4, 5, 4, 4, 5, 6, 6, 5, 6, 7 ];
138const MP3_HUFF7_BITS: [u8; 36] = [
139 0x01, 0x02, 0x0A, 0x13, 0x10, 0x0A, 0x03, 0x03,
140 0x07, 0x0A, 0x05, 0x03, 0x0B, 0x04, 0x0D, 0x11,
141 0x08, 0x04, 0x0C, 0x0B, 0x12, 0x0F, 0x0B, 0x02,
142 0x07, 0x06, 0x09, 0x0E, 0x03, 0x01, 0x06, 0x04,
143 0x05, 0x03, 0x02, 0x00
144];
145const MP3_HUFF7_LENS: [u8; 36] = [
146 1, 3, 6, 8, 8, 9, 3, 4, 6, 7, 7, 8, 6, 5, 7, 8,
147 8, 9, 7, 7, 8, 9, 9, 9, 7, 7, 8, 9, 9, 10, 8, 8,
148 9, 10, 10, 10
149];
150const MP3_HUFF8_BITS: [u8; 36] = [
151 0x03, 0x04, 0x06, 0x12, 0x0C, 0x05, 0x05, 0x01,
152 0x02, 0x10, 0x09, 0x03, 0x07, 0x03, 0x05, 0x0E,
153 0x07, 0x03, 0x13, 0x11, 0x0F, 0x0D, 0x0A, 0x04,
154 0x0D, 0x05, 0x08, 0x0B, 0x05, 0x01, 0x0C, 0x04,
155 0x04, 0x01, 0x01, 0x00
156];
157const MP3_HUFF8_LENS: [u8; 36] = [
158 2, 3, 6, 8, 8, 9, 3, 2, 4, 8, 8, 8, 6, 4, 6, 8,
159 8, 9, 8, 8, 8, 9, 9, 10, 8, 7, 8, 9, 10, 10, 9, 8,
160 9, 9, 11, 11
161];
162const MP3_HUFF9_BITS: [u8; 36] = [
163 0x07, 0x05, 0x09, 0x0E, 0x0F, 0x07, 0x06, 0x04,
164 0x05, 0x05, 0x06, 0x07, 0x07, 0x06, 0x08, 0x08,
165 0x08, 0x05, 0x0F, 0x06, 0x09, 0x0A, 0x05, 0x01,
166 0x0B, 0x07, 0x09, 0x06, 0x04, 0x01, 0x0E, 0x04,
167 0x06, 0x02, 0x06, 0x00
168];
169const MP3_HUFF9_LENS: [u8; 36] = [
170 3, 3, 5, 6, 8, 9, 3, 3, 4, 5, 6, 8, 4, 4, 5, 6,
171 7, 8, 6, 5, 6, 7, 7, 8, 7, 6, 7, 7, 8, 9, 8, 7,
172 8, 8, 9, 9
173];
174const MP3_HUFF10_BITS: [u8; 64] = [
175 0x01, 0x02, 0x0A, 0x17, 0x23, 0x1E, 0x0C, 0x11,
176 0x03, 0x03, 0x08, 0x0C, 0x12, 0x15, 0x0C, 0x07,
177 0x0B, 0x09, 0x0F, 0x15, 0x20, 0x28, 0x13, 0x06,
178 0x0E, 0x0D, 0x16, 0x22, 0x2E, 0x17, 0x12, 0x07,
179 0x14, 0x13, 0x21, 0x2F, 0x1B, 0x16, 0x09, 0x03,
180 0x1F, 0x16, 0x29, 0x1A, 0x15, 0x14, 0x05, 0x03,
181 0x0E, 0x0D, 0x0A, 0x0B, 0x10, 0x06, 0x05, 0x01,
182 0x09, 0x08, 0x07, 0x08, 0x04, 0x04, 0x02, 0x00
183];
184const MP3_HUFF10_LENS: [u8; 64] = [
185 1, 3, 6, 8, 9, 9, 9, 10, 3, 4, 6, 7, 8, 9, 8, 8,
186 6, 6, 7, 8, 9, 10, 9, 9, 7, 7, 8, 9, 10, 10, 9, 10,
187 8, 8, 9, 10, 10, 10, 10, 10, 9, 9, 10, 10, 11, 11, 10, 11,
188 8, 8, 9, 10, 10, 10, 11, 11, 9, 8, 9, 10, 10, 11, 11, 11
189];
190const MP3_HUFF11_BITS: [u8; 64] = [
191 0x03, 0x04, 0x0A, 0x18, 0x22, 0x21, 0x15, 0x0F,
192 0x05, 0x03, 0x04, 0x0A, 0x20, 0x11, 0x0B, 0x0A,
193 0x0B, 0x07, 0x0D, 0x12, 0x1E, 0x1F, 0x14, 0x05,
194 0x19, 0x0B, 0x13, 0x3B, 0x1B, 0x12, 0x0C, 0x05,
195 0x23, 0x21, 0x1F, 0x3A, 0x1E, 0x10, 0x07, 0x05,
196 0x1C, 0x1A, 0x20, 0x13, 0x11, 0x0F, 0x08, 0x0E,
197 0x0E, 0x0C, 0x09, 0x0D, 0x0E, 0x09, 0x04, 0x01,
198 0x0B, 0x04, 0x06, 0x06, 0x06, 0x03, 0x02, 0x00
199];
200const MP3_HUFF11_LENS: [u8; 64] = [
201 2, 3, 5, 7, 8, 9, 8, 9, 3, 3, 4, 6, 8, 8, 7, 8,
202 5, 5, 6, 7, 8, 9, 8, 8, 7, 6, 7, 9, 8, 10, 8, 9,
203 8, 8, 8, 9, 9, 10, 9, 10, 8, 8, 9, 10, 10, 11, 10, 11,
204 8, 7, 7, 8, 9, 10, 10, 10, 8, 7, 8, 9, 10, 10, 10, 10
205];
206const MP3_HUFF12_BITS: [u8; 64] = [
207 0x09, 0x06, 0x10, 0x21, 0x29, 0x27, 0x26, 0x1A,
208 0x07, 0x05, 0x06, 0x09, 0x17, 0x10, 0x1A, 0x0B,
209 0x11, 0x07, 0x0B, 0x0E, 0x15, 0x1E, 0x0A, 0x07,
210 0x11, 0x0A, 0x0F, 0x0C, 0x12, 0x1C, 0x0E, 0x05,
211 0x20, 0x0D, 0x16, 0x13, 0x12, 0x10, 0x09, 0x05,
212 0x28, 0x11, 0x1F, 0x1D, 0x11, 0x0D, 0x04, 0x02,
213 0x1B, 0x0C, 0x0B, 0x0F, 0x0A, 0x07, 0x04, 0x01,
214 0x1B, 0x0C, 0x08, 0x0C, 0x06, 0x03, 0x01, 0x00
215];
216const MP3_HUFF12_LENS: [u8; 64] = [
217 4, 3, 5, 7, 8, 9, 9, 9, 3, 3, 4, 5, 7, 7, 8, 8,
218 5, 4, 5, 6, 7, 8, 7, 8, 6, 5, 6, 6, 7, 8, 8, 8,
219 7, 6, 7, 7, 8, 8, 8, 9, 8, 7, 8, 8, 8, 9, 8, 9,
220 8, 7, 7, 8, 8, 9, 9, 10, 9, 8, 8, 9, 9, 9, 9, 10
221];
222const MP3_HUFF13_BITS: [u8; 256] = [
223 0x01, 0x05, 0x0E, 0x15, 0x22, 0x33, 0x2E, 0x47,
224 0x2A, 0x34, 0x44, 0x34, 0x43, 0x2C, 0x2B, 0x13,
225 0x03, 0x04, 0x0C, 0x13, 0x1F, 0x1A, 0x2C, 0x21,
226 0x1F, 0x18, 0x20, 0x18, 0x1F, 0x23, 0x16, 0x0E,
227 0x0F, 0x0D, 0x17, 0x24, 0x3B, 0x31, 0x4D, 0x41,
228 0x1D, 0x28, 0x1E, 0x28, 0x1B, 0x21, 0x2A, 0x10,
229 0x16, 0x14, 0x25, 0x3D, 0x38, 0x4F, 0x49, 0x40,
230 0x2B, 0x4C, 0x38, 0x25, 0x1A, 0x1F, 0x19, 0x0E,
231 0x23, 0x10, 0x3C, 0x39, 0x61, 0x4B, 0x72, 0x5B,
232 0x36, 0x49, 0x37, 0x29, 0x30, 0x35, 0x17, 0x18,
233 0x3A, 0x1B, 0x32, 0x60, 0x4C, 0x46, 0x5D, 0x54,
234 0x4D, 0x3A, 0x4F, 0x1D, 0x4A, 0x31, 0x29, 0x11,
235 0x2F, 0x2D, 0x4E, 0x4A, 0x73, 0x5E, 0x5A, 0x4F,
236 0x45, 0x53, 0x47, 0x32, 0x3B, 0x26, 0x24, 0x0F,
237 0x48, 0x22, 0x38, 0x5F, 0x5C, 0x55, 0x5B, 0x5A,
238 0x56, 0x49, 0x4D, 0x41, 0x33, 0x2C, 0x2B, 0x2A,
239 0x2B, 0x14, 0x1E, 0x2C, 0x37, 0x4E, 0x48, 0x57,
240 0x4E, 0x3D, 0x2E, 0x36, 0x25, 0x1E, 0x14, 0x10,
241 0x35, 0x19, 0x29, 0x25, 0x2C, 0x3B, 0x36, 0x51,
242 0x42, 0x4C, 0x39, 0x36, 0x25, 0x12, 0x27, 0x0B,
243 0x23, 0x21, 0x1F, 0x39, 0x2A, 0x52, 0x48, 0x50,
244 0x2F, 0x3A, 0x37, 0x15, 0x16, 0x1A, 0x26, 0x16,
245 0x35, 0x19, 0x17, 0x26, 0x46, 0x3C, 0x33, 0x24,
246 0x37, 0x1A, 0x22, 0x17, 0x1B, 0x0E, 0x09, 0x07,
247 0x22, 0x20, 0x1C, 0x27, 0x31, 0x4B, 0x1E, 0x34,
248 0x30, 0x28, 0x34, 0x1C, 0x12, 0x11, 0x09, 0x05,
249 0x2D, 0x15, 0x22, 0x40, 0x38, 0x32, 0x31, 0x2D,
250 0x1F, 0x13, 0x0C, 0x0F, 0x0A, 0x07, 0x06, 0x03,
251 0x30, 0x17, 0x14, 0x27, 0x24, 0x23, 0x35, 0x15,
252 0x10, 0x17, 0x0D, 0x0A, 0x06, 0x01, 0x04, 0x02,
253 0x10, 0x0F, 0x11, 0x1B, 0x19, 0x14, 0x1D, 0x0B,
254 0x11, 0x0C, 0x10, 0x08, 0x01, 0x01, 0x00, 0x01
255];
256const MP3_HUFF13_LENS: [u8; 256] = [
257 1, 4, 6, 7, 8, 9, 9, 10, 9, 10, 11, 11, 12, 12, 13, 13,
258 3, 4, 6, 7, 8, 8, 9, 9, 9, 9, 10, 10, 11, 12, 12, 12,
259 6, 6, 7, 8, 9, 9, 10, 10, 9, 10, 10, 11, 11, 12, 13, 13,
260 7, 7, 8, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 13, 13,
261 8, 7, 9, 9, 10, 10, 11, 11, 10, 11, 11, 12, 12, 13, 13, 14,
262 9, 8, 9, 10, 10, 10, 11, 11, 11, 11, 12, 11, 13, 13, 14, 14,
263 9, 9, 10, 10, 11, 11, 11, 11, 11, 12, 12, 12, 13, 13, 14, 14,
264 10, 9, 10, 11, 11, 11, 12, 12, 12, 12, 13, 13, 13, 14, 16, 16,
265 9, 8, 9, 10, 10, 11, 11, 12, 12, 12, 12, 13, 13, 14, 15, 15,
266 10, 9, 10, 10, 11, 11, 11, 13, 12, 13, 13, 14, 14, 14, 16, 15,
267 10, 10, 10, 11, 11, 12, 12, 13, 12, 13, 14, 13, 14, 15, 16, 17,
268 11, 10, 10, 11, 12, 12, 12, 12, 13, 13, 13, 14, 15, 15, 15, 16,
269 11, 11, 11, 12, 12, 13, 12, 13, 14, 14, 15, 15, 15, 16, 16, 16,
270 12, 11, 12, 13, 13, 13, 14, 14, 14, 14, 14, 15, 16, 15, 16, 16,
271 13, 12, 12, 13, 13, 13, 15, 14, 14, 17, 15, 15, 15, 17, 16, 16,
272 12, 12, 13, 14, 14, 14, 15, 14, 15, 15, 16, 16, 19, 18, 19, 16
273];
274const MP3_HUFF15_BITS: [u8; 256] = [
275 0x07, 0x0C, 0x12, 0x35, 0x2F, 0x4C, 0x7C, 0x6C,
276 0x59, 0x7B, 0x6C, 0x77, 0x6B, 0x51, 0x7A, 0x3F,
277 0x0D, 0x05, 0x10, 0x1B, 0x2E, 0x24, 0x3D, 0x33,
278 0x2A, 0x46, 0x34, 0x53, 0x41, 0x29, 0x3B, 0x24,
279 0x13, 0x11, 0x0F, 0x18, 0x29, 0x22, 0x3B, 0x30,
280 0x28, 0x40, 0x32, 0x4E, 0x3E, 0x50, 0x38, 0x21,
281 0x1D, 0x1C, 0x19, 0x2B, 0x27, 0x3F, 0x37, 0x5D,
282 0x4C, 0x3B, 0x5D, 0x48, 0x36, 0x4B, 0x32, 0x1D,
283 0x34, 0x16, 0x2A, 0x28, 0x43, 0x39, 0x5F, 0x4F,
284 0x48, 0x39, 0x59, 0x45, 0x31, 0x42, 0x2E, 0x1B,
285 0x4D, 0x25, 0x23, 0x42, 0x3A, 0x34, 0x5B, 0x4A,
286 0x3E, 0x30, 0x4F, 0x3F, 0x5A, 0x3E, 0x28, 0x26,
287 0x7D, 0x20, 0x3C, 0x38, 0x32, 0x5C, 0x4E, 0x41,
288 0x37, 0x57, 0x47, 0x33, 0x49, 0x33, 0x46, 0x1E,
289 0x6D, 0x35, 0x31, 0x5E, 0x58, 0x4B, 0x42, 0x7A,
290 0x5B, 0x49, 0x38, 0x2A, 0x40, 0x2C, 0x15, 0x19,
291 0x5A, 0x2B, 0x29, 0x4D, 0x49, 0x3F, 0x38, 0x5C,
292 0x4D, 0x42, 0x2F, 0x43, 0x30, 0x35, 0x24, 0x14,
293 0x47, 0x22, 0x43, 0x3C, 0x3A, 0x31, 0x58, 0x4C,
294 0x43, 0x6A, 0x47, 0x36, 0x26, 0x27, 0x17, 0x0F,
295 0x6D, 0x35, 0x33, 0x2F, 0x5A, 0x52, 0x3A, 0x39,
296 0x30, 0x48, 0x39, 0x29, 0x17, 0x1B, 0x3E, 0x09,
297 0x56, 0x2A, 0x28, 0x25, 0x46, 0x40, 0x34, 0x2B,
298 0x46, 0x37, 0x2A, 0x19, 0x1D, 0x12, 0x0B, 0x0B,
299 0x76, 0x44, 0x1E, 0x37, 0x32, 0x2E, 0x4A, 0x41,
300 0x31, 0x27, 0x18, 0x10, 0x16, 0x0D, 0x0E, 0x07,
301 0x5B, 0x2C, 0x27, 0x26, 0x22, 0x3F, 0x34, 0x2D,
302 0x1F, 0x34, 0x1C, 0x13, 0x0E, 0x08, 0x09, 0x03,
303 0x7B, 0x3C, 0x3A, 0x35, 0x2F, 0x2B, 0x20, 0x16,
304 0x25, 0x18, 0x11, 0x0C, 0x0F, 0x0A, 0x02, 0x01,
305 0x47, 0x25, 0x22, 0x1E, 0x1C, 0x14, 0x11, 0x1A,
306 0x15, 0x10, 0x0A, 0x06, 0x08, 0x06, 0x02, 0x00
307];
308const MP3_HUFF15_LENS: [u8; 256] = [
309 3, 4, 5, 7, 7, 8, 9, 9, 9, 10, 10, 11, 11, 11, 12, 13,
310 4, 3, 5, 6, 7, 7, 8, 8, 8, 9, 9, 10, 10, 10, 11, 11,
311 5, 5, 5, 6, 7, 7, 8, 8, 8, 9, 9, 10, 10, 11, 11, 11,
312 6, 6, 6, 7, 7, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 11,
313 7, 6, 7, 7, 8, 8, 9, 9, 9, 9, 10, 10, 10, 11, 11, 11,
314 8, 7, 7, 8, 8, 8, 9, 9, 9, 9, 10, 10, 11, 11, 11, 12,
315 9, 7, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 11, 11, 12, 12,
316 9, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 10, 11, 11, 11, 12,
317 9, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 12, 12, 12,
318 9, 8, 9, 9, 9, 9, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12,
319 10, 9, 9, 9, 10, 10, 10, 10, 10, 11, 11, 11, 11, 12, 13, 12,
320 10, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 13,
321 11, 10, 9, 10, 10, 10, 11, 11, 11, 11, 11, 11, 12, 12, 13, 13,
322 11, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 12, 12, 13, 13,
323 12, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 13, 13, 12, 13,
324 12, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 13, 13, 13, 13
325];
326const MP3_HUFF16_BITS: [u16; 256] = [
327 0x001, 0x005, 0x00E, 0x02C, 0x04A, 0x03F, 0x06E, 0x05D,
328 0x0AC, 0x095, 0x08A, 0x0F2, 0x0E1, 0x0C3, 0x178, 0x011,
329 0x003, 0x004, 0x00C, 0x014, 0x023, 0x03E, 0x035, 0x02F,
330 0x053, 0x04B, 0x044, 0x077, 0x0C9, 0x06B, 0x0CF, 0x009,
331 0x00F, 0x00D, 0x017, 0x026, 0x043, 0x03A, 0x067, 0x05A,
332 0x0A1, 0x048, 0x07F, 0x075, 0x06E, 0x0D1, 0x0CE, 0x010,
333 0x02D, 0x015, 0x027, 0x045, 0x040, 0x072, 0x063, 0x057,
334 0x09E, 0x08C, 0x0FC, 0x0D4, 0x0C7, 0x183, 0x16D, 0x01A,
335 0x04B, 0x024, 0x044, 0x041, 0x073, 0x065, 0x0B3, 0x0A4,
336 0x09B, 0x108, 0x0F6, 0x0E2, 0x18B, 0x17E, 0x16A, 0x009,
337 0x042, 0x01E, 0x03B, 0x038, 0x066, 0x0B9, 0x0AD, 0x109,
338 0x08E, 0x0FD, 0x0E8, 0x190, 0x184, 0x17A, 0x1BD, 0x010,
339 0x06F, 0x036, 0x034, 0x064, 0x0B8, 0x0B2, 0x0A0, 0x085,
340 0x101, 0x0F4, 0x0E4, 0x0D9, 0x181, 0x16E, 0x2CB, 0x00A,
341 0x062, 0x030, 0x05B, 0x058, 0x0A5, 0x09D, 0x094, 0x105,
342 0x0F8, 0x197, 0x18D, 0x174, 0x17C, 0x379, 0x374, 0x008,
343 0x055, 0x054, 0x051, 0x09F, 0x09C, 0x08F, 0x104, 0x0F9,
344 0x1AB, 0x191, 0x188, 0x17F, 0x2D7, 0x2C9, 0x2C4, 0x007,
345 0x09A, 0x04C, 0x049, 0x08D, 0x083, 0x100, 0x0F5, 0x1AA,
346 0x196, 0x18A, 0x180, 0x2DF, 0x167, 0x2C6, 0x160, 0x00B,
347 0x08B, 0x081, 0x043, 0x07D, 0x0F7, 0x0E9, 0x0E5, 0x0DB,
348 0x189, 0x2E7, 0x2E1, 0x2D0, 0x375, 0x372, 0x1B7, 0x004,
349 0x0F3, 0x078, 0x076, 0x073, 0x0E3, 0x0DF, 0x18C, 0x2EA,
350 0x2E6, 0x2E0, 0x2D1, 0x2C8, 0x2C2, 0x0DF, 0x1B4, 0x006,
351 0x0CA, 0x0E0, 0x0DE, 0x0DA, 0x0D8, 0x185, 0x182, 0x17D,
352 0x16C, 0x378, 0x1BB, 0x2C3, 0x1B8, 0x1B5, 0x6C0, 0x004,
353 0x2EB, 0x0D3, 0x0D2, 0x0D0, 0x172, 0x17B, 0x2DE, 0x2D3,
354 0x2CA, 0x6C7, 0x373, 0x36D, 0x36C, 0xD83, 0x361, 0x002,
355 0x179, 0x171, 0x066, 0x0BB, 0x2D6, 0x2D2, 0x166, 0x2C7,
356 0x2C5, 0x362, 0x6C6, 0x367, 0xD82, 0x366, 0x1B2, 0x000,
357 0x00C, 0x00A, 0x007, 0x00B, 0x00A, 0x011, 0x00B, 0x009,
358 0x00D, 0x00C, 0x00A, 0x007, 0x005, 0x003, 0x001, 0x003
359];
360const MP3_HUFF16_LENS: [u8; 256] = [
361 1, 4, 6, 8, 9, 9, 10, 10, 11, 11, 11, 12, 12, 12, 13, 9,
362 3, 4, 6, 7, 8, 9, 9, 9, 10, 10, 10, 11, 12, 11, 12, 8,
363 6, 6, 7, 8, 9, 9, 10, 10, 11, 10, 11, 11, 11, 12, 12, 9,
364 8, 7, 8, 9, 9, 10, 10, 10, 11, 11, 12, 12, 12, 13, 13, 10,
365 9, 8, 9, 9, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 9,
366 9, 8, 9, 9, 10, 11, 11, 12, 11, 12, 12, 13, 13, 13, 14, 10,
367 10, 9, 9, 10, 11, 11, 11, 11, 12, 12, 12, 12, 13, 13, 14, 10,
368 10, 9, 10, 10, 11, 11, 11, 12, 12, 13, 13, 13, 13, 15, 15, 10,
369 10, 10, 10, 11, 11, 11, 12, 12, 13, 13, 13, 13, 14, 14, 14, 10,
370 11, 10, 10, 11, 11, 12, 12, 13, 13, 13, 13, 14, 13, 14, 13, 11,
371 11, 11, 10, 11, 12, 12, 12, 12, 13, 14, 14, 14, 15, 15, 14, 10,
372 12, 11, 11, 11, 12, 12, 13, 14, 14, 14, 14, 14, 14, 13, 14, 11,
373 12, 12, 12, 12, 12, 13, 13, 13, 13, 15, 14, 14, 14, 14, 16, 11,
374 14, 12, 12, 12, 13, 13, 14, 14, 14, 16, 15, 15, 15, 17, 15, 11,
375 13, 13, 11, 12, 14, 14, 13, 14, 14, 15, 16, 15, 17, 15, 14, 11,
376 9, 8, 8, 9, 9, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 8
377];
378const MP3_HUFF24_BITS: [u16; 256] = [
379 0x00F, 0x00D, 0x02E, 0x050, 0x092, 0x106, 0x0F8, 0x1B2,
380 0x1AA, 0x29D, 0x28D, 0x289, 0x26D, 0x205, 0x408, 0x058,
381 0x00E, 0x00C, 0x015, 0x026, 0x047, 0x082, 0x07A, 0x0D8,
382 0x0D1, 0x0C6, 0x147, 0x159, 0x13F, 0x129, 0x117, 0x02A,
383 0x02F, 0x016, 0x029, 0x04A, 0x044, 0x080, 0x078, 0x0DD,
384 0x0CF, 0x0C2, 0x0B6, 0x154, 0x13B, 0x127, 0x21D, 0x012,
385 0x051, 0x027, 0x04B, 0x046, 0x086, 0x07D, 0x074, 0x0DC,
386 0x0CC, 0x0BE, 0x0B2, 0x145, 0x137, 0x125, 0x10F, 0x010,
387 0x093, 0x048, 0x045, 0x087, 0x07F, 0x076, 0x070, 0x0D2,
388 0x0C8, 0x0BC, 0x160, 0x143, 0x132, 0x11D, 0x21C, 0x00E,
389 0x107, 0x042, 0x081, 0x07E, 0x077, 0x072, 0x0D6, 0x0CA,
390 0x0C0, 0x0B4, 0x155, 0x13D, 0x12D, 0x119, 0x106, 0x00C,
391 0x0F9, 0x07B, 0x079, 0x075, 0x071, 0x0D7, 0x0CE, 0x0C3,
392 0x0B9, 0x15B, 0x14A, 0x134, 0x123, 0x110, 0x208, 0x00A,
393 0x1B3, 0x073, 0x06F, 0x06D, 0x0D3, 0x0CB, 0x0C4, 0x0BB,
394 0x161, 0x14C, 0x139, 0x12A, 0x11B, 0x213, 0x17D, 0x011,
395 0x1AB, 0x0D4, 0x0D0, 0x0CD, 0x0C9, 0x0C1, 0x0BA, 0x0B1,
396 0x0A9, 0x140, 0x12F, 0x11E, 0x10C, 0x202, 0x179, 0x010,
397 0x14F, 0x0C7, 0x0C5, 0x0BF, 0x0BD, 0x0B5, 0x0AE, 0x14D,
398 0x141, 0x131, 0x121, 0x113, 0x209, 0x17B, 0x173, 0x00B,
399 0x29C, 0x0B8, 0x0B7, 0x0B3, 0x0AF, 0x158, 0x14B, 0x13A,
400 0x130, 0x122, 0x115, 0x212, 0x17F, 0x175, 0x16E, 0x00A,
401 0x28C, 0x15A, 0x0AB, 0x0A8, 0x0A4, 0x13E, 0x135, 0x12B,
402 0x11F, 0x114, 0x107, 0x201, 0x177, 0x170, 0x16A, 0x006,
403 0x288, 0x142, 0x13C, 0x138, 0x133, 0x12E, 0x124, 0x11C,
404 0x10D, 0x105, 0x200, 0x178, 0x172, 0x16C, 0x167, 0x004,
405 0x26C, 0x12C, 0x128, 0x126, 0x120, 0x11A, 0x111, 0x10A,
406 0x203, 0x17C, 0x176, 0x171, 0x16D, 0x169, 0x165, 0x002,
407 0x409, 0x118, 0x116, 0x112, 0x10B, 0x108, 0x103, 0x17E,
408 0x17A, 0x174, 0x16F, 0x16B, 0x168, 0x166, 0x164, 0x000,
409 0x02B, 0x014, 0x013, 0x011, 0x00F, 0x00D, 0x00B, 0x009,
410 0x007, 0x006, 0x004, 0x007, 0x005, 0x003, 0x001, 0x003
411];
412const MP3_HUFF24_LENS: [u8; 256] = [
413 4, 4, 6, 7, 8, 9, 9, 10, 10, 11, 11, 11, 11, 11, 12, 9,
414 4, 4, 5, 6, 7, 8, 8, 9, 9, 9, 10, 10, 10, 10, 10, 8,
415 6, 5, 6, 7, 7, 8, 8, 9, 9, 9, 9, 10, 10, 10, 11, 7,
416 7, 6, 7, 7, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 7,
417 8, 7, 7, 8, 8, 8, 8, 9, 9, 9, 10, 10, 10, 10, 11, 7,
418 9, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 10, 7,
419 9, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 10, 11, 7,
420 10, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 10, 11, 11, 8,
421 10, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 8,
422 10, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 11, 11, 11, 8,
423 11, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 8,
424 11, 10, 9, 9, 9, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 8,
425 11, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 8,
426 11, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 8,
427 12, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 8,
428 8, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 4
429];
430
431const MP3_HUFF_SYMS2: [u8; 4] = [ 0x00, 0x01, 0x10, 0x11 ];
432const MP3_HUFF_SYMS3: [u8; 9] = [ 0x00, 0x01, 0x02, 0x10, 0x11, 0x12, 0x20, 0x21, 0x22 ];
433const MP3_HUFF_SYMS4: [u8; 16] = [
434 0x00, 0x01, 0x02, 0x03,
435 0x10, 0x11, 0x12, 0x13,
436 0x20, 0x21, 0x22, 0x23,
437 0x30, 0x31, 0x32, 0x33
438];
439const MP3_HUFF_SYMS6: [u8; 36] = [
440 0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
441 0x10, 0x11, 0x12, 0x13, 0x14, 0x15,
442 0x20, 0x21, 0x22, 0x23, 0x24, 0x25,
443 0x30, 0x31, 0x32, 0x33, 0x34, 0x35,
444 0x40, 0x41, 0x42, 0x43, 0x44, 0x45,
445 0x50, 0x51, 0x52, 0x53, 0x54, 0x55
446];
447const MP3_HUFF_SYMS8: [u8; 64] = [
448 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
449 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
450 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
451 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
452 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
453 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
454 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
455 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77
456];
457
458pub struct MP3Codebooks {
459 pub quad_cb: Codebook<u8>,
460 pub cb: [Codebook<u8>; 15],
461}
462
463fn map_cb2(idx: usize) -> u8 { MP3_HUFF_SYMS2[idx] }
464fn map_cb3(idx: usize) -> u8 { MP3_HUFF_SYMS3[idx] }
465fn map_cb4(idx: usize) -> u8 { MP3_HUFF_SYMS4[idx] }
466fn map_cb6(idx: usize) -> u8 { MP3_HUFF_SYMS6[idx] }
467fn map_cb8(idx: usize) -> u8 { MP3_HUFF_SYMS8[idx] }
468fn map_cb16(idx: usize) -> u8 { idx as u8 }
469
470macro_rules! init_cb {
471 ($bits: ident, $lens: ident, $map_cb: ident) => ({
472 let mut cbr = TableCodebookDescReader::new(&$bits, &$lens, $map_cb);
473 Codebook::new(&mut cbr, CodebookMode::MSB).unwrap()
474 })
475}
476
477impl MP3Codebooks {
478 pub fn new() -> Self {
479 let quad_cb = init_cb!(MP3_HUFF_QUAD_A_BITS, MP3_HUFF_QUAD_A_LENS, map_cb16);
480 let cb = [
481 init_cb!(MP3_HUFF1_BITS, MP3_HUFF1_LENS, map_cb2),
482 init_cb!(MP3_HUFF2_BITS, MP3_HUFF2_LENS, map_cb3),
483 init_cb!(MP3_HUFF3_BITS, MP3_HUFF3_LENS, map_cb3),
484 init_cb!(MP3_HUFF5_BITS, MP3_HUFF5_LENS, map_cb4),
485 init_cb!(MP3_HUFF6_BITS, MP3_HUFF6_LENS, map_cb4),
486 init_cb!(MP3_HUFF7_BITS, MP3_HUFF7_LENS, map_cb6),
487 init_cb!(MP3_HUFF8_BITS, MP3_HUFF8_LENS, map_cb6),
488 init_cb!(MP3_HUFF9_BITS, MP3_HUFF9_LENS, map_cb6),
489 init_cb!(MP3_HUFF10_BITS, MP3_HUFF10_LENS, map_cb8),
490 init_cb!(MP3_HUFF11_BITS, MP3_HUFF11_LENS, map_cb8),
491 init_cb!(MP3_HUFF12_BITS, MP3_HUFF12_LENS, map_cb8),
492 init_cb!(MP3_HUFF13_BITS, MP3_HUFF13_LENS, map_cb16),
493 init_cb!(MP3_HUFF15_BITS, MP3_HUFF15_LENS, map_cb16),
494 init_cb!(MP3_HUFF16_BITS, MP3_HUFF16_LENS, map_cb16),
495 init_cb!(MP3_HUFF24_BITS, MP3_HUFF24_LENS, map_cb16)
496 ];
497
498 Self { quad_cb, cb }
499 }
500 pub fn get_cb(&self, cb_id: u8) -> Option<(&Codebook<u8>, u8)> {
501 match cb_id {
502 0 => None,
503 1 => Some((&self.cb[0], 0)),
504 2 => Some((&self.cb[1], 0)),
505 3 => Some((&self.cb[2], 0)),
506 5 => Some((&self.cb[3], 0)),
507 6 => Some((&self.cb[4], 0)),
508 7 => Some((&self.cb[5], 0)),
509 8 => Some((&self.cb[6], 0)),
510 9 => Some((&self.cb[7], 0)),
511 10 => Some((&self.cb[8], 0)),
512 11 => Some((&self.cb[9], 0)),
513 12 => Some((&self.cb[10], 0)),
514 13 => Some((&self.cb[11], 0)),
515 15 => Some((&self.cb[12], 0)),
516 16 => Some((&self.cb[13], 1)),
517 17 => Some((&self.cb[13], 2)),
518 18 => Some((&self.cb[13], 3)),
519 19 => Some((&self.cb[13], 4)),
520 20 => Some((&self.cb[13], 6)),
521 21 => Some((&self.cb[13], 8)),
522 22 => Some((&self.cb[13], 10)),
523 23 => Some((&self.cb[13], 13)),
524 24 => Some((&self.cb[14], 4)),
525 25 => Some((&self.cb[14], 5)),
526 26 => Some((&self.cb[14], 6)),
527 27 => Some((&self.cb[14], 7)),
528 28 => Some((&self.cb[14], 8)),
529 29 => Some((&self.cb[14], 9)),
530 30 => Some((&self.cb[14], 11)),
531 31 => Some((&self.cb[14], 13)),
532 _ => unreachable!(),
533 }
534 }
535}