books for mono
[platform/upstream/libvorbis.git] / lib / modes / mode_Zc.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_Zc.h,v 1.2 2001/08/13 01:37:14 xiphmont Exp $
15
16  ********************************************************************/
17
18 #ifndef _V_MODES_Zc_H_
19 #define _V_MODES_Zc_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_8.vqh"
62 #include "books/res0_128_1024_9.vqh"
63 #include "books/res0_128_1024_9a.vqh"
64 #include "books/res0_128_1024_9b.vqh"
65
66
67 static vorbis_info_psy_global _psy_set_ZcG={
68   0, /* decaydBpms */
69   8,   /* lines per eighth octave */
70   
71   /* thresh sample period, preecho clamp trigger threshhold, range, minenergy */
72   256, {26.f,26.f,26.f,30.f}, {-90.f,-90.f,-90.f,-90.f}, -90.f,
73   -6.f, 
74   
75   0,
76 };
77
78 static struct vp_couple_pass _psy_passZc0[]={
79   {1.f,1.f,
80     {{24,    0,0,       0,0,      0,0},
81      {9999,  0,0,   7.5f,12,  7.5f,0}}
82   },
83 };
84
85 static vp_couple_pass _psy_passZc[]={
86   {1.f,1.f,
87     {{288,   0,0,       0,0,      0,0},
88      {9999,  0,0,   7.5f,12,  7.5f,0}}
89   }
90 };
91
92 static vp_attenblock _vp_tonemask_consbass_Zc={
93   {{-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f,-110.f}, /*63*/
94   {-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f,-110.f}, /*88*/
95   {-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f,-110.f}, /*125*/
96   {-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f,-110.f}, /*175*/
97   {-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f,-110.f}, /*250*/
98   {-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f,-110.f}, /*350*/
99
100   {-35.f,-35.f,-35.f,-45.f,-45.f,-55.f,-65.f,-75.f,-85.f,-95.f,-105.f}, /*500*/
101   {-35.f,-35.f,-35.f,-45.f,-45.f,-55.f,-65.f,-75.f,-85.f,-95.f,-105.f}, /*700*/
102
103   {-35.f,-35.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*1000*/
104   {-35.f,-35.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*1400*/
105
106   {-30.f,-30.f,-30.f,-30.f,-30.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f}, /*2000*/
107   {-30.f,-30.f,-30.f,-30.f,-30.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f}, 
108   {-30.f,-30.f,-30.f,-30.f,-30.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f}, /*2000*/
109   {-30.f,-30.f,-30.f,-30.f,-30.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f}, 
110   {-30.f,-30.f,-30.f,-30.f,-30.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f}, /*2000*/
111   {-30.f,-30.f,-30.f,-30.f,-30.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f}, 
112   {-24.f,-24.f,-26.f,-30.f,-30.f,-35.f,-45.f,-55.f,-65.f,-75.f,-90.f}, /*16000*/
113 }};
114
115 static vp_attenblock _vp_tonemask_Zc={
116
117   {{-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*63*/
118   {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*88*/
119   {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*125*/
120   
121   
122   {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*175*/
123   {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*250*/
124   {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*350*/
125   {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*500*/
126   {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*700*/
127   {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*1000*/
128   {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*1400*/
129
130
131   {-30.f,-30.f,-30.f,-30.f,-30.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f}, /*2000*/
132   {-30.f,-30.f,-30.f,-30.f,-30.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f}, 
133   {-30.f,-30.f,-30.f,-30.f,-30.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f}, /*2000*/
134   {-30.f,-30.f,-30.f,-30.f,-30.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f}, 
135   {-30.f,-30.f,-30.f,-30.f,-30.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f}, /*2000*/
136   {-30.f,-30.f,-30.f,-30.f,-30.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f}, 
137   {-24.f,-24.f,-26.f,-30.f,-30.f,-35.f,-45.f,-55.f,-65.f,-75.f,-90.f}, /*16000*/
138
139 }};
140
141 static vp_attenblock _vp_peakatt_Zc={
142   {{-14.f,-16.f,-18.f,-19.f,-24.f,-24.f,-24.f,-24.f,-24.f,-24.f,-24.f},/*63*/
143    {-14.f,-16.f,-18.f,-19.f,-24.f,-24.f,-24.f,-24.f,-24.f,-24.f,-24.f},/*88*/
144    {-14.f,-16.f,-18.f,-19.f,-24.f,-24.f,-24.f,-24.f,-24.f,-24.f,-24.f},/*125*/
145    {-14.f,-16.f,-18.f,-19.f,-24.f,-24.f,-24.f,-24.f,-24.f,-24.f,-24.f},/*125*/
146    {-14.f,-16.f,-18.f,-19.f,-24.f,-24.f,-24.f,-24.f,-24.f,-24.f,-24.f},/*125*/
147    {-14.f,-16.f,-18.f,-19.f,-24.f,-24.f,-24.f,-24.f,-24.f,-24.f,-24.f},/*125*/
148    {-10.f,-10.f,-10.f,-10.f,-16.f,-16.f,-18.f,-20.f,-22.f,-24.f,-24.f},/*500*/
149    {-10.f,-10.f,-10.f,-10.f,-14.f,-14.f,-16.f,-20.f,-22.f,-24.f,-24.f},/*700*/
150    {-10.f,-10.f,-10.f,-10.f,-14.f,-14.f,-16.f,-20.f,-22.f,-24.f,-24.f},/*1000*/
151    {-10.f,-10.f,-10.f,-10.f,-14.f,-14.f,-16.f,-20.f,-22.f,-24.f,-24.f},/*1400*/
152    {-10.f,-10.f,-10.f,-10.f,-14.f,-14.f,-16.f,-20.f,-22.f,-24.f,-24.f},/*2000*/
153    {-10.f,-10.f,-10.f,-12.f,-16.f,-16.f,-16.f,-20.f,-22.f,-24.f,-24.f},/*2400*/
154    {-10.f,-10.f,-10.f,-12.f,-16.f,-16.f,-16.f,-20.f,-22.f,-24.f,-24.f},/*4000*/
155    {-10.f,-10.f,-10.f,-12.f,-12.f,-14.f,-16.f,-18.f,-22.f,-24.f,-24.f},/*5600*/
156    {-10.f,-10.f,-10.f,-10.f,-10.f,-14.f,-16.f,-18.f,-22.f,-24.f,-24.f},/*8000*/
157    {-10.f,-10.f,-10.f,-10.f,-10.f,-14.f,-16.f,-18.f,-22.f,-24.f,-24.f},/*11500*/
158    {-10.f,-10.f,-10.f,-10.f,-10.f,-12.f,-16.f,-18.f,-22.f,-24.f,-24.f},/*16000*/
159 }};
160
161 static vorbis_info_psy _psy_set_Zc0={
162   ATH_Bark_dB_lineaggressive,
163
164   -100.,
165   -110.,
166
167   /* tonemaskp */
168   3.f, -24.f,&_vp_tonemask_consbass_Zc,
169
170   /* peakattp */
171   1, &_vp_peakatt_Zc,
172
173   /*noisemaskp */
174   1,-24.f,     /* suppress any noise curve over maxspec+n */
175   1.f, 1.f,   /* low/high window */
176   2, 2, -1,
177
178   /*63     125     250     500      1k      2k      4k       8k     16k*/
179   {-20,-20,-20,-20,-20,-20,-10, -5,  3,  3,  4,  4,  4,  4,  4,  4,  8},
180   {1.f,1.f,1.f,1.f,1.f,1.f,.8f,.7f,.7f,.7f,.7f,.7f,.8f,.88f,.89f,.9f,.9f},
181
182   95.f,  /* even decade + 5 is important; saves an rint() later in a
183             tight loop) */
184   1,
185   _psy_passZc0
186 };
187
188 static vorbis_info_psy _psy_set_ZcT={
189   ATH_Bark_dB_lineaggressive,
190
191   -100.f,
192   -110.f,
193
194   /* tonemask */
195   3.f,-20.f,&_vp_tonemask_consbass_Zc,
196   /* peakattp */
197   1,  &_vp_peakatt_Zc,
198
199   /*noisemaskp */
200   1,  -24.f,     /* suppress any noise curve over maxspec+n */
201       .5f,.5f,   /* low/high window */
202       10,10,100,
203
204   /*63     125     250     500      1k      2k      4k       8k     16k*/
205   {-20,-20,-20,-20,-20,-20,-20, -6,  3,  3,  4,  5,  5,   5,  5,  6, 10},
206   {1.f,1.f,1.f,1.f,1.f,1.f,.8f,.7f,.7f,.7f,.7f,.7f,.8f,.88f,.89f,.9f,.9f},
207
208   95.f,  /* even decade + 5 is important; saves an rint() later in a
209             tight loop) */
210   1,_psy_passZc
211 };
212
213 static vorbis_info_psy _psy_set_Zc={
214   ATH_Bark_dB_lineaggressive,
215
216   -100.f,
217   -110.f,
218
219   /* tonemask */
220   -3.f,-20.f,&_vp_tonemask_Zc,
221   /* peakattp */
222   1,  &_vp_peakatt_Zc,
223
224   /*noisemaskp */
225   1,  -24.f,     /* suppress any noise curve over maxspec+n */
226       .5f,.5f,   /* low/high window */
227       10,10,100,
228
229   /*63     125     250     500      1k      2k      4k       8k     16k*/
230   {-20,-20,-20,-20,-20,-20,-10,  0,  3,  3,  4,  5,  5,   5,  5,  6, 10},
231   {1.f,1.f,1.f,1.f,1.f,1.f,.8f,.7f,.7f,.7f,.7f,.8f,.85f,.88f,.89f,.9f,.9f},
232
233   95.f,  /* even decade + 5 is important; saves an rint() later in a
234             tight loop) */
235   1,_psy_passZc
236 };
237
238 /* with GNUisms, this could be short and readable. Oh well */
239 static vorbis_info_time0 _time_set0Zc={0};
240 /*static vorbis_info_floor0 _floor_set0Zc={9, 44100,  64, 10,130, 2, {0,1},
241   0.246f, .387f};*/
242 /*static vorbis_info_floor0 _floor_set1Zc={30, 44100, 256, 12,150, 2, {2,3}, 
243   .082f, .126f};*/
244
245 static vorbis_info_floor1 _floor_set0Zc={3,
246                                         {0,1,2},
247                                         
248                                         {1,3,3},
249                                         {0,2,2},
250                                         {-1,0,1},
251                                         {{2},{-1,3,4,5},{-1,6,7,8}},
252
253                                         4,
254
255                                         {0,128,  
256
257                                          7,
258
259                                          2,1,4,
260                                          23,13,45},
261
262                                         60,30,500,
263                                         999,999,0,18.,
264                                         8,70,
265                                         90};
266
267 static vorbis_info_floor1 _floor_set1Zc={10,
268                                         {0,1,2,2,2,2,2, 3,3,3},
269                                         
270                                         {3,4,3,3},
271                                         {1,1,2,2},
272                                         {9,10,11,12},
273                                         {{13,14},
274                                          {15,16},
275                                          {-1,17,18,19},
276                                          {-1,20,21,22},
277                                         },
278
279                                         4,
280                                         {0,1024,
281
282                                          88,31,243,
283
284                                          14,54,143,460,
285                                          
286                                          6,3,10, 22,18,26, 41,36,47, 
287                                          69,61,78, 112,99,126, 185,162,211,  
288                                          329,282,387, 672,553,825
289                                          },
290                                         
291                                         60,30,400,
292                                         20,8,1,18.,
293                                         20,600,
294                                         720};
295
296 static vorbis_info_residue0 _residue_set0Zc={0,180,12,10,23,
297                                              {0,1,1,1,1,1,1,1,1,7},
298                                              {25,
299                                               26,
300                                               27,
301                                               28,
302                                               29,
303                                               30,
304                                               31,
305                                               32,
306                                               33,34,35},
307                                              {9999,
308                                               9999,
309                                               9999,
310                                               9999,
311                                               2,9999,
312                                               9999,
313                                               9999,
314                                               9999,
315                                               9999},
316                                              {.5,
317                                               1.5,
318                                               2.5f,
319                                               7.5,
320                                               1.5f,
321                                               1.5,
322                                               2.5,
323                                               7.5,
324                                               22.5f},
325                                              {0},
326                                              {99,
327                                               4,
328                                               4,
329                                               4,
330                                               99,99,
331                                               99,
332                                               99,
333                                               99},
334                                             {3}};
335
336 static vorbis_info_residue0 _residue_set1Zc={0,1408, 32,10,24,
337                                              {0,1,1,1,1,1,1,1,1,7},
338                                              {25,
339                                               26,
340                                               27,
341                                               28,
342                                               29,
343                                               30,
344                                               31,
345                                               32,
346                                               33,34,35},
347                                              {9999,
348                                               9999,
349                                               9999,
350                                               9999,
351                                               3,9999,
352                                               9999,
353                                               9999,
354                                               9999,
355                                               9999},
356                                              {.5,
357                                               1.5,
358                                               2.5f,
359                                               7.5,
360                                               1.5f,
361                                               1.5,
362                                               2.5,
363                                               7.5,
364                                               22.5f},
365                                              {0},
366                                              {99,
367                                               18,
368                                               18,
369                                               18,
370                                               99,99,
371                                               99,
372                                               99,
373                                               99},
374                                             {3}};
375
376 static vorbis_info_mapping0 _mapping_set0Zc={1, {0,0}, {0}, {0}, {0}, {0,0},
377                                             1,{0},{1}};
378 static vorbis_info_mapping0 _mapping_set1Zc={1, {0,0}, {0}, {1}, {1}, {1,2},
379                                             1,{0},{1}};
380 static vorbis_info_mode _mode_set0Zc={0,0,0,0};
381 static vorbis_info_mode _mode_set1Zc={1,0,0,1};
382
383 /* CD quality stereo, no channel coupling */
384 codec_setup_info info_Zc={
385
386   /* smallblock, largeblock */
387   {256, 2048}, 
388   /* modes,maps,times,floors,residues,books,psys */
389   2,          2,    1,     2,       2,   36,   3,
390   /* modes */
391   {&_mode_set0Zc,&_mode_set1Zc},
392   /* maps */
393   {0,0},{&_mapping_set0Zc,&_mapping_set1Zc},
394   /* times */
395   {0,0},{&_time_set0Zc},
396   /* floors */
397   {1,1},{&_floor_set0Zc,&_floor_set1Zc},
398   /* residue */
399   {2,2},{&_residue_set0Zc,&_residue_set1Zc},
400   /* books */
401     
402   {  
403    &_huff_book_line0_class1,
404    &_huff_book_line0_class2, /* 1 */
405    
406    &_huff_book_line0_0sub0,  /* 2 */
407    &_huff_book_line0_1sub1,  /* 3 */
408    &_huff_book_line0_1sub2,
409    &_huff_book_line0_1sub3,  /* 5 */
410    &_huff_book_line0_2sub1,
411    &_huff_book_line0_2sub2,  /* 7 */
412    &_huff_book_line0_2sub3, 
413
414    &_huff_book_line1_class0,
415    &_huff_book_line1_class1, /* 10 */
416    &_huff_book_line1_class2,
417    &_huff_book_line1_class3, /* 12 */
418
419    &_huff_book_line1_0sub0,
420    &_huff_book_line1_0sub1, /* 14 */
421    &_huff_book_line1_1sub0, 
422    &_huff_book_line1_1sub1,
423    &_huff_book_line1_2sub1,  
424    &_huff_book_line1_2sub2, /* 18 */
425    &_huff_book_line1_2sub3, 
426    &_huff_book_line1_3sub1,
427    &_huff_book_line1_3sub2,
428    &_huff_book_line1_3sub3, /* 22 */
429
430    &_huff_book_res0_128_128aux, 
431    &_huff_book_res0_128_1024aux,
432
433    &_vq_book_res0_128_1024_1,
434    &_vq_book_res0_128_1024_2,
435    &_vq_book_res0_128_1024_3,
436    &_vq_book_res0_128_1024_4,
437    &_vq_book_res0_128_1024_5,
438    &_vq_book_res0_128_1024_6,
439    &_vq_book_res0_128_1024_7,
440    &_vq_book_res0_128_1024_8,
441    &_vq_book_res0_128_1024_9,
442    &_vq_book_res0_128_1024_9a,
443    &_vq_book_res0_128_1024_9b,
444
445   },
446   /* psy */
447   {&_psy_set_Zc0,&_psy_set_ZcT,&_psy_set_Zc},
448   &_psy_set_ZcG
449 };
450
451 #endif