Merge tag 'v1.3.7' into tizen
[platform/upstream/libvorbis.git] / lib / modes / residue_44u.h
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-2007             *
9  * by the Xiph.Org Foundation https://xiph.org/                     *
10  *                                                                  *
11  ********************************************************************
12
13  function: toplevel residue templates for 32/44.1/48kHz uncoupled
14
15  ********************************************************************/
16
17 #include "vorbis/codec.h"
18 #include "backends.h"
19 #include "books/uncoupled/res_books_uncoupled.h"
20
21 /***** residue backends *********************************************/
22
23
24 static const vorbis_info_residue0 _residue_44_low_un={
25   0,-1, -1, 8,-1,-1,
26   {0},
27   {-1},
28   {  0,  1,  1,  2,  2,  4, 28},
29   { -1, 25, -1, 45, -1, -1, -1}
30 };
31
32 static const vorbis_info_residue0 _residue_44_mid_un={
33   0,-1, -1, 10,-1,-1,
34   /* 0   1   2   3   4   5   6   7   8   9 */
35   {0},
36   {-1},
37   {  0,  1,  1,  2,  2,  4,  4, 16, 60},
38   { -1, 30, -1, 50, -1, 80, -1, -1, -1}
39 };
40
41 static const vorbis_info_residue0 _residue_44_hi_un={
42   0,-1, -1, 10,-1,-1,
43   /* 0   1   2   3   4   5   6   7   8   9 */
44   {0},
45   {-1},
46   {  0,  1,  2,  4,  8, 16, 32, 71,157},
47   { -1, -1, -1, -1, -1, -1, -1, -1, -1}
48 };
49
50 /* mapping conventions:
51    only one submap (this would change for efficient 5.1 support for example)*/
52 /* Four psychoacoustic profiles are used, one for each blocktype */
53 static const vorbis_info_mapping0 _map_nominal_u[2]={
54   {1, {0,0,0,0,0,0}, {0}, {0}, 0,{0},{0}},
55   {1, {0,0,0,0,0,0}, {1}, {1}, 0,{0},{0}}
56 };
57
58 static const static_bookblock _resbook_44u_n1={
59   {
60     {0},
61     {0,0,&_44un1__p1_0},
62     {0,0,&_44un1__p2_0},
63     {0,0,&_44un1__p3_0},
64     {0,0,&_44un1__p4_0},
65     {0,0,&_44un1__p5_0},
66     {&_44un1__p6_0,&_44un1__p6_1},
67     {&_44un1__p7_0,&_44un1__p7_1,&_44un1__p7_2}
68    }
69 };
70 static const static_bookblock _resbook_44u_0={
71   {
72     {0},
73     {0,0,&_44u0__p1_0},
74     {0,0,&_44u0__p2_0},
75     {0,0,&_44u0__p3_0},
76     {0,0,&_44u0__p4_0},
77     {0,0,&_44u0__p5_0},
78     {&_44u0__p6_0,&_44u0__p6_1},
79     {&_44u0__p7_0,&_44u0__p7_1,&_44u0__p7_2}
80    }
81 };
82 static const static_bookblock _resbook_44u_1={
83   {
84     {0},
85     {0,0,&_44u1__p1_0},
86     {0,0,&_44u1__p2_0},
87     {0,0,&_44u1__p3_0},
88     {0,0,&_44u1__p4_0},
89     {0,0,&_44u1__p5_0},
90     {&_44u1__p6_0,&_44u1__p6_1},
91     {&_44u1__p7_0,&_44u1__p7_1,&_44u1__p7_2}
92    }
93 };
94 static const static_bookblock _resbook_44u_2={
95   {
96     {0},
97     {0,0,&_44u2__p1_0},
98     {0,0,&_44u2__p2_0},
99     {0,0,&_44u2__p3_0},
100     {0,0,&_44u2__p4_0},
101     {0,0,&_44u2__p5_0},
102     {&_44u2__p6_0,&_44u2__p6_1},
103     {&_44u2__p7_0,&_44u2__p7_1,&_44u2__p7_2}
104    }
105 };
106 static const static_bookblock _resbook_44u_3={
107   {
108     {0},
109     {0,0,&_44u3__p1_0},
110     {0,0,&_44u3__p2_0},
111     {0,0,&_44u3__p3_0},
112     {0,0,&_44u3__p4_0},
113     {0,0,&_44u3__p5_0},
114     {&_44u3__p6_0,&_44u3__p6_1},
115     {&_44u3__p7_0,&_44u3__p7_1,&_44u3__p7_2}
116    }
117 };
118 static const static_bookblock _resbook_44u_4={
119   {
120     {0},
121     {0,0,&_44u4__p1_0},
122     {0,0,&_44u4__p2_0},
123     {0,0,&_44u4__p3_0},
124     {0,0,&_44u4__p4_0},
125     {0,0,&_44u4__p5_0},
126     {&_44u4__p6_0,&_44u4__p6_1},
127     {&_44u4__p7_0,&_44u4__p7_1,&_44u4__p7_2}
128    }
129 };
130 static const static_bookblock _resbook_44u_5={
131   {
132     {0},
133     {0,0,&_44u5__p1_0},
134     {0,0,&_44u5__p2_0},
135     {0,0,&_44u5__p3_0},
136     {0,0,&_44u5__p4_0},
137     {0,0,&_44u5__p5_0},
138     {0,0,&_44u5__p6_0},
139     {&_44u5__p7_0,&_44u5__p7_1},
140     {&_44u5__p8_0,&_44u5__p8_1},
141     {&_44u5__p9_0,&_44u5__p9_1,&_44u5__p9_2}
142    }
143 };
144 static const static_bookblock _resbook_44u_6={
145   {
146     {0},
147     {0,0,&_44u6__p1_0},
148     {0,0,&_44u6__p2_0},
149     {0,0,&_44u6__p3_0},
150     {0,0,&_44u6__p4_0},
151     {0,0,&_44u6__p5_0},
152     {0,0,&_44u6__p6_0},
153     {&_44u6__p7_0,&_44u6__p7_1},
154     {&_44u6__p8_0,&_44u6__p8_1},
155     {&_44u6__p9_0,&_44u6__p9_1,&_44u6__p9_2}
156    }
157 };
158 static const static_bookblock _resbook_44u_7={
159   {
160     {0},
161     {0,0,&_44u7__p1_0},
162     {0,0,&_44u7__p2_0},
163     {0,0,&_44u7__p3_0},
164     {0,0,&_44u7__p4_0},
165     {0,0,&_44u7__p5_0},
166     {0,0,&_44u7__p6_0},
167     {&_44u7__p7_0,&_44u7__p7_1},
168     {&_44u7__p8_0,&_44u7__p8_1},
169     {&_44u7__p9_0,&_44u7__p9_1,&_44u7__p9_2}
170    }
171 };
172 static const static_bookblock _resbook_44u_8={
173   {
174     {0},
175     {0,0,&_44u8_p1_0},
176     {0,0,&_44u8_p2_0},
177     {0,0,&_44u8_p3_0},
178     {0,0,&_44u8_p4_0},
179     {&_44u8_p5_0,&_44u8_p5_1},
180     {&_44u8_p6_0,&_44u8_p6_1},
181     {&_44u8_p7_0,&_44u8_p7_1},
182     {&_44u8_p8_0,&_44u8_p8_1},
183     {&_44u8_p9_0,&_44u8_p9_1,&_44u8_p9_2}
184    }
185 };
186 static const static_bookblock _resbook_44u_9={
187   {
188     {0},
189     {0,0,&_44u9_p1_0},
190     {0,0,&_44u9_p2_0},
191     {0,0,&_44u9_p3_0},
192     {0,0,&_44u9_p4_0},
193     {&_44u9_p5_0,&_44u9_p5_1},
194     {&_44u9_p6_0,&_44u9_p6_1},
195     {&_44u9_p7_0,&_44u9_p7_1},
196     {&_44u9_p8_0,&_44u9_p8_1},
197     {&_44u9_p9_0,&_44u9_p9_1,&_44u9_p9_2}
198    }
199 };
200
201 static const vorbis_residue_template _res_44u_n1[]={
202   {1,0,32,  &_residue_44_low_un,
203    &_huff_book__44un1__short,&_huff_book__44un1__short,
204    &_resbook_44u_n1,&_resbook_44u_n1},
205
206   {1,0,32,  &_residue_44_low_un,
207    &_huff_book__44un1__long,&_huff_book__44un1__long,
208    &_resbook_44u_n1,&_resbook_44u_n1}
209 };
210 static const vorbis_residue_template _res_44u_0[]={
211   {1,0,16,  &_residue_44_low_un,
212    &_huff_book__44u0__short,&_huff_book__44u0__short,
213    &_resbook_44u_0,&_resbook_44u_0},
214
215   {1,0,32,  &_residue_44_low_un,
216    &_huff_book__44u0__long,&_huff_book__44u0__long,
217    &_resbook_44u_0,&_resbook_44u_0}
218 };
219 static const vorbis_residue_template _res_44u_1[]={
220   {1,0,16,  &_residue_44_low_un,
221    &_huff_book__44u1__short,&_huff_book__44u1__short,
222    &_resbook_44u_1,&_resbook_44u_1},
223
224   {1,0,32,  &_residue_44_low_un,
225    &_huff_book__44u1__long,&_huff_book__44u1__long,
226    &_resbook_44u_1,&_resbook_44u_1}
227 };
228 static const vorbis_residue_template _res_44u_2[]={
229   {1,0,16,  &_residue_44_low_un,
230    &_huff_book__44u2__short,&_huff_book__44u2__short,
231    &_resbook_44u_2,&_resbook_44u_2},
232
233   {1,0,32,  &_residue_44_low_un,
234    &_huff_book__44u2__long,&_huff_book__44u2__long,
235    &_resbook_44u_2,&_resbook_44u_2}
236 };
237 static const vorbis_residue_template _res_44u_3[]={
238   {1,0,16,  &_residue_44_low_un,
239    &_huff_book__44u3__short,&_huff_book__44u3__short,
240    &_resbook_44u_3,&_resbook_44u_3},
241
242   {1,0,32,  &_residue_44_low_un,
243    &_huff_book__44u3__long,&_huff_book__44u3__long,
244    &_resbook_44u_3,&_resbook_44u_3}
245 };
246 static const vorbis_residue_template _res_44u_4[]={
247   {1,0,16,  &_residue_44_low_un,
248    &_huff_book__44u4__short,&_huff_book__44u4__short,
249    &_resbook_44u_4,&_resbook_44u_4},
250
251   {1,0,32,  &_residue_44_low_un,
252    &_huff_book__44u4__long,&_huff_book__44u4__long,
253    &_resbook_44u_4,&_resbook_44u_4}
254 };
255
256 static const vorbis_residue_template _res_44u_5[]={
257   {1,0,16,  &_residue_44_mid_un,
258    &_huff_book__44u5__short,&_huff_book__44u5__short,
259    &_resbook_44u_5,&_resbook_44u_5},
260
261   {1,0,32,  &_residue_44_mid_un,
262    &_huff_book__44u5__long,&_huff_book__44u5__long,
263    &_resbook_44u_5,&_resbook_44u_5}
264 };
265
266 static const vorbis_residue_template _res_44u_6[]={
267   {1,0,16,  &_residue_44_mid_un,
268    &_huff_book__44u6__short,&_huff_book__44u6__short,
269    &_resbook_44u_6,&_resbook_44u_6},
270
271   {1,0,32,  &_residue_44_mid_un,
272    &_huff_book__44u6__long,&_huff_book__44u6__long,
273    &_resbook_44u_6,&_resbook_44u_6}
274 };
275
276 static const vorbis_residue_template _res_44u_7[]={
277   {1,0,16,  &_residue_44_mid_un,
278    &_huff_book__44u7__short,&_huff_book__44u7__short,
279    &_resbook_44u_7,&_resbook_44u_7},
280
281   {1,0,32,  &_residue_44_mid_un,
282    &_huff_book__44u7__long,&_huff_book__44u7__long,
283    &_resbook_44u_7,&_resbook_44u_7}
284 };
285
286 static const vorbis_residue_template _res_44u_8[]={
287   {1,0,16,  &_residue_44_hi_un,
288    &_huff_book__44u8__short,&_huff_book__44u8__short,
289    &_resbook_44u_8,&_resbook_44u_8},
290
291   {1,0,32,  &_residue_44_hi_un,
292    &_huff_book__44u8__long,&_huff_book__44u8__long,
293    &_resbook_44u_8,&_resbook_44u_8}
294 };
295 static const vorbis_residue_template _res_44u_9[]={
296   {1,0,16,  &_residue_44_hi_un,
297    &_huff_book__44u9__short,&_huff_book__44u9__short,
298    &_resbook_44u_9,&_resbook_44u_9},
299
300   {1,0,32,  &_residue_44_hi_un,
301    &_huff_book__44u9__long,&_huff_book__44u9__long,
302    &_resbook_44u_9,&_resbook_44u_9}
303 };
304
305 static const vorbis_mapping_template _mapres_template_44_uncoupled[]={
306   { _map_nominal_u, _res_44u_n1 }, /* -1 */
307   { _map_nominal_u, _res_44u_0 }, /* 0 */
308   { _map_nominal_u, _res_44u_1 }, /* 1 */
309   { _map_nominal_u, _res_44u_2 }, /* 2 */
310   { _map_nominal_u, _res_44u_3 }, /* 3 */
311   { _map_nominal_u, _res_44u_4 }, /* 4 */
312   { _map_nominal_u, _res_44u_5 }, /* 5 */
313   { _map_nominal_u, _res_44u_6 }, /* 6 */
314   { _map_nominal_u, _res_44u_7 }, /* 7 */
315   { _map_nominal_u, _res_44u_8 }, /* 8 */
316   { _map_nominal_u, _res_44u_9 }, /* 9 */
317 };