1 /********************************************************************
2  *                                                                  *
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.       *
7  *                                                                  *
8  * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009             *
9  * by the Xiph.Org Foundation http://www.xiph.org/                  *
10  *                                                                  *
11  ********************************************************************
12 
13  function: toplevel residue templates for 32/44.1/48kHz
14  last mod: $Id: residue_44.h 16962 2010-03-11 07:30:34Z xiphmont $
15 
16  ********************************************************************/
17 
18 #include "vorbis/codec.h"
19 #include "backends.h"
20 #include "books/coupled/res_books_stereo.h"
21 
22 /***** residue backends *********************************************/
23 
24 static const vorbis_info_residue0 _residue_44_low={
25   0,-1, -1, 9,-1,-1,
26   /* 0   1   2   3   4   5   6   7  */
27   {0},
28   {-1},
29   {  0,  1,  2,  2,  4,  8, 16, 32},
30   {  0,  0,  0,999,  4,  8, 16, 32},
31 };
32 
33 static const vorbis_info_residue0 _residue_44_mid={
34   0,-1, -1, 10,-1,-1,
35   /* 0   1   2   3   4   5   6   7   8  */
36   {0},
37   {-1},
38   {  0,  1,  1,  2,  2,  4,  8, 16, 32},
39   {  0,  0,999,  0,999,  4,  8, 16, 32},
40 };
41 
42 static const vorbis_info_residue0 _residue_44_high={
43   0,-1, -1, 10,-1,-1,
44   /* 0   1   2   3   4   5   6   7   8  */
45   {0},
46   {-1},
47   {  0,  1,  2,  4,  8, 16, 32, 71,157},
48   {  0,  1,  2,  3,  4,  8, 16, 71,157},
49 };
50 
51 static const static_bookblock _resbook_44s_n1={
52   {
53     {0},{0,0,&_44cn1_s_p1_0},{0,0,&_44cn1_s_p2_0},
54     {0,0,&_44cn1_s_p3_0},{0,0,&_44cn1_s_p4_0},{0,0,&_44cn1_s_p5_0},
55     {&_44cn1_s_p6_0,&_44cn1_s_p6_1},{&_44cn1_s_p7_0,&_44cn1_s_p7_1},
56     {&_44cn1_s_p8_0,&_44cn1_s_p8_1,&_44cn1_s_p8_2}
57    }
58 };
59 static const static_bookblock _resbook_44sm_n1={
60   {
61     {0},{0,0,&_44cn1_sm_p1_0},{0,0,&_44cn1_sm_p2_0},
62     {0,0,&_44cn1_sm_p3_0},{0,0,&_44cn1_sm_p4_0},{0,0,&_44cn1_sm_p5_0},
63     {&_44cn1_sm_p6_0,&_44cn1_sm_p6_1},{&_44cn1_sm_p7_0,&_44cn1_sm_p7_1},
64     {&_44cn1_sm_p8_0,&_44cn1_sm_p8_1,&_44cn1_sm_p8_2}
65    }
66 };
67 
68 static const static_bookblock _resbook_44s_0={
69   {
70     {0},{0,0,&_44c0_s_p1_0},{0,0,&_44c0_s_p2_0},
71     {0,0,&_44c0_s_p3_0},{0,0,&_44c0_s_p4_0},{0,0,&_44c0_s_p5_0},
72     {&_44c0_s_p6_0,&_44c0_s_p6_1},{&_44c0_s_p7_0,&_44c0_s_p7_1},
73     {&_44c0_s_p8_0,&_44c0_s_p8_1,&_44c0_s_p8_2}
74    }
75 };
76 static const static_bookblock _resbook_44sm_0={
77   {
78     {0},{0,0,&_44c0_sm_p1_0},{0,0,&_44c0_sm_p2_0},
79     {0,0,&_44c0_sm_p3_0},{0,0,&_44c0_sm_p4_0},{0,0,&_44c0_sm_p5_0},
80     {&_44c0_sm_p6_0,&_44c0_sm_p6_1},{&_44c0_sm_p7_0,&_44c0_sm_p7_1},
81     {&_44c0_sm_p8_0,&_44c0_sm_p8_1,&_44c0_sm_p8_2}
82    }
83 };
84 
85 static const static_bookblock _resbook_44s_1={
86   {
87     {0},{0,0,&_44c1_s_p1_0},{0,0,&_44c1_s_p2_0},
88     {0,0,&_44c1_s_p3_0},{0,0,&_44c1_s_p4_0},{0,0,&_44c1_s_p5_0},
89     {&_44c1_s_p6_0,&_44c1_s_p6_1},{&_44c1_s_p7_0,&_44c1_s_p7_1},
90     {&_44c1_s_p8_0,&_44c1_s_p8_1,&_44c1_s_p8_2}
91    }
92 };
93 static const static_bookblock _resbook_44sm_1={
94   {
95     {0},{0,0,&_44c1_sm_p1_0},{0,0,&_44c1_sm_p2_0},
96     {0,0,&_44c1_sm_p3_0},{0,0,&_44c1_sm_p4_0},{0,0,&_44c1_sm_p5_0},
97     {&_44c1_sm_p6_0,&_44c1_sm_p6_1},{&_44c1_sm_p7_0,&_44c1_sm_p7_1},
98     {&_44c1_sm_p8_0,&_44c1_sm_p8_1,&_44c1_sm_p8_2}
99    }
100 };
101 
102 static const static_bookblock _resbook_44s_2={
103   {
104     {0},{0,0,&_44c2_s_p1_0},{0,0,&_44c2_s_p2_0},{0,0,&_44c2_s_p3_0},
105     {0,0,&_44c2_s_p4_0},{0,0,&_44c2_s_p5_0},{0,0,&_44c2_s_p6_0},
106     {&_44c2_s_p7_0,&_44c2_s_p7_1},{&_44c2_s_p8_0,&_44c2_s_p8_1},
107     {&_44c2_s_p9_0,&_44c2_s_p9_1,&_44c2_s_p9_2}
108    }
109 };
110 static const static_bookblock _resbook_44s_3={
111   {
112     {0},{0,0,&_44c3_s_p1_0},{0,0,&_44c3_s_p2_0},{0,0,&_44c3_s_p3_0},
113     {0,0,&_44c3_s_p4_0},{0,0,&_44c3_s_p5_0},{0,0,&_44c3_s_p6_0},
114     {&_44c3_s_p7_0,&_44c3_s_p7_1},{&_44c3_s_p8_0,&_44c3_s_p8_1},
115     {&_44c3_s_p9_0,&_44c3_s_p9_1,&_44c3_s_p9_2}
116    }
117 };
118 static const static_bookblock _resbook_44s_4={
119   {
120     {0},{0,0,&_44c4_s_p1_0},{0,0,&_44c4_s_p2_0},{0,0,&_44c4_s_p3_0},
121     {0,0,&_44c4_s_p4_0},{0,0,&_44c4_s_p5_0},{0,0,&_44c4_s_p6_0},
122     {&_44c4_s_p7_0,&_44c4_s_p7_1},{&_44c4_s_p8_0,&_44c4_s_p8_1},
123     {&_44c4_s_p9_0,&_44c4_s_p9_1,&_44c4_s_p9_2}
124    }
125 };
126 static const static_bookblock _resbook_44s_5={
127   {
128     {0},{0,0,&_44c5_s_p1_0},{0,0,&_44c5_s_p2_0},{0,0,&_44c5_s_p3_0},
129     {0,0,&_44c5_s_p4_0},{0,0,&_44c5_s_p5_0},{0,0,&_44c5_s_p6_0},
130     {&_44c5_s_p7_0,&_44c5_s_p7_1},{&_44c5_s_p8_0,&_44c5_s_p8_1},
131     {&_44c5_s_p9_0,&_44c5_s_p9_1,&_44c5_s_p9_2}
132    }
133 };
134 static const static_bookblock _resbook_44s_6={
135   {
136     {0},{0,0,&_44c6_s_p1_0},{0,0,&_44c6_s_p2_0},{0,0,&_44c6_s_p3_0},
137     {0,0,&_44c6_s_p4_0},
138     {&_44c6_s_p5_0,&_44c6_s_p5_1},
139     {&_44c6_s_p6_0,&_44c6_s_p6_1},
140     {&_44c6_s_p7_0,&_44c6_s_p7_1},
141     {&_44c6_s_p8_0,&_44c6_s_p8_1},
142     {&_44c6_s_p9_0,&_44c6_s_p9_1,&_44c6_s_p9_2}
143    }
144 };
145 static const static_bookblock _resbook_44s_7={
146   {
147     {0},{0,0,&_44c7_s_p1_0},{0,0,&_44c7_s_p2_0},{0,0,&_44c7_s_p3_0},
148     {0,0,&_44c7_s_p4_0},
149     {&_44c7_s_p5_0,&_44c7_s_p5_1},
150     {&_44c7_s_p6_0,&_44c7_s_p6_1},
151     {&_44c7_s_p7_0,&_44c7_s_p7_1},
152     {&_44c7_s_p8_0,&_44c7_s_p8_1},
153     {&_44c7_s_p9_0,&_44c7_s_p9_1,&_44c7_s_p9_2}
154    }
155 };
156 static const static_bookblock _resbook_44s_8={
157   {
158     {0},{0,0,&_44c8_s_p1_0},{0,0,&_44c8_s_p2_0},{0,0,&_44c8_s_p3_0},
159     {0,0,&_44c8_s_p4_0},
160     {&_44c8_s_p5_0,&_44c8_s_p5_1},
161     {&_44c8_s_p6_0,&_44c8_s_p6_1},
162     {&_44c8_s_p7_0,&_44c8_s_p7_1},
163     {&_44c8_s_p8_0,&_44c8_s_p8_1},
164     {&_44c8_s_p9_0,&_44c8_s_p9_1,&_44c8_s_p9_2}
165    }
166 };
167 static const static_bookblock _resbook_44s_9={
168   {
169     {0},{0,0,&_44c9_s_p1_0},{0,0,&_44c9_s_p2_0},{0,0,&_44c9_s_p3_0},
170     {0,0,&_44c9_s_p4_0},
171     {&_44c9_s_p5_0,&_44c9_s_p5_1},
172     {&_44c9_s_p6_0,&_44c9_s_p6_1},
173     {&_44c9_s_p7_0,&_44c9_s_p7_1},
174     {&_44c9_s_p8_0,&_44c9_s_p8_1},
175     {&_44c9_s_p9_0,&_44c9_s_p9_1,&_44c9_s_p9_2}
176    }
177 };
178 
179 static const vorbis_residue_template _res_44s_n1[]={
180   {2,0,32,  &_residue_44_low,
181    &_huff_book__44cn1_s_short,&_huff_book__44cn1_sm_short,
182    &_resbook_44s_n1,&_resbook_44sm_n1},
183 
184   {2,0,32,  &_residue_44_low,
185    &_huff_book__44cn1_s_long,&_huff_book__44cn1_sm_long,
186    &_resbook_44s_n1,&_resbook_44sm_n1}
187 };
188 static const vorbis_residue_template _res_44s_0[]={
189   {2,0,16,  &_residue_44_low,
190    &_huff_book__44c0_s_short,&_huff_book__44c0_sm_short,
191    &_resbook_44s_0,&_resbook_44sm_0},
192 
193   {2,0,32,  &_residue_44_low,
194    &_huff_book__44c0_s_long,&_huff_book__44c0_sm_long,
195    &_resbook_44s_0,&_resbook_44sm_0}
196 };
197 static const vorbis_residue_template _res_44s_1[]={
198   {2,0,16,  &_residue_44_low,
199    &_huff_book__44c1_s_short,&_huff_book__44c1_sm_short,
200    &_resbook_44s_1,&_resbook_44sm_1},
201 
202   {2,0,32,  &_residue_44_low,
203    &_huff_book__44c1_s_long,&_huff_book__44c1_sm_long,
204    &_resbook_44s_1,&_resbook_44sm_1}
205 };
206 
207 static const vorbis_residue_template _res_44s_2[]={
208   {2,0,16,  &_residue_44_mid,
209    &_huff_book__44c2_s_short,&_huff_book__44c2_s_short,
210    &_resbook_44s_2,&_resbook_44s_2},
211 
212   {2,0,32,  &_residue_44_mid,
213    &_huff_book__44c2_s_long,&_huff_book__44c2_s_long,
214    &_resbook_44s_2,&_resbook_44s_2}
215 };
216 static const vorbis_residue_template _res_44s_3[]={
217   {2,0,16,  &_residue_44_mid,
218    &_huff_book__44c3_s_short,&_huff_book__44c3_s_short,
219    &_resbook_44s_3,&_resbook_44s_3},
220 
221   {2,0,32,  &_residue_44_mid,
222    &_huff_book__44c3_s_long,&_huff_book__44c3_s_long,
223    &_resbook_44s_3,&_resbook_44s_3}
224 };
225 static const vorbis_residue_template _res_44s_4[]={
226   {2,0,16,  &_residue_44_mid,
227    &_huff_book__44c4_s_short,&_huff_book__44c4_s_short,
228    &_resbook_44s_4,&_resbook_44s_4},
229 
230   {2,0,32,  &_residue_44_mid,
231    &_huff_book__44c4_s_long,&_huff_book__44c4_s_long,
232    &_resbook_44s_4,&_resbook_44s_4}
233 };
234 static const vorbis_residue_template _res_44s_5[]={
235   {2,0,16,  &_residue_44_mid,
236    &_huff_book__44c5_s_short,&_huff_book__44c5_s_short,
237    &_resbook_44s_5,&_resbook_44s_5},
238 
239   {2,0,32,  &_residue_44_mid,
240    &_huff_book__44c5_s_long,&_huff_book__44c5_s_long,
241    &_resbook_44s_5,&_resbook_44s_5}
242 };
243 static const vorbis_residue_template _res_44s_6[]={
244   {2,0,16,  &_residue_44_high,
245    &_huff_book__44c6_s_short,&_huff_book__44c6_s_short,
246    &_resbook_44s_6,&_resbook_44s_6},
247 
248   {2,0,32,  &_residue_44_high,
249    &_huff_book__44c6_s_long,&_huff_book__44c6_s_long,
250    &_resbook_44s_6,&_resbook_44s_6}
251 };
252 static const vorbis_residue_template _res_44s_7[]={
253   {2,0,16,  &_residue_44_high,
254    &_huff_book__44c7_s_short,&_huff_book__44c7_s_short,
255    &_resbook_44s_7,&_resbook_44s_7},
256 
257   {2,0,32,  &_residue_44_high,
258    &_huff_book__44c7_s_long,&_huff_book__44c7_s_long,
259    &_resbook_44s_7,&_resbook_44s_7}
260 };
261 static const vorbis_residue_template _res_44s_8[]={
262   {2,0,16,  &_residue_44_high,
263    &_huff_book__44c8_s_short,&_huff_book__44c8_s_short,
264    &_resbook_44s_8,&_resbook_44s_8},
265 
266   {2,0,32,  &_residue_44_high,
267    &_huff_book__44c8_s_long,&_huff_book__44c8_s_long,
268    &_resbook_44s_8,&_resbook_44s_8}
269 };
270 static const vorbis_residue_template _res_44s_9[]={
271   {2,0,16,  &_residue_44_high,
272    &_huff_book__44c9_s_short,&_huff_book__44c9_s_short,
273    &_resbook_44s_9,&_resbook_44s_9},
274 
275   {2,0,32,  &_residue_44_high,
276    &_huff_book__44c9_s_long,&_huff_book__44c9_s_long,
277    &_resbook_44s_9,&_resbook_44s_9}
278 };
279 
280 static const vorbis_mapping_template _mapres_template_44_stereo[]={
281   { _map_nominal, _res_44s_n1 }, /* -1 */
282   { _map_nominal, _res_44s_0 }, /* 0 */
283   { _map_nominal, _res_44s_1 }, /* 1 */
284   { _map_nominal, _res_44s_2 }, /* 2 */
285   { _map_nominal, _res_44s_3 }, /* 3 */
286   { _map_nominal, _res_44s_4 }, /* 4 */
287   { _map_nominal, _res_44s_5 }, /* 5 */
288   { _map_nominal, _res_44s_6 }, /* 6 */
289   { _map_nominal, _res_44s_7 }, /* 7 */
290   { _map_nominal, _res_44s_8 }, /* 8 */
291   { _map_nominal, _res_44s_9 }, /* 9 */
292 };
293