Accidentally committed some in-progress encoder changes that broke
[platform/upstream/libvorbis.git] / lib / modes / mode_B.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_B.h,v 1.15 2001/06/18 09:07:32 xiphmont Exp $
15
16  ********************************************************************/
17
18 #ifndef _V_MODES_B_H_
19 #define _V_MODES_B_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_160_128aux.vqh"
31 #include "books/res0_160_1024aux.vqh"
32
33 #include "books/res0_160_128_1.vqh"
34 #include "books/res0_160_128_2.vqh"
35 #include "books/res0_160_128_3.vqh"
36 #include "books/res0_160_128_4.vqh"
37 #include "books/res0_160_128_5.vqh"
38
39 #include "books/res0_160_1024_1.vqh"
40 #include "books/res0_160_1024_2.vqh"
41 #include "books/res0_160_1024_3.vqh"
42 #include "books/res0_160_1024_4.vqh"
43 #include "books/res0_160_1024_5.vqh"
44 #include "books/res0_160_1024_6.vqh"
45 #include "books/res0_160_1024_7.vqh"
46 #include "books/res0_160_1024_8.vqh"
47 #include "books/res0_160_1024_9.vqh"
48
49
50 static vorbis_info_psy _psy_set_B0={
51   ATH_Bark_dB_lspconservative,
52   1,/*decayp*/
53
54   -100.,
55   -140.,
56
57   8,
58
59   /*     0  1  2   3   4   5   6   7   8   9  10  11  12  13  14  15   16   */
60   /* x: 63 88 125 175 250 350 500 700 1k 1.4k 2k 2.8k 4k 5.6k 8k 11.5k 16k Hz */
61   /* y: 0 10 20 30 40 50 60 70 80 90 100 dB */
62
63    1,/* tonemaskp */
64   /*  0   10   20   30   40   50   60   70   80   90   100 */
65   {
66    {-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.}, /*63*/
67    {-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.}, /*88*/
68    {-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.}, /*125*/
69    {-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.}, /*175*/
70    {-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.}, /*250*/
71    {-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.}, /*350*/
72    {-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.}, /*500*/
73    {-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.}, /*700*/
74
75    {-30.,-35.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*1000*/
76    {-30.,-35.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*1400*/
77    {-40.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*2000*/
78    {-40.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*2800*/
79    {-30.,-35.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*4000*/
80    {-30.,-35.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*5600*/
81    {-30.,-35.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*8000*/
82    {-30.,-35.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*11500*/
83    {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*16000*/
84   },
85
86   1,/* peakattp */
87   {{-14.f,-16.f,-18.f,-19.f,-20.f,-21.f,-24.f,-24.f,-24.f,-24.f,-24.f},/*63*/
88    {-14.f,-16.f,-18.f,-19.f,-20.f,-21.f,-24.f,-24.f,-24.f,-24.f,-24.f},/*88*/
89    {-14.f,-16.f,-18.f,-19.f,-20.f,-21.f,-24.f,-24.f,-24.f,-24.f,-24.f},/*125*/
90    {-14.f,-14.f,-14.f,-14.f,-16.f,-16.f,-20.f,-24.f,-24.f,-24.f,-24.f},/*175*/
91    {-14.f,-14.f,-14.f,-14.f,-16.f,-16.f,-20.f,-24.f,-24.f,-24.f,-24.f},/*250*/
92    {-14.f,-14.f,-14.f,-14.f,-16.f,-16.f,-20.f,-24.f,-24.f,-24.f,-24.f},/*350*/
93    {-14.f,-14.f,-14.f,-14.f,-16.f,-16.f,-20.f,-24.f,-24.f,-24.f,-24.f},/*500*/
94    {-14.f,-14.f,-14.f,-14.f,-14.f,-14.f,-18.f,-24.f,-24.f,-24.f,-24.f},/*700*/
95    {-14.f,-14.f,-14.f,-14.f,-14.f,-14.f,-14.f,-24.f,-24.f,-24.f,-24.f},/*1000*/
96    {-14.f,-14.f,-14.f,-14.f,-14.f,-16.f,-18.f,-24.f,-24.f,-24.f,-24.f},/*1400*/
97    {-14.f,-14.f,-14.f,-14.f,-14.f,-16.f,-18.f,-24.f,-24.f,-24.f,-24.f},/*2000*/
98    {-14.f,-14.f,-14.f,-14.f,-14.f,-16.f,-18.f,-24.f,-24.f,-24.f,-24.f},/*2400*/
99    {-14.f,-14.f,-14.f,-14.f,-14.f,-16.f,-18.f,-24.f,-24.f,-24.f,-24.f},/*4000*/
100    {-14.f,-14.f,-14.f,-14.f,-14.f,-14.f,-12.f,-20.f,-24.f,-24.f,-24.f},/*5600*/
101    {-14.f,-14.f,-14.f,-14.f,-14.f,-14.f,-14.f,-20.f,-24.f,-24.f,-24.f},/*8000*/
102    {-14.f,-14.f,-14.f,-14.f,-14.f,-14.f,-14.f,-20.f,-24.f,-24.f,-24.f},/*11500*/
103    {-14.f,-14.f,-14.f,-14.f,-14.f,-14.f,-14.f,-14.f,-20.f,-24.f,-24.f},/*16000*/
104   },
105
106   1,/*noisemaskp */
107   -10.f,  /* suppress any noise curve over maxspec+n */
108   .5f,   /* low window */
109   .5f,   /* high window */
110   5,
111   5,
112   10,
113   {.000f, 0.f,/*63*/
114    .000f, 0.f,/*88*/
115    .000f, 0.f,/*125*/
116    .000f, 0.f,/*175*/
117    .000f, 0.f,/*250*/
118    .000f, 0.f,/*350*/
119    .000f, 0.f,/*500*/
120    .300f, 0.f,/*700*/
121    .500f, 0.f,/*1000*/
122    .500f, 0.f,/*1400*/
123    .500f, 0.f,/*2000*/
124    .500f, 0.f,/*2800*/
125    .600f, 0.f,/*4000*/
126    .700f, 0.f,/*5600*/
127    .800f, 0.f,/*8000*/
128    .800f, 0.f,/*11500*/
129    .800f, 0.f,/*16000*/
130   },
131  
132    95.f,  /* even decade + 5 is important; saves an rint() later in a
133             tight loop) */
134   -26.,
135 };
136
137 static vorbis_info_psy _psy_set_B={
138   ATH_Bark_dB_lspconservative,
139   1,/*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
156    {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*175*/
157    {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*250*/
158    {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*350*/
159    {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*500*/
160    {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*700*/
161
162    {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*1000*/
163    {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*1400*/
164    {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*2000*/
165    {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*2800*/
166    {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*4000*/
167    {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*5600*/
168
169    {-35.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*8000*/
170    {-35.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*11500*/
171    {-30.f,-35.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*16000*/
172
173   },
174
175   1,/* peakattp */
176   {{-14.f,-16.f,-18.f,-19.f,-20.f,-21.f,-26.f,-26.f,-26.f,-26.f,-26.f},/*63*/
177    {-14.f,-16.f,-18.f,-19.f,-20.f,-21.f,-26.f,-26.f,-26.f,-26.f,-26.f},/*88*/
178    {-14.f,-16.f,-18.f,-19.f,-20.f,-21.f,-26.f,-26.f,-26.f,-26.f,-26.f},/*125*/
179    {-14.f,-14.f,-14.f,-14.f,-16.f,-16.f,-20.f,-24.f,-26.f,-26.f,-26.f},/*175*/
180    {-14.f,-14.f,-14.f,-14.f,-16.f,-16.f,-20.f,-24.f,-26.f,-26.f,-26.f},/*250*/
181    {-14.f,-14.f,-14.f,-14.f,-16.f,-16.f,-20.f,-24.f,-26.f,-26.f,-26.f},/*350*/
182    {-14.f,-14.f,-14.f,-14.f,-16.f,-16.f,-20.f,-24.f,-26.f,-26.f,-26.f},/*500*/
183    {-14.f,-14.f,-14.f,-14.f,-14.f,-14.f,-18.f,-24.f,-26.f,-26.f,-26.f},/*700*/
184    {-14.f,-14.f,-14.f,-14.f,-14.f,-14.f,-14.f,-24.f,-26.f,-26.f,-26.f},/*1000*/
185    {-14.f,-14.f,-14.f,-14.f,-14.f,-16.f,-18.f,-24.f,-26.f,-26.f,-26.f},/*1400*/
186    {-14.f,-14.f,-14.f,-14.f,-14.f,-16.f,-18.f,-24.f,-26.f,-26.f,-26.f},/*2000*/
187    {-14.f,-14.f,-14.f,-14.f,-14.f,-16.f,-18.f,-24.f,-26.f,-26.f,-26.f},/*2400*/
188    {-14.f,-14.f,-14.f,-14.f,-14.f,-16.f,-18.f,-24.f,-26.f,-26.f,-26.f},/*4000*/
189    {-14.f,-14.f,-14.f,-14.f,-14.f,-14.f,-12.f,-20.f,-26.f,-26.f,-26.f},/*5600*/
190    {-10.f,-10.f,-14.f,-14.f,-14.f,-14.f,-14.f,-20.f,-22.f,-24.f,-26.f},/*8000*/
191    {-10.f,-10.f,-10.f,-14.f,-14.f,-14.f,-14.f,-20.f,-22.f,-24.f,-26.f},/*11500*/
192    {-10.f,-10.f,-10.f,-14.f,-14.f,-14.f,-14.f,-14.f,-20.f,-24.f,-26.f},/*16000*/
193   },
194
195   1,/*noisemaskp */
196   -28.f,  /* suppress any noise curve over maxspec+n */
197   .5f,   /* low window */
198   .5f,   /* high window */
199   25,
200   25,
201   40,
202   {.000f, 0.f, /*63*/
203    .000f, 0.f, /*88*/
204    .000f, 0.f, /*125*/
205    .000f, 0.f, /*175*/
206    .000f, 0.f, /*250*/
207    .000f, 0.f, /*350*/
208    .000f, 0.f, /*500*/
209    .000f, 0.f, /*700*/
210    .200f, 0.f, /*1000*/
211    .300f, 0.f, /*1400*/
212    .300f, 0.f, /*2000*/
213    .300f, 0.f, /*2800*/
214    .700f, 0.f, /*4000*/
215    .700f, 0.f, /*5600*/
216    .750f, 0.f, /*8000*/
217    .750f, 0.f, /*11500*/
218    .800f, 0.f, /*16000*/
219   },
220  
221   105.f,  /* even decade + 5 is important; saves an rint() later in a
222             tight loop) */
223   -30.,
224
225 };
226
227 /* with GNUisms, this could be short and readable. Oh well */
228 static vorbis_info_time0 _time_set0B={0};
229 static vorbis_info_floor0 _floor_set0B={12, 44100,  64, 10,130, 2, {0,1},
230                                         0.199f, .285f};
231 static vorbis_info_floor0 _floor_set1B={30, 44100, 256, 12,150, 2, {2,3}, 
232                                         .082f, .126f};
233 static vorbis_info_residue0 _residue_set0B={0,96,16,6,4,
234                                             {0,1,1,1,1,1},
235                                             {6,7,8,9,10},
236                                             
237                                             {0,99999,9999,9999,9999},
238                                             {999.f,1.5f,3.5f,15.5f,26.5f},
239                                             {4,4,4,4,4},
240                                             {99,99,99,99,99}};
241
242 static vorbis_info_residue0 _residue_set1B={0, 960, 32,10,5,
243                                             {0,1,1,1,1,1,1,1,1,1},
244                                             {11,12,13,14,15,16,17,18,19},
245                                            
246                                             {0,8,9999,16,9999,
247                                              24,9999,9999,9999},
248                                             {999.f,1.5f,1.5f,2.5f,2.5f,
249                                              6.5f,6.5f,12.5f,22.5f},
250                                             {5,5,5,5,5,5,5,5,5},
251                                             {99,99,99,99,99,99,99,99,99}};
252
253 static vorbis_info_mapping0 _mapping_set0B={1, {0,0}, {0}, {0}, {0}, {0}};
254 static vorbis_info_mapping0 _mapping_set1B={1, {0,0}, {0}, {1}, {1}, {1}};
255 static vorbis_info_mode _mode_set0B={0,0,0,0};
256 static vorbis_info_mode _mode_set1B={1,0,0,1};
257
258 /* CD quality stereo, no channel coupling */
259 codec_setup_info info_B={
260
261   /* smallblock, largeblock */
262   {256, 2048}, 
263   /* modes,maps,times,floors,residues,books,psys */
264   2,          2,    1,     2,       2,   20,   2,
265   /* modes */
266   {&_mode_set0B,&_mode_set1B},
267   /* maps */
268   {0,0},{&_mapping_set0B,&_mapping_set1B},
269   /* times */
270   {0,0},{&_time_set0B},
271   /* floors */
272   {0,0},{&_floor_set0B,&_floor_set1B},
273   /* residue */
274   {0,0},{&_residue_set0B,&_residue_set1B},
275   /* books */
276   {&_vq_book_lsp12_0,       /* 0 */
277    &_vq_book_lsp12_1,       /* 1 */
278    &_vq_book_lsp30_0,      /* 2 */
279    &_vq_book_lsp30_1,      /* 3 */
280
281    &_huff_book_res0_160_128aux,
282    &_huff_book_res0_160_1024aux,
283
284    &_vq_book_res0_160_128_1,
285    &_vq_book_res0_160_128_2,
286    &_vq_book_res0_160_128_3,
287    &_vq_book_res0_160_128_4,
288    &_vq_book_res0_160_128_5,
289
290    &_vq_book_res0_160_1024_1,
291    &_vq_book_res0_160_1024_2,
292    &_vq_book_res0_160_1024_3,
293    &_vq_book_res0_160_1024_4,
294    &_vq_book_res0_160_1024_5,
295    &_vq_book_res0_160_1024_6,
296    &_vq_book_res0_160_1024_7,
297    &_vq_book_res0_160_1024_8,
298    &_vq_book_res0_160_1024_9,
299
300   },
301   /* psy */
302   {&_psy_set_B0,&_psy_set_B},
303
304   /* thresh sample period, preecho clamp trigger threshhold, range, minenergy */
305   256, {26.f,26.f,26.f,30.f}, {-90.f,-90.f,-90.f,-90.f}, -90.f,
306   
307   -10., 
308
309   0,
310 };
311
312 #define PREDEF_INFO_MAX 0
313
314 #endif