books for mono
[platform/upstream/libvorbis.git] / lib / modes / mode_A.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: predefined encoding modes
14  last mod: $Id: mode_A.h,v 1.18 2001/08/13 07:43:15 xiphmont Exp $
15
16  ********************************************************************/
17
18 #ifndef _V_MODES_A_H_
19 #define _V_MODES_A_H_
20
21 #include <stdio.h>
22 #include "vorbis/codec.h"
23 #include "backends.h"
24
25 #include "books/line0_class1.vqh"
26 #include "books/line0_class2.vqh"
27 #include "books/line1_class0.vqh"
28 #include "books/line1_class1.vqh"
29 #include "books/line1_class2.vqh"
30 #include "books/line1_class3.vqh"
31
32 #include "books/line0_0sub0.vqh"
33 #include "books/line0_1sub1.vqh"
34 #include "books/line0_1sub2.vqh"
35 #include "books/line0_1sub3.vqh"
36 #include "books/line0_2sub1.vqh"
37 #include "books/line0_2sub2.vqh"
38 #include "books/line0_2sub3.vqh"
39
40 #include "books/line1_0sub0.vqh"
41 #include "books/line1_0sub1.vqh"
42 #include "books/line1_1sub0.vqh"
43 #include "books/line1_1sub1.vqh"
44 #include "books/line1_2sub1.vqh"
45 #include "books/line1_2sub2.vqh"
46 #include "books/line1_2sub3.vqh"
47 #include "books/line1_3sub1.vqh"
48 #include "books/line1_3sub2.vqh"
49 #include "books/line1_3sub3.vqh"
50
51 #include "books/res0_128_128aux.vqh"
52 #include "books/res0_128_1024aux.vqh"
53
54 #include "books/res0_128_1024_1.vqh"
55 #include "books/res0_128_1024_2.vqh"
56 #include "books/res0_128_1024_3.vqh"
57 #include "books/res0_128_1024_4.vqh"
58 #include "books/res0_128_1024_5.vqh"
59 #include "books/res0_128_1024_6.vqh"
60 #include "books/res0_128_1024_7.vqh"
61 #include "books/res0_128_1024_7a.vqh"
62 #include "books/res0_128_1024_8.vqh"
63 #include "books/res0_128_1024_8a.vqh"
64 #include "books/res0_128_1024_9.vqh"
65 #include "books/res0_128_1024_9a.vqh"
66 #include "books/res0_128_1024_9b.vqh"
67
68
69 static vorbis_info_psy_global _psy_set_AG={
70   0, /* decaydBpms */
71   8,   /* lines per eighth octave */
72   
73   /* thresh sample period, preecho clamp trigger threshhold, range, minenergy */
74   256, {26.f,26.f,26.f,30.f}, {-90.f,-90.f,-90.f,-90.f}, -90.f,
75   -6.f, 
76   
77   0,
78 };
79
80 static struct vp_couple_pass _psy_passA0[]={
81   {1.f,1.f,
82     {{24,    0,0,       0,0,      0,0},
83      {64,    0,0,   12.5f,12,     0,0},
84      {9999,  0,0,   12.5f,12,  2.5f,0}}
85   },
86 };
87
88 static vp_couple_pass _psy_passA[]={
89   {1.f,1.f,
90     {{288,   0,0,       0,0,      0,0},
91      {512,   0,0,   12.5f,12,     0,0},
92      {9999,  0,0,   12.5f,12,  2.5f,0}}
93   }
94 };
95
96 static vp_attenblock _vp_tonemask_consbass_A={
97   {{-40.f,-40.f,-40.f,-45.f,-55.f,-65.f,-75.f,-85.f,-95.f,-105.f,-115.f}, /*63*/
98   {-40.f,-40.f,-40.f,-45.f,-55.f,-65.f,-75.f,-85.f,-95.f,-105.f,-115.f}, /*88*/
99   {-40.f,-40.f,-40.f,-45.f,-55.f,-65.f,-75.f,-85.f,-95.f,-105.f,-115.f}, /*125*/
100   {-40.f,-40.f,-40.f,-45.f,-55.f,-65.f,-75.f,-85.f,-95.f,-105.f,-115.f}, /*175*/
101   {-40.f,-40.f,-40.f,-45.f,-55.f,-65.f,-75.f,-85.f,-95.f,-105.f,-115.f}, /*250*/
102   {-40.f,-40.f,-40.f,-45.f,-55.f,-65.f,-75.f,-85.f,-95.f,-105.f,-115.f}, /*350*/
103   {-40.f,-40.f,-40.f,-45.f,-55.f,-65.f,-75.f,-85.f,-95.f,-105.f,-115.f}, /*500*/
104   {-40.f,-40.f,-40.f,-45.f,-55.f,-65.f,-75.f,-85.f,-95.f,-105.f,-115.f}, /*700*/
105   
106   {-35.f,-35.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*1000*/
107   {-35.f,-35.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*1400*/
108   {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*2000*/
109   {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*2800*/
110   {-35.f,-35.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*4000*/
111   {-35.f,-35.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*5600*/
112   
113   {-30.f,-30.f,-33.f,-35.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*8000*/
114   {-30.f,-30.f,-33.f,-35.f,-35.f,-45.f,-50.f,-60.f,-70.f,-90.f,-100.f}, /*11500*/
115   {-24.f,-24.f,-26.f,-32.f,-32.f,-42.f,-50.f,-60.f,-70.f,-90.f,-100.f}, /*16000*/
116 }};
117
118 static vp_attenblock _vp_tonemask_A={
119
120   {{-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*63*/
121   {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*88*/
122   {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*125*/
123   
124   
125   {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*175*/
126   {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*250*/
127   {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*350*/
128   {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*500*/
129   {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*700*/
130   {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*1000*/
131   {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*1400*/
132   {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*2000*/
133   {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*2800*/
134   {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*4000*/
135   
136   {-30.f,-35.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*5600*/
137   
138   {-30.f,-30.f,-33.f,-35.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*8000*/
139   {-30.f,-30.f,-33.f,-35.f,-40.f,-45.f,-50.f,-60.f,-70.f,-85.f,-100.f}, /*11500*/
140   {-24.f,-24.f,-26.f,-32.f,-32.f,-42.f,-50.f,-60.f,-70.f,-85.f,-100.f}, /*16000*/
141 }};
142
143 static vp_attenblock _vp_peakatt_A={
144   {{-14.f,-20.f,-20.f,-20.f,-26.f,-32.f,-32.f,-32.f,-32.f,-32.f,-40.f},/*63*/
145   {-14.f,-20.f,-20.f,-20.f,-26.f,-32.f,-32.f,-32.f,-32.f,-32.f,-40.f},/*88*/
146   {-14.f,-20.f,-20.f,-20.f,-26.f,-32.f,-32.f,-32.f,-32.f,-32.f,-40.f},/*125*/
147   {-14.f,-20.f,-20.f,-20.f,-26.f,-32.f,-32.f,-32.f,-32.f,-32.f,-40.f},/*175*/
148   {-14.f,-20.f,-20.f,-20.f,-26.f,-32.f,-32.f,-32.f,-32.f,-32.f,-40.f},/*250*/
149   {-14.f,-20.f,-20.f,-20.f,-26.f,-32.f,-32.f,-32.f,-32.f,-32.f,-40.f},/*350*/
150   {-14.f,-20.f,-20.f,-20.f,-26.f,-32.f,-32.f,-32.f,-32.f,-32.f,-40.f},/*500*/
151   {-10.f,-10.f,-10.f,-10.f,-14.f,-14.f,-14.f,-20.f,-26.f,-32.f,-40.f},/*700*/
152   {-10.f,-10.f,-10.f,-10.f,-14.f,-14.f,-14.f,-20.f,-22.f,-32.f,-40.f},/*1000*/
153   {-10.f,-10.f,-10.f,-10.f,-14.f,-14.f,-16.f,-20.f,-22.f,-32.f,-40.f},/*1400*/
154   {-10.f,-10.f,-10.f,-10.f,-14.f,-14.f,-16.f,-20.f,-22.f,-32.f,-40.f},/*2000*/
155   {-10.f,-10.f,-10.f,-10.f,-14.f,-14.f,-16.f,-20.f,-22.f,-32.f,-40.f},/*2400*/
156   {-10.f,-10.f,-10.f,-10.f,-14.f,-14.f,-16.f,-20.f,-22.f,-32.f,-40.f},/*4000*/
157   {-10.f,-10.f,-10.f,-10.f,-10.f,-11.f,-12.f,-13.f,-22.f,-32.f,-40.f},/*5600*/
158   {-10.f,-10.f,-10.f,-10.f,-10.f,-11.f,-12.f,-13.f,-22.f,-32.f,-40.f},/*8000*/
159   {-10.f,-10.f,-10.f,-10.f,-10.f,-10.f,-10.f,-11.f,-22.f,-32.f,-40.f},/*11500*/
160   {-10.f,-10.f,-10.f,-10.f,-10.f,-10.f,-10.f,-10.f,-20.f,-32.f,-40.f},/*16000*/
161 }};
162
163 static vorbis_info_psy _psy_set_A0={
164   ATH_Bark_dB_lineaggressive,
165
166   -100.,
167   -140.,
168
169   /* tonemaskp */
170   0.f, -40.f,&_vp_tonemask_consbass_A,
171
172   /* peakattp */
173   1, &_vp_peakatt_A,
174
175   1,/*noisemaskp */
176   -30.f,     /* suppress any noise curve over maxspec+n */
177   .6f, .6f,   /* low/high window */
178   5, 5, 10,
179
180   /*63     125     250     500      1k      2k      4k       8k     16k*/
181   {-30,-30,-30,-30,-30,-30,-20,-10,  0,  0,  0,  0,  0,  1,  1,  2,  3},
182   {.5f,.5f,.5f,.5f,.5f,.5f,.5f,.5f,.5f,.5f,.5f,.5f,.7f,.8f,.9f,.9f,.9f},
183
184   95.f,  /* even decade + 5 is important; saves an rint() later in a
185             tight loop) */
186   1,
187   _psy_passA0
188 };
189
190 static vorbis_info_psy _psy_set_A={
191   ATH_Bark_dB_lineaggressive,
192
193   -100.f,
194   -140.f,
195
196   /* tonemask */
197   0.f,-40.f,&_vp_tonemask_consbass_A,
198   /* peakattp */
199   1,  &_vp_peakatt_A,
200
201   /*noisemaskp */
202   1,  -30.f,     /* suppress any noise curve over maxspec+n */
203       .4f,.4f,   /* low/high window */
204       10,10,100,
205
206   /*63     125     250     500      1k      2k      4k       8k     16k*/
207   {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,   0,  0,  0,  0},
208   {.5f,.5f,.5f,.5f,.5f,.5f,.5f,.5f,.5f,.5f,.5f,.5f,.7f,.75f,.8f,.8f,.85f},
209
210   95.f,  /* even decade + 5 is important; saves an rint() later in a
211             tight loop) */
212   1,_psy_passA
213 };
214
215 static vorbis_info_psy _psy_set_AT={
216   ATH_Bark_dB_lineaggressive,
217
218   -100.f,
219   -140.f,
220
221   /* tonemask */
222   0.f,-40.f,&_vp_tonemask_consbass_A,
223   /* peakattp */
224   1,  &_vp_peakatt_A,
225
226   /*noisemaskp */
227   1,  -30.f,     /* suppress any noise curve over maxspec+n */
228       .4f,.4f,   /* low/high window */
229       10,10,100,
230
231   /*63     125     250     500      1k      2k      4k       8k     16k*/
232   {-30,-30,-30,-30,-30,-30,-30,-20,  0,  0,  0,  0,  0,   0,  0,  0,  0},
233   {.5f,.5f,.5f,.5f,.5f,.5f,.5f,.5f,.5f,.5f,.5f,.5f,.7f,.75f,.8f,.8f,.85f},
234
235   95.f,  /* even decade + 5 is important; saves an rint() later in a
236   1,_psy_passA
237 };
238
239 /* with GNUisms, this could be short and readable. Oh well */
240 static vorbis_info_time0 _time_set0A={0};
241
242 static vorbis_info_floor1 _floor_set0A={6,
243                                         {0,1,1,1,2,2},
244                                         
245                                         {4,3,3},
246                                         {0,2,2},
247                                         {-1,0,1},
248                                         {{2},{-1,3,4,5},{-1,6,7,8}},
249
250                                         4,
251
252                                         {0,128,  
253
254                                          6,17,30,58,
255                                          
256                                          2,1,4, 11,8,14, 23,20,26,
257                                          41,35,48, 84,69,103},
258
259                                         60,30,500,
260                                         999,999,1,18.,
261                                         8,70,
262                                         96};
263
264 static vorbis_info_floor1 _floor_set1A={10,
265                                         {0,1,2,2,2,2,2, 3,3,3},
266                                         
267                                         {3,4,3,3},
268                                         {1,1,2,2},
269                                         {9,10,11,12},
270                                         {{13,14},
271                                          {15,16},
272                                          {-1,17,18,19},
273                                          {-1,20,21,22},
274                                         },
275
276                                         2,
277                                         {0,1024,
278
279                                          88,31,243,
280
281                                          14,54,143,460,
282                                          
283                                          6,3,10, 22,18,26, 41,36,47, 
284                                          69,61,78, 112,99,126, 185,162,211,  
285                                          329,282,387, 672,553,825
286                                          },
287                                         
288                                         60,30,300,
289                                         20,8,1,18.,
290                                         20,600,
291                                         768};
292
293 static vorbis_info_residue0 _residue_set0A={0,192,8,10,23,
294                                             {0,1,1,1,1,1,1,3,3,7},
295                                             {25,
296                                              26,
297                                              27,
298                                              28,
299                                              29,
300                                              30,
301                                              31,32,
302                                              33,34,
303                                              35,36,37},
304                                             {9999,9999,9999,9999,9999,9999,
305                                              9999,9999,9999,9999},
306                                             {.5f,
307                                              1.5f,1.5f,
308                                              2.5f,2.5f,2.5f,
309                                              4.5f,17.5f,84.5f},
310                                             {0},
311                                             {99,16,99,6,16,99,99,99,99,99},
312                                             {3}};
313
314 static vorbis_info_residue0 _residue_set1A={0,1536, 32,10,24,
315                                             {0,1,1,1,1,1,1,3,3,7},
316                                             {25,
317                                              26,
318                                              27,
319                                              28,
320                                              29,
321                                              30,
322                                              31,32,
323                                              33,34,
324                                              35,36,37},
325                                             {9999,9999,9999,9999,9999,9999,
326                                              9999,9999,9999,9999},
327                                             {.5f,
328                                              1.5f,1.5f,
329                                              2.5f,2.5f,2.5f,
330                                              4.5f,17.5f,84.f},
331                                             {0},
332                                             {99,32,99,18,32,99,99,99,99,99},
333                                             {3}};
334
335 static vorbis_info_mapping0 _mapping_set0A={1, {0,0}, {0}, {0}, {0}, {0,0},
336                                             1,{0},{1}};
337 static vorbis_info_mapping0 _mapping_set1A={1, {0,0}, {0}, {1}, {1}, {1,2},
338                                             1,{0},{1}};
339 static vorbis_info_mode _mode_set0A={0,0,0,0};
340 static vorbis_info_mode _mode_set1A={1,0,0,1};
341
342 /* CD quality stereo, no channel coupling */
343 codec_setup_info info_A={
344
345   /* smallblock, largeblock */
346   {256, 2048}, 
347   /* modes,maps,times,floors,residues,books,psys */
348   2,          2,    1,     2,       2,   38,   3,
349   /* modes */
350   {&_mode_set0A,&_mode_set1A},
351   /* maps */
352   {0,0},{&_mapping_set0A,&_mapping_set1A},
353   /* times */
354   {0,0},{&_time_set0A},
355   /* floors */
356   {1,1},{&_floor_set0A,&_floor_set1A},
357   /* residue */
358   {2,2},{&_residue_set0A,&_residue_set1A},
359   /* books */
360     
361   {  
362    &_huff_book_line0_class1,
363    &_huff_book_line0_class2, /* 1 */
364    
365    &_huff_book_line0_0sub0,  /* 2 */
366    &_huff_book_line0_1sub1,  /* 3 */
367    &_huff_book_line0_1sub2,
368    &_huff_book_line0_1sub3,  /* 5 */
369    &_huff_book_line0_2sub1,
370    &_huff_book_line0_2sub2,  /* 7 */
371    &_huff_book_line0_2sub3, 
372
373    &_huff_book_line1_class0,
374    &_huff_book_line1_class1, /* 10 */
375    &_huff_book_line1_class2,
376    &_huff_book_line1_class3, /* 12 */
377
378    &_huff_book_line1_0sub0,
379    &_huff_book_line1_0sub1, /* 14 */
380    &_huff_book_line1_1sub0, 
381    &_huff_book_line1_1sub1,
382    &_huff_book_line1_2sub1,  
383    &_huff_book_line1_2sub2, /* 18 */
384    &_huff_book_line1_2sub3, 
385    &_huff_book_line1_3sub1,
386    &_huff_book_line1_3sub2,
387    &_huff_book_line1_3sub3, /* 22 */
388
389    &_huff_book_res0_128_128aux, 
390    &_huff_book_res0_128_1024aux,
391
392    &_vq_book_res0_128_1024_1,
393    &_vq_book_res0_128_1024_2,
394    &_vq_book_res0_128_1024_3,
395    &_vq_book_res0_128_1024_4,
396    &_vq_book_res0_128_1024_5,
397    &_vq_book_res0_128_1024_6,
398    &_vq_book_res0_128_1024_7,
399    &_vq_book_res0_128_1024_7a,
400    &_vq_book_res0_128_1024_8,
401    &_vq_book_res0_128_1024_8a,
402    &_vq_book_res0_128_1024_9,
403    &_vq_book_res0_128_1024_9a,
404    &_vq_book_res0_128_1024_9b,
405
406   },
407   /* psy */
408   {&_psy_set_A0,&_psy_set_AT,&_psy_set_A},
409   &_psy_set_AG
410 };
411
412 #endif