1 /********************************************************************
3 * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
4 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
5 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
6 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
8 * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
9 * by the Xiph.Org Foundation https://xiph.org/ *
11 ********************************************************************
13 function: toplevel residue templates for 32/44.1/48kHz
15 ********************************************************************/
17 #include "vorbis/codec.h"
19 #include "books/coupled/res_books_stereo.h"
21 /***** residue backends *********************************************/
23 static const vorbis_info_residue0 _residue_44_low={
28 { 0, 1, 2, 2, 4, 8, 16, 32},
29 { 0, 0, 0,999, 4, 8, 16, 32},
32 static const vorbis_info_residue0 _residue_44_mid={
34 /* 0 1 2 3 4 5 6 7 8 */
37 { 0, 1, 1, 2, 2, 4, 8, 16, 32},
38 { 0, 0,999, 0,999, 4, 8, 16, 32},
41 static const vorbis_info_residue0 _residue_44_high={
43 /* 0 1 2 3 4 5 6 7 8 */
46 { 0, 1, 2, 4, 8, 16, 32, 71,157},
47 { 0, 1, 2, 3, 4, 8, 16, 71,157},
50 static const static_bookblock _resbook_44s_n1={
52 {0},{0,0,&_44cn1_s_p1_0},{0,0,&_44cn1_s_p2_0},
53 {0,0,&_44cn1_s_p3_0},{0,0,&_44cn1_s_p4_0},{0,0,&_44cn1_s_p5_0},
54 {&_44cn1_s_p6_0,&_44cn1_s_p6_1},{&_44cn1_s_p7_0,&_44cn1_s_p7_1},
55 {&_44cn1_s_p8_0,&_44cn1_s_p8_1,&_44cn1_s_p8_2}
58 static const static_bookblock _resbook_44sm_n1={
60 {0},{0,0,&_44cn1_sm_p1_0},{0,0,&_44cn1_sm_p2_0},
61 {0,0,&_44cn1_sm_p3_0},{0,0,&_44cn1_sm_p4_0},{0,0,&_44cn1_sm_p5_0},
62 {&_44cn1_sm_p6_0,&_44cn1_sm_p6_1},{&_44cn1_sm_p7_0,&_44cn1_sm_p7_1},
63 {&_44cn1_sm_p8_0,&_44cn1_sm_p8_1,&_44cn1_sm_p8_2}
67 static const static_bookblock _resbook_44s_0={
69 {0},{0,0,&_44c0_s_p1_0},{0,0,&_44c0_s_p2_0},
70 {0,0,&_44c0_s_p3_0},{0,0,&_44c0_s_p4_0},{0,0,&_44c0_s_p5_0},
71 {&_44c0_s_p6_0,&_44c0_s_p6_1},{&_44c0_s_p7_0,&_44c0_s_p7_1},
72 {&_44c0_s_p8_0,&_44c0_s_p8_1,&_44c0_s_p8_2}
75 static const static_bookblock _resbook_44sm_0={
77 {0},{0,0,&_44c0_sm_p1_0},{0,0,&_44c0_sm_p2_0},
78 {0,0,&_44c0_sm_p3_0},{0,0,&_44c0_sm_p4_0},{0,0,&_44c0_sm_p5_0},
79 {&_44c0_sm_p6_0,&_44c0_sm_p6_1},{&_44c0_sm_p7_0,&_44c0_sm_p7_1},
80 {&_44c0_sm_p8_0,&_44c0_sm_p8_1,&_44c0_sm_p8_2}
84 static const static_bookblock _resbook_44s_1={
86 {0},{0,0,&_44c1_s_p1_0},{0,0,&_44c1_s_p2_0},
87 {0,0,&_44c1_s_p3_0},{0,0,&_44c1_s_p4_0},{0,0,&_44c1_s_p5_0},
88 {&_44c1_s_p6_0,&_44c1_s_p6_1},{&_44c1_s_p7_0,&_44c1_s_p7_1},
89 {&_44c1_s_p8_0,&_44c1_s_p8_1,&_44c1_s_p8_2}
92 static const static_bookblock _resbook_44sm_1={
94 {0},{0,0,&_44c1_sm_p1_0},{0,0,&_44c1_sm_p2_0},
95 {0,0,&_44c1_sm_p3_0},{0,0,&_44c1_sm_p4_0},{0,0,&_44c1_sm_p5_0},
96 {&_44c1_sm_p6_0,&_44c1_sm_p6_1},{&_44c1_sm_p7_0,&_44c1_sm_p7_1},
97 {&_44c1_sm_p8_0,&_44c1_sm_p8_1,&_44c1_sm_p8_2}
101 static const static_bookblock _resbook_44s_2={
103 {0},{0,0,&_44c2_s_p1_0},{0,0,&_44c2_s_p2_0},{0,0,&_44c2_s_p3_0},
104 {0,0,&_44c2_s_p4_0},{0,0,&_44c2_s_p5_0},{0,0,&_44c2_s_p6_0},
105 {&_44c2_s_p7_0,&_44c2_s_p7_1},{&_44c2_s_p8_0,&_44c2_s_p8_1},
106 {&_44c2_s_p9_0,&_44c2_s_p9_1,&_44c2_s_p9_2}
109 static const static_bookblock _resbook_44s_3={
111 {0},{0,0,&_44c3_s_p1_0},{0,0,&_44c3_s_p2_0},{0,0,&_44c3_s_p3_0},
112 {0,0,&_44c3_s_p4_0},{0,0,&_44c3_s_p5_0},{0,0,&_44c3_s_p6_0},
113 {&_44c3_s_p7_0,&_44c3_s_p7_1},{&_44c3_s_p8_0,&_44c3_s_p8_1},
114 {&_44c3_s_p9_0,&_44c3_s_p9_1,&_44c3_s_p9_2}
117 static const static_bookblock _resbook_44s_4={
119 {0},{0,0,&_44c4_s_p1_0},{0,0,&_44c4_s_p2_0},{0,0,&_44c4_s_p3_0},
120 {0,0,&_44c4_s_p4_0},{0,0,&_44c4_s_p5_0},{0,0,&_44c4_s_p6_0},
121 {&_44c4_s_p7_0,&_44c4_s_p7_1},{&_44c4_s_p8_0,&_44c4_s_p8_1},
122 {&_44c4_s_p9_0,&_44c4_s_p9_1,&_44c4_s_p9_2}
125 static const static_bookblock _resbook_44s_5={
127 {0},{0,0,&_44c5_s_p1_0},{0,0,&_44c5_s_p2_0},{0,0,&_44c5_s_p3_0},
128 {0,0,&_44c5_s_p4_0},{0,0,&_44c5_s_p5_0},{0,0,&_44c5_s_p6_0},
129 {&_44c5_s_p7_0,&_44c5_s_p7_1},{&_44c5_s_p8_0,&_44c5_s_p8_1},
130 {&_44c5_s_p9_0,&_44c5_s_p9_1,&_44c5_s_p9_2}
133 static const static_bookblock _resbook_44s_6={
135 {0},{0,0,&_44c6_s_p1_0},{0,0,&_44c6_s_p2_0},{0,0,&_44c6_s_p3_0},
137 {&_44c6_s_p5_0,&_44c6_s_p5_1},
138 {&_44c6_s_p6_0,&_44c6_s_p6_1},
139 {&_44c6_s_p7_0,&_44c6_s_p7_1},
140 {&_44c6_s_p8_0,&_44c6_s_p8_1},
141 {&_44c6_s_p9_0,&_44c6_s_p9_1,&_44c6_s_p9_2}
144 static const static_bookblock _resbook_44s_7={
146 {0},{0,0,&_44c7_s_p1_0},{0,0,&_44c7_s_p2_0},{0,0,&_44c7_s_p3_0},
148 {&_44c7_s_p5_0,&_44c7_s_p5_1},
149 {&_44c7_s_p6_0,&_44c7_s_p6_1},
150 {&_44c7_s_p7_0,&_44c7_s_p7_1},
151 {&_44c7_s_p8_0,&_44c7_s_p8_1},
152 {&_44c7_s_p9_0,&_44c7_s_p9_1,&_44c7_s_p9_2}
155 static const static_bookblock _resbook_44s_8={
157 {0},{0,0,&_44c8_s_p1_0},{0,0,&_44c8_s_p2_0},{0,0,&_44c8_s_p3_0},
159 {&_44c8_s_p5_0,&_44c8_s_p5_1},
160 {&_44c8_s_p6_0,&_44c8_s_p6_1},
161 {&_44c8_s_p7_0,&_44c8_s_p7_1},
162 {&_44c8_s_p8_0,&_44c8_s_p8_1},
163 {&_44c8_s_p9_0,&_44c8_s_p9_1,&_44c8_s_p9_2}
166 static const static_bookblock _resbook_44s_9={
168 {0},{0,0,&_44c9_s_p1_0},{0,0,&_44c9_s_p2_0},{0,0,&_44c9_s_p3_0},
170 {&_44c9_s_p5_0,&_44c9_s_p5_1},
171 {&_44c9_s_p6_0,&_44c9_s_p6_1},
172 {&_44c9_s_p7_0,&_44c9_s_p7_1},
173 {&_44c9_s_p8_0,&_44c9_s_p8_1},
174 {&_44c9_s_p9_0,&_44c9_s_p9_1,&_44c9_s_p9_2}
178 static const vorbis_residue_template _res_44s_n1[]={
179 {2,0,32, &_residue_44_low,
180 &_huff_book__44cn1_s_short,&_huff_book__44cn1_sm_short,
181 &_resbook_44s_n1,&_resbook_44sm_n1},
183 {2,0,32, &_residue_44_low,
184 &_huff_book__44cn1_s_long,&_huff_book__44cn1_sm_long,
185 &_resbook_44s_n1,&_resbook_44sm_n1}
187 static const vorbis_residue_template _res_44s_0[]={
188 {2,0,16, &_residue_44_low,
189 &_huff_book__44c0_s_short,&_huff_book__44c0_sm_short,
190 &_resbook_44s_0,&_resbook_44sm_0},
192 {2,0,32, &_residue_44_low,
193 &_huff_book__44c0_s_long,&_huff_book__44c0_sm_long,
194 &_resbook_44s_0,&_resbook_44sm_0}
196 static const vorbis_residue_template _res_44s_1[]={
197 {2,0,16, &_residue_44_low,
198 &_huff_book__44c1_s_short,&_huff_book__44c1_sm_short,
199 &_resbook_44s_1,&_resbook_44sm_1},
201 {2,0,32, &_residue_44_low,
202 &_huff_book__44c1_s_long,&_huff_book__44c1_sm_long,
203 &_resbook_44s_1,&_resbook_44sm_1}
206 static const vorbis_residue_template _res_44s_2[]={
207 {2,0,16, &_residue_44_mid,
208 &_huff_book__44c2_s_short,&_huff_book__44c2_s_short,
209 &_resbook_44s_2,&_resbook_44s_2},
211 {2,0,32, &_residue_44_mid,
212 &_huff_book__44c2_s_long,&_huff_book__44c2_s_long,
213 &_resbook_44s_2,&_resbook_44s_2}
215 static const vorbis_residue_template _res_44s_3[]={
216 {2,0,16, &_residue_44_mid,
217 &_huff_book__44c3_s_short,&_huff_book__44c3_s_short,
218 &_resbook_44s_3,&_resbook_44s_3},
220 {2,0,32, &_residue_44_mid,
221 &_huff_book__44c3_s_long,&_huff_book__44c3_s_long,
222 &_resbook_44s_3,&_resbook_44s_3}
224 static const vorbis_residue_template _res_44s_4[]={
225 {2,0,16, &_residue_44_mid,
226 &_huff_book__44c4_s_short,&_huff_book__44c4_s_short,
227 &_resbook_44s_4,&_resbook_44s_4},
229 {2,0,32, &_residue_44_mid,
230 &_huff_book__44c4_s_long,&_huff_book__44c4_s_long,
231 &_resbook_44s_4,&_resbook_44s_4}
233 static const vorbis_residue_template _res_44s_5[]={
234 {2,0,16, &_residue_44_mid,
235 &_huff_book__44c5_s_short,&_huff_book__44c5_s_short,
236 &_resbook_44s_5,&_resbook_44s_5},
238 {2,0,32, &_residue_44_mid,
239 &_huff_book__44c5_s_long,&_huff_book__44c5_s_long,
240 &_resbook_44s_5,&_resbook_44s_5}
242 static const vorbis_residue_template _res_44s_6[]={
243 {2,0,16, &_residue_44_high,
244 &_huff_book__44c6_s_short,&_huff_book__44c6_s_short,
245 &_resbook_44s_6,&_resbook_44s_6},
247 {2,0,32, &_residue_44_high,
248 &_huff_book__44c6_s_long,&_huff_book__44c6_s_long,
249 &_resbook_44s_6,&_resbook_44s_6}
251 static const vorbis_residue_template _res_44s_7[]={
252 {2,0,16, &_residue_44_high,
253 &_huff_book__44c7_s_short,&_huff_book__44c7_s_short,
254 &_resbook_44s_7,&_resbook_44s_7},
256 {2,0,32, &_residue_44_high,
257 &_huff_book__44c7_s_long,&_huff_book__44c7_s_long,
258 &_resbook_44s_7,&_resbook_44s_7}
260 static const vorbis_residue_template _res_44s_8[]={
261 {2,0,16, &_residue_44_high,
262 &_huff_book__44c8_s_short,&_huff_book__44c8_s_short,
263 &_resbook_44s_8,&_resbook_44s_8},
265 {2,0,32, &_residue_44_high,
266 &_huff_book__44c8_s_long,&_huff_book__44c8_s_long,
267 &_resbook_44s_8,&_resbook_44s_8}
269 static const vorbis_residue_template _res_44s_9[]={
270 {2,0,16, &_residue_44_high,
271 &_huff_book__44c9_s_short,&_huff_book__44c9_s_short,
272 &_resbook_44s_9,&_resbook_44s_9},
274 {2,0,32, &_residue_44_high,
275 &_huff_book__44c9_s_long,&_huff_book__44c9_s_long,
276 &_resbook_44s_9,&_resbook_44s_9}
279 static const vorbis_mapping_template _mapres_template_44_stereo[]={
280 { _map_nominal, _res_44s_n1 }, /* -1 */
281 { _map_nominal, _res_44s_0 }, /* 0 */
282 { _map_nominal, _res_44s_1 }, /* 1 */
283 { _map_nominal, _res_44s_2 }, /* 2 */
284 { _map_nominal, _res_44s_3 }, /* 3 */
285 { _map_nominal, _res_44s_4 }, /* 4 */
286 { _map_nominal, _res_44s_5 }, /* 5 */
287 { _map_nominal, _res_44s_6 }, /* 6 */
288 { _map_nominal, _res_44s_7 }, /* 7 */
289 { _map_nominal, _res_44s_8 }, /* 8 */
290 { _map_nominal, _res_44s_9 }, /* 9 */