443aebbeffdd922ef305e9064ab3a65deba1ad31
[platform/upstream/libvorbis.git] / lib / modes / mode_D.h
1 /********************************************************************
2  *                                                                  *
3  * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
4  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
5  * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
6  * THIS SOURCE. 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_D.h,v 1.11 2001/02/15 19:06:02 xiphmont Exp $
15
16  ********************************************************************/
17
18 #ifndef _V_MODES_D_H_
19 #define _V_MODES_D_H_
20
21 #include <stdio.h>
22 #include "vorbis/codec.h"
23 #include "backends.h"
24
25 #include "books/lsp12_0.vqh"
26 #include "books/lsp30_0.vqh"
27 #include "books/lsp12_1.vqh"
28 #include "books/lsp30_1.vqh"
29
30 #include "books/res0_256_128aux.vqh"
31 #include "books/res0_256_1024aux.vqh"
32
33 #include "books/res0_256_128_1.vqh"
34 #include "books/res0_256_128_2.vqh"
35 #include "books/res0_256_128_3.vqh"
36 #include "books/res0_256_128_4.vqh"
37 #include "books/res0_256_128_5.vqh"
38
39 #include "books/res0_256_1024_1.vqh"
40 #include "books/res0_256_1024_2.vqh"
41 #include "books/res0_256_1024_3.vqh"
42 #include "books/res0_256_1024_4.vqh"
43 #include "books/res0_256_1024_5.vqh"
44 #include "books/res0_256_1024_6.vqh"
45 #include "books/res0_256_1024_7.vqh"
46
47
48 static vorbis_info_psy _psy_set_D0={
49   1,/*athp*/
50   0,/*decayp*/
51
52   -100.,
53   -140.,
54
55   8,
56
57   /*     0  1  2   3   4   5   6   7   8   9  10  11  12  13  14  15   16   */
58   /* x: 63 88 125 175 250 350 500 700 1k 1.4k 2k 2.8k 4k 5.6k 8k 11.5k 16k Hz */
59   /* y: 0 10 20 30 40 50 60 70 80 90 100 dB */
60
61    1,/* tonemaskp */
62   /*  0   10   20   30   40   50   60   70   80   90   100 */
63   {
64    {-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.}, /*63*/
65    {-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.}, /*88*/
66    {-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.}, /*125*/
67    {-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.}, /*175*/
68    {-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.}, /*250*/
69    {-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.}, /*350*/
70    {-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.}, /*500*/
71    {-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.}, /*700*/
72
73    {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*1000*/
74    {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*1400*/
75    {-40.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*2000*/
76    {-40.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*2800*/
77    {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*4000*/
78    {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*5600*/
79    {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*8000*/
80    {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*11500*/
81    {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*16000*/
82   },
83
84   1,/* peakattp */
85   {{-20.f,-20.f,-20.f,-20.f,-20.f,-21.f,-28.f,-28.f,-28.f,-28.f,-28.f},/*63*/
86    {-20.f,-20.f,-20.f,-20.f,-20.f,-21.f,-28.f,-28.f,-28.f,-28.f,-28.f},/*88*/
87    {-20.f,-20.f,-20.f,-20.f,-20.f,-21.f,-28.f,-28.f,-28.f,-28.f,-28.f},/*125*/
88    {-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-24.f,-28.f,-28.f,-28.f},/*175*/
89    {-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-24.f,-28.f,-28.f,-28.f},/*250*/
90    {-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-24.f,-28.f,-28.f,-28.f},/*350*/
91    {-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-24.f,-28.f,-28.f,-28.f},/*500*/
92    {-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-24.f,-28.f,-28.f,-28.f},/*700*/
93    {-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-24.f,-28.f,-28.f,-28.f},/*1000*/
94    {-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-24.f,-28.f,-28.f,-28.f},/*1400*/
95    {-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-24.f,-28.f,-28.f,-28.f},/*2000*/
96    {-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-24.f,-28.f,-28.f,-28.f},/*2800*/
97    {-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-24.f,-28.f,-28.f,-28.f},/*4000*/
98
99    {-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-28.f,-28.f,-28.f},/*5600*/
100    {-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-28.f,-28.f,-28.f},/*8000*/
101    {-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-28.f,-28.f,-28.f},/*11500*/
102    {-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-24.f,-28.f},/*16000*/
103   },
104
105   1,/*noisemaskp */
106   -15.f,  /* suppress any noise curve over maxspec+n */
107   .5f,   /* low window */
108   .5f,   /* high window */
109   5,
110   5,
111   {.000f, 0.f,/*63*/
112    .000f, 0.f,/*88*/
113    .000f, 0.f,/*125*/
114    .000f, 0.f,/*175*/
115    .000f, 0.f,/*250*/
116    .000f, 0.f,/*350*/
117    .000f, 0.f,/*500*/
118    .000f, 0.f,/*700*/
119    .000f,  0.f,/*1000*/
120    .000f,  0.f,/*1400*/
121    .000f,  0.f,/*2000*/
122    .600f, -6.f,/*2800*/
123    .600f, -6.f,/*4000*/
124    .700f, -6.f,/*5600*/
125    .850f, -6.f,/*8000*/
126    .850f, -5.f,/*11500*/
127    .850f, -4.f,/*16000*/
128   },
129
130   105.f,  /* even decade + 5 is important; saves an rint() later in a
131             tight loop) */
132   -30.,
133
134   -0., -.004   /* attack/decay control */
135 };
136
137 static vorbis_info_psy _psy_set_D={
138   1,/*athp*/
139   0,/*decayp*/
140
141   -100.f,
142   -140.f,
143
144   8,
145
146   /*     0  1  2   3   4   5   6   7   8   9  10  11  12  13  14  15   16   */
147   /* x: 63 88 125 175 250 350 500 700 1k 1.4k 2k 2.8k 4k 5.6k 8k 11.5k 16k Hz */
148   /* y: 0 10 20 30 40 50 60 70 80 90 100 dB */
149    1,/* tonemaskp */
150   /*  0   10   20   30   40   50   60   70   80   90   100 */
151   {
152    {-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f}, /*63*/
153    {-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f}, /*88*/
154    {-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f}, /*125*/
155    //   {-99.,-99.,-99.,-99.,-99.,-99.,-99.,-99.,-99.,-99.,-100.}, /*175*/
156    //   {-99.,-99.,-99.,-99.,-99.,-99.,-99.,-99.,-99.,-99.,-100.}, /*250*/
157    //   {-99.,-99.,-99.,-99.,-99.,-99.,-99.,-99.,-99.,-99.,-100.}, /*350*/
158    //   {-99.,-99.,-99.,-99.,-99.,-99.,-99.,-99.,-99.,-99.,-100.}, /*500*/
159    //   {-99.,-99.,-99.,-99.,-99.,-99.,-99.,-99.,-99.,-99.,-100.}, /*700*/
160
161    //   {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*63*/
162    //   {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*88*/
163    //   {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*125*/
164    {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*175*/
165    {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*250*/
166    {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*350*/
167    {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*500*/
168    {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*700*/
169
170    {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*1000*/
171    {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*1400*/
172    {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*2000*/
173    {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*2800*/
174    {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*4000*/
175    {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*5600*/
176
177    {-30.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*8000*/
178    {-30.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*11500*/
179    {-30.f,-35.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*16000*/
180
181   },
182
183   1,
184   {{-20.f,-20.f,-20.f,-24.f,-24.f,-24.f,-28.f,-28.f,-28.f,-28.f,-28.f},/*63*/
185    {-20.f,-20.f,-20.f,-24.f,-24.f,-24.f,-28.f,-28.f,-28.f,-28.f,-28.f},/*88*/
186    {-20.f,-20.f,-20.f,-20.f,-24.f,-24.f,-28.f,-28.f,-28.f,-28.f,-28.f},/*125*/
187    {-20.f,-20.f,-20.f,-20.f,-24.f,-24.f,-24.f,-24.f,-28.f,-28.f,-28.f},/*175*/
188    {-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-24.f,-24.f,-28.f,-28.f,-28.f},/*250*/
189    {-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-24.f,-24.f,-28.f,-28.f,-28.f},/*350*/
190    {-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-28.f,-24.f,-28.f,-28.f,-28.f},/*500*/
191    {-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-24.f,-24.f,-28.f,-28.f,-28.f},/*700*/
192    {-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-24.f,-24.f,-28.f,-28.f,-28.f},/*1000*/
193    {-20.f,-20.f,-20.f,-20.f,-24.f,-24.f,-24.f,-24.f,-28.f,-28.f,-28.f},/*1400*/
194    {-20.f,-20.f,-20.f,-20.f,-24.f,-24.f,-24.f,-24.f,-28.f,-28.f,-28.f},/*2000*/
195    {-20.f,-20.f,-20.f,-20.f,-24.f,-24.f,-24.f,-24.f,-28.f,-28.f,-28.f},/*2800*/
196    {-20.f,-20.f,-20.f,-20.f,-22.f,-20.f,-24.f,-24.f,-28.f,-28.f,-28.f},/*4000*/
197    {-20.f,-20.f,-20.f,-20.f,-22.f,-20.f,-22.f,-24.f,-28.f,-28.f,-28.f},/*5600*/
198    {-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-22.f,-24.f,-28.f,-28.f,-28.f},/*8000*/
199    {-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-22.f,-24.f,-28.f,-28.f,-28.f},/*11500*/
200    {-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-22.f,-24.f,-28.f,-28.f,-28.f},/*16000*/
201   },
202
203   1,/*noisemaskp */
204   -15.f,  /* suppress any noise curve over maxspec+n */
205   .5f,   /* low window */
206   .5f,   /* high window */
207   25,
208   25,
209   {.000f, 0.f, /*63*/
210    .000f, 0.f, /*88*/
211    .000f, 0.f, /*125*/
212    .000f, 0.f, /*175*/
213    .000f, 0.f, /*250*/
214    .000f, 0.f, /*350*/
215    .000f, 0.f, /*500*/
216    .000f, 0.f, /*700*/
217    .000f, 0.f, /*1000*/
218    .000f, 0.f, /*1400*/
219    .000f, 0.f, /*2000*/
220    .000f, 0.f, /*2800*/
221    .000f, 0.f, /*4000*/
222    .500f, -12.f, /*5600*/
223    .500f, -12.f, /*8000*/
224    .500f, -10.f, /*11500*/
225    .500f, -10.f, /*16000*/
226   },
227  
228   105.f,  /* even decade + 5 is important; saves an rint() later in a
229             tight loop) */
230   -32.,
231
232   -0.f, -.004f,   /* attack/decay control */
233
234 };
235
236 /* with GNUisms, this could be short and readable. Oh well */
237 static vorbis_info_time0 _time_set0D={0};
238 static vorbis_info_floor0 _floor_set0D={12, 44100,  64, 10,130, 2, {0,1},
239                                         0.199f, .285f};
240 static vorbis_info_floor0 _floor_set1D={30, 44100, 256, 12,150, 2, {2,3}, 
241                                         .082f, .126f};
242 static vorbis_info_residue0 _residue_set0D={0,128,16,6,4,
243                                             {0,1,1,1,1,1},
244                                             {6,7,8,9,10},
245                                             
246                                             {0,99999,9999,9999,9999},
247                                             {999.f,1.5f,2.5f,6.5f,40.5f},
248                                             {4,4,4,4,4},
249                                             {99,99,99,99,99}};
250
251 static vorbis_info_residue0 _residue_set1D={0,1024, 32,8,5,
252                                             {0,1,1,1,1,1,1,1,1,1},
253                                             {11,12,13,14,15,16,17,18,19},
254                                            
255                                             {0,9999,9999,60,9999,
256                                              9999,9999},
257                                             {999.f,2.5f,4.5f,10.5f,10.5f,
258                                              20.5f,40.f},
259                                             {5,5,5,5,5,5,5},
260                                             {99,99,99,99,99,99,99,99,99}};
261
262 static vorbis_info_mapping0 _mapping_set0D={1, {0,0}, {0}, {0}, {0}, {0}};
263 static vorbis_info_mapping0 _mapping_set1D={1, {0,0}, {0}, {1}, {1}, {1}};
264 static vorbis_info_mode _mode_set0D={0,0,0,0};
265 static vorbis_info_mode _mode_set1D={1,0,0,1};
266
267 /* CD quality stereo, no channel coupling */
268 codec_setup_info info_D={
269
270   /* smallblock, largeblock */
271   {256, 2048}, 
272   /* modes,maps,times,floors,residues,books,psys */
273   2,          2,    1,     2,       2,   18,   2,
274   /* modes */
275   {&_mode_set0D,&_mode_set1D},
276   /* maps */
277   {0,0},{&_mapping_set0D,&_mapping_set1D},
278   /* times */
279   {0,0},{&_time_set0D},
280   /* floors */
281   {0,0},{&_floor_set0D,&_floor_set1D},
282   /* residue */
283   {0,0},{&_residue_set0D,&_residue_set1D},
284   /* books */
285   {&_vq_book_lsp12_0,       /* 0 */
286    &_vq_book_lsp12_1,       /* 1 */
287    &_vq_book_lsp30_0,      /* 2 */
288    &_vq_book_lsp30_1,      /* 3 */
289
290    &_huff_book_res0_256_128aux,
291    &_huff_book_res0_256_1024aux,
292
293    &_vq_book_res0_256_128_1,
294    &_vq_book_res0_256_128_2,
295    &_vq_book_res0_256_128_3,
296    &_vq_book_res0_256_128_4,
297    &_vq_book_res0_256_128_5,
298
299    &_vq_book_res0_256_1024_1,
300    &_vq_book_res0_256_1024_2,
301    &_vq_book_res0_256_1024_3,
302    &_vq_book_res0_256_1024_4,
303    &_vq_book_res0_256_1024_5,
304    &_vq_book_res0_256_1024_6,
305    &_vq_book_res0_256_1024_7,
306
307   },
308   /* psy */
309   {&_psy_set_D0,&_psy_set_D},
310   /* thresh sample period, preecho clamp trigger threshhold, range, minenergy */
311   256, {26.f,26.f,26.f,30.f}, {-90.f,-90.f,-90.f,-90.f}, -90.f,
312
313   -15., 
314
315   0,
316 };
317
318 #define PREDEF_INFO_MAX 0
319
320 #endif