tweak the management setup to go lower; needed for spahm/applaud to behave
[platform/upstream/libvorbis.git] / lib / modes / residue_44.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-2001             *
9  * by the XIPHOPHORUS Company http://www.xiph.org/                  *
10  *                                                                  *
11  ********************************************************************
12
13  function: toplevel residue templates for 32/44.1/48kHz
14  last mod: $Id: residue_44.h,v 1.12 2002/06/28 22:19:54 xiphmont Exp $
15
16  ********************************************************************/
17
18 #include "vorbis/codec.h"
19 #include "backends.h"
20 #include "books/coupled/res_books_44c.h"
21
22 /***** residue backends *********************************************/
23
24 /* the books used depend on stereo-or-not, but the residue setup below
25    can apply to coupled or not.  These templates are for a first pass;
26    a last pass is mechanically added in vorbisenc for residue backfill
27    at 1/3 and 1/9, as well as an optional middle pass for stereo
28    backfill */
29
30
31 static vorbis_info_residue0 _residue_44_mid={
32   0,-1, -1, 10,-1,
33   /*  0     1     2     3     4     5     6     7     8  */
34   {0},
35   {-1},
36   {  .5,  1.5,  1.5,  2.5,  2.5,  4.5,  8.5,  16.5, 32.5},
37   {  .5,   .5, 999.,   .5,  999., 4.5,  8.5,  16.5, 32.5},
38 };
39
40 static vorbis_info_residue0 _residue_44_high={
41   0,-1, -1, 10,-1,
42   /*  0     1     2     3     4     5     6     7     8  */
43   {0},
44   {-1},
45   {  .5,  1.5,  2.5,  4.5,  8.5, 16.5, 32.5, 71.5,157.5},
46   {  .5,  1.5,  2.5,  3.5,  4.5,  8.5, 16.5, 71.5,157.5},
47 };
48
49 /* mapping conventions:
50    only one submap (this would change for efficient 5.1 support for example)*/
51 /* Four psychoacoustic profiles are used, one for each blocktype */
52 static vorbis_info_mapping0 _map_nominal[2]={
53   {1, {0,0}, {0}, {0}, 1,{0},{1}},
54   {1, {0,0}, {1}, {1}, 1,{0},{1}}
55 };
56
57 static static_bookblock _resbook_44s_0={
58   {
59     {0},{0,0,&_44c0_s_p1_0},{0,0,&_44c0_s_p2_0},{0,0,&_44c0_s_p3_0},
60     {0,0,&_44c0_s_p4_0},{0,0,&_44c0_s_p5_0},{0,0,&_44c0_s_p6_0},
61     {&_44c0_s_p7_0,&_44c0_s_p7_1},{&_44c0_s_p8_0,&_44c0_s_p8_1},
62     {&_44c0_s_p9_0,&_44c0_s_p9_1,&_44c0_s_p9_2}
63    }
64 };
65 static static_bookblock _resbook_44sm_0={
66   {
67     {0},{0,0,&_44c0_sm_p1_0},{0,0,&_44c0_sm_p2_0},{0,0,&_44c0_sm_p3_0},
68     {0,0,&_44c0_sm_p4_0},{0,0,&_44c0_sm_p5_0},{0,0,&_44c0_sm_p6_0},
69     {&_44c0_sm_p7_0,&_44c0_sm_p7_1},{&_44c0_sm_p8_0,&_44c0_sm_p8_1},
70     {&_44c0_sm_p9_0,&_44c0_sm_p9_1,&_44c0_sm_p9_2}
71    }
72 };
73 static static_bookblock _resbook_44s_1={
74   {
75     {0},{0,0,&_44c1_s_p1_0},{0,0,&_44c1_s_p2_0},{0,0,&_44c1_s_p3_0},
76     {0,0,&_44c1_s_p4_0},{0,0,&_44c1_s_p5_0},{0,0,&_44c1_s_p6_0},
77     {&_44c1_s_p7_0,&_44c1_s_p7_1},{&_44c1_s_p8_0,&_44c1_s_p8_1},
78     {&_44c1_s_p9_0,&_44c1_s_p9_1,&_44c1_s_p9_2}
79    }
80 };
81 static static_bookblock _resbook_44sm_1={
82   {
83     {0},{0,0,&_44c1_sm_p1_0},{0,0,&_44c1_sm_p2_0},{0,0,&_44c1_sm_p3_0},
84     {0,0,&_44c1_sm_p4_0},{0,0,&_44c1_sm_p5_0},{0,0,&_44c1_sm_p6_0},
85     {&_44c1_sm_p7_0,&_44c1_sm_p7_1},{&_44c1_sm_p8_0,&_44c1_sm_p8_1},
86     {&_44c1_sm_p9_0,&_44c1_sm_p9_1,&_44c1_sm_p9_2}
87    }
88 };
89 static static_bookblock _resbook_44s_2={
90   {
91     {0},{0,0,&_44c2_s_p1_0},{0,0,&_44c2_s_p2_0},{0,0,&_44c2_s_p3_0},
92     {0,0,&_44c2_s_p4_0},{0,0,&_44c2_s_p5_0},{0,0,&_44c2_s_p6_0},
93     {&_44c2_s_p7_0,&_44c2_s_p7_1},{&_44c2_s_p8_0,&_44c2_s_p8_1},
94     {&_44c2_s_p9_0,&_44c2_s_p9_1,&_44c2_s_p9_2}
95    }
96 };
97 static static_bookblock _resbook_44s_3={
98   {
99     {0},{0,0,&_44c3_s_p1_0},{0,0,&_44c3_s_p2_0},{0,0,&_44c3_s_p3_0},
100     {0,0,&_44c3_s_p4_0},{0,0,&_44c3_s_p5_0},{0,0,&_44c3_s_p6_0},
101     {&_44c3_s_p7_0,&_44c3_s_p7_1},{&_44c3_s_p8_0,&_44c3_s_p8_1},
102     {&_44c3_s_p9_0,&_44c3_s_p9_1,&_44c3_s_p9_2}
103    }
104 };
105 static static_bookblock _resbook_44s_4={
106   {
107     {0},{0,0,&_44c4_s_p1_0},{0,0,&_44c4_s_p2_0},{0,0,&_44c4_s_p3_0},
108     {0,0,&_44c4_s_p4_0},{0,0,&_44c4_s_p5_0},{0,0,&_44c4_s_p6_0},
109     {&_44c4_s_p7_0,&_44c4_s_p7_1},{&_44c4_s_p8_0,&_44c4_s_p8_1},
110     {&_44c4_s_p9_0,&_44c4_s_p9_1,&_44c4_s_p9_2}
111    }
112 };
113 static static_bookblock _resbook_44s_5={
114   {
115     {0},{0,0,&_44c5_s_p1_0},{0,0,&_44c5_s_p2_0},{0,0,&_44c5_s_p3_0},
116     {0,0,&_44c5_s_p4_0},{0,0,&_44c5_s_p5_0},{0,0,&_44c5_s_p6_0},
117     {&_44c5_s_p7_0,&_44c5_s_p7_1},{&_44c5_s_p8_0,&_44c5_s_p8_1},
118     {&_44c5_s_p9_0,&_44c5_s_p9_1,&_44c5_s_p9_2}
119    }
120 };
121 static static_bookblock _resbook_44s_6={
122   {
123     {0},{0,0,&_44c6_s_p1_0},{0,0,&_44c6_s_p2_0},{0,0,&_44c6_s_p3_0},
124     {0,0,&_44c6_s_p4_0},
125     {&_44c6_s_p5_0,&_44c6_s_p5_1},
126     {&_44c6_s_p6_0,&_44c6_s_p6_1},
127     {&_44c6_s_p7_0,&_44c6_s_p7_1},
128     {&_44c6_s_p8_0,&_44c6_s_p8_1},
129     {&_44c6_s_p9_0,&_44c6_s_p9_1,&_44c6_s_p9_2}
130    }
131 };
132 static static_bookblock _resbook_44s_7={
133   {
134     {0},{0,0,&_44c7_s_p1_0},{0,0,&_44c7_s_p2_0},{0,0,&_44c7_s_p3_0},
135     {0,0,&_44c7_s_p4_0},
136     {&_44c7_s_p5_0,&_44c7_s_p5_1},
137     {&_44c7_s_p6_0,&_44c7_s_p6_1},
138     {&_44c7_s_p7_0,&_44c7_s_p7_1},
139     {&_44c7_s_p8_0,&_44c7_s_p8_1},
140     {&_44c7_s_p9_0,&_44c7_s_p9_1,&_44c7_s_p9_2}
141    }
142 };
143 static static_bookblock _resbook_44s_8={
144   {
145     {0},{0,0,&_44c8_s_p1_0},{0,0,&_44c8_s_p2_0},{0,0,&_44c8_s_p3_0},
146     {0,0,&_44c8_s_p4_0},
147     {&_44c8_s_p5_0,&_44c8_s_p5_1},
148     {&_44c8_s_p6_0,&_44c8_s_p6_1},
149     {&_44c8_s_p7_0,&_44c8_s_p7_1},
150     {&_44c8_s_p8_0,&_44c8_s_p8_1},
151     {&_44c8_s_p9_0,&_44c8_s_p9_1,&_44c8_s_p9_2}
152    }
153 };
154 static static_bookblock _resbook_44s_9={
155   {
156     {0},{0,0,&_44c9_s_p1_0},{0,0,&_44c9_s_p2_0},{0,0,&_44c9_s_p3_0},
157     {0,0,&_44c9_s_p4_0},
158     {&_44c9_s_p5_0,&_44c9_s_p5_1},
159     {&_44c9_s_p6_0,&_44c9_s_p6_1},
160     {&_44c9_s_p7_0,&_44c9_s_p7_1},
161     {&_44c9_s_p8_0,&_44c9_s_p8_1},
162     {&_44c9_s_p9_0,&_44c9_s_p9_1,&_44c9_s_p9_2}
163    }
164 };
165
166
167 static vorbis_residue_template _res_44s_0[]={
168   {2,0,  &_residue_44_mid,
169    &_huff_book__44c0_s_short,&_huff_book__44c0_sm_short,
170    &_resbook_44s_0,&_resbook_44sm_0},
171
172   {2,0,  &_residue_44_mid,
173    &_huff_book__44c0_s_long,&_huff_book__44c0_sm_long,
174    &_resbook_44s_0,&_resbook_44sm_0}
175 };
176 static vorbis_residue_template _res_44s_1[]={
177   {2,0,  &_residue_44_mid,
178    &_huff_book__44c1_s_short,&_huff_book__44c1_sm_short,
179    &_resbook_44s_1,&_resbook_44sm_1},
180
181   {2,0,  &_residue_44_mid,
182    &_huff_book__44c1_s_long,&_huff_book__44c1_sm_long,
183    &_resbook_44s_1,&_resbook_44sm_1}
184 };
185 static vorbis_residue_template _res_44s_2[]={
186   {2,0,  &_residue_44_mid,
187    &_huff_book__44c2_s_short,&_huff_book__44c2_sm_short,
188    &_resbook_44s_2,&_resbook_44s_2},
189
190   {2,0,  &_residue_44_mid,
191    &_huff_book__44c2_s_long,&_huff_book__44c2_sm_long,
192    &_resbook_44s_2,&_resbook_44s_2}
193 };
194 static vorbis_residue_template _res_44s_3[]={
195   {2,0,  &_residue_44_mid,
196    &_huff_book__44c3_s_short,&_huff_book__44c3_sm_short,
197    &_resbook_44s_3,&_resbook_44s_3},
198
199   {2,0,  &_residue_44_mid,
200    &_huff_book__44c3_s_long,&_huff_book__44c3_sm_long,
201    &_resbook_44s_3,&_resbook_44s_3}
202 };
203 static vorbis_residue_template _res_44s_4[]={
204   {2,0,  &_residue_44_mid,
205    &_huff_book__44c4_s_short,&_huff_book__44c4_sm_short,
206    &_resbook_44s_4,&_resbook_44s_4},
207
208   {2,0,  &_residue_44_mid,
209    &_huff_book__44c4_s_long,&_huff_book__44c4_sm_long,
210    &_resbook_44s_4,&_resbook_44s_4}
211 };
212 static vorbis_residue_template _res_44s_5[]={
213   {2,0,  &_residue_44_mid,
214    &_huff_book__44c5_s_short,&_huff_book__44c5_sm_short,
215    &_resbook_44s_5,&_resbook_44s_5},
216
217   {2,0,  &_residue_44_mid,
218    &_huff_book__44c5_s_long,&_huff_book__44c5_sm_long,
219    &_resbook_44s_5,&_resbook_44s_5}
220 };
221 static vorbis_residue_template _res_44s_6[]={
222   {2,0,  &_residue_44_high,
223    &_huff_book__44c6_s_short,&_huff_book__44c6_sm_short,
224    &_resbook_44s_6,&_resbook_44s_6},
225
226   {2,0,  &_residue_44_high,
227    &_huff_book__44c6_s_long,&_huff_book__44c6_sm_long,
228    &_resbook_44s_6,&_resbook_44s_6}
229 };
230 static vorbis_residue_template _res_44s_7[]={
231   {2,0,  &_residue_44_high,
232    &_huff_book__44c7_s_short,&_huff_book__44c7_sm_short,
233    &_resbook_44s_7,&_resbook_44s_7},
234
235   {2,0,  &_residue_44_high,
236    &_huff_book__44c7_s_long,&_huff_book__44c7_sm_long,
237    &_resbook_44s_7,&_resbook_44s_7}
238 };
239 static vorbis_residue_template _res_44s_8[]={
240   {2,0,  &_residue_44_high,
241    &_huff_book__44c8_s_short,&_huff_book__44c8_sm_short,
242    &_resbook_44s_8,&_resbook_44s_8},
243
244   {2,0,  &_residue_44_high,
245    &_huff_book__44c8_s_long,&_huff_book__44c8_sm_long,
246    &_resbook_44s_8,&_resbook_44s_8}
247 };
248 static vorbis_residue_template _res_44s_9[]={
249   {2,0,  &_residue_44_high,
250    &_huff_book__44c9_s_short,&_huff_book__44c9_sm_short,
251    &_resbook_44s_9,&_resbook_44s_9},
252
253   {2,0,  &_residue_44_high,
254    &_huff_book__44c9_s_long,&_huff_book__44c9_sm_long,
255    &_resbook_44s_9,&_resbook_44s_9}
256 };
257
258
259 static vorbis_mapping_template _mapres_template_44_stereo[]={
260   { _map_nominal, _res_44s_0 }, /* 0 */
261   { _map_nominal, _res_44s_1 }, /* 1 */
262   { _map_nominal, _res_44s_2 }, /* 2 */
263   { _map_nominal, _res_44s_3 }, /* 3 */
264   { _map_nominal, _res_44s_4 }, /* 4 */
265   { _map_nominal, _res_44s_5 }, /* 5 */
266   { _map_nominal, _res_44s_6 }, /* 6 */
267   { _map_nominal, _res_44s_7 }, /* 7 */
268   { _map_nominal, _res_44s_8 }, /* 8 */
269   { _map_nominal, _res_44s_9 }, /* 9 */
270 };