bugfix/speed improvement to envelope.c
[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.12 2001/02/18 09:53:12 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   1,/*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    {-35.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*1000*/
74    {-35.,-40.,-40.,-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    {-35.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*4000*/
78    {-35.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*5600*/
79    {-35.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*8000*/
80    {-35.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*11500*/
81    {-35.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*16000*/
82   },
83
84   1,/* peakattp */
85   {{-16.f,-20.f,-20.f,-22.f,-22.f,-22.f,-26.f,-26.f,-26.f,-26.f,-26.f},/*63*/
86    {-16.f,-20.f,-20.f,-22.f,-22.f,-22.f,-26.f,-26.f,-26.f,-26.f,-26.f},/*88*/
87    {-16.f,-20.f,-20.f,-22.f,-22.f,-22.f,-26.f,-26.f,-26.f,-26.f,-26.f},/*125*/
88    {-16.f,-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-26.f,-26.f,-26.f,-26.f},/*175*/
89    {-16.f,-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-26.f,-26.f,-26.f,-26.f},/*250*/
90    {-16.f,-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-26.f,-26.f,-26.f,-26.f},/*350*/
91    {-16.f,-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-26.f,-26.f,-26.f,-26.f},/*500*/
92    {-16.f,-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-26.f,-26.f,-26.f,-26.f},/*700*/
93    {-16.f,-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-26.f,-26.f,-26.f,-26.f},/*1000*/
94    {-16.f,-20.f,-20.f,-20.f,-20.f,-20.f,-22.f,-26.f,-26.f,-26.f,-26.f},/*2000*/
95    {-16.f,-20.f,-20.f,-20.f,-20.f,-20.f,-22.f,-26.f,-26.f,-26.f,-26.f},/*2000*/
96    {-16.f,-20.f,-20.f,-20.f,-20.f,-20.f,-22.f,-26.f,-26.f,-26.f,-26.f},/*2600*/
97    {-16.f,-20.f,-20.f,-20.f,-20.f,-20.f,-22.f,-26.f,-26.f,-26.f,-26.f},/*4000*/
98    {-16.f,-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-26.f,-26.f,-26.f},/*5600*/
99    {-16.f,-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-26.f,-26.f,-26.f},/*8000*/
100    {-16.f,-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-26.f,-26.f,-26.f},/*11500*/
101    {-16.f,-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-26.f,-26.f},/*16000*/
102   },
103
104   1,/*noisemaskp */
105   -20.f,  /* suppress any noise curve over maxspec+n */
106   .5f,   /* low window */
107   .5f,   /* high window */
108   5,
109   5,
110   {.000f, 0.f,/*63*/
111    .000f, 0.f,/*88*/
112    .000f, 0.f,/*125*/
113    .000f, 0.f,/*175*/
114    .000f, 0.f,/*250*/
115    .000f, 0.f,/*350*/
116    .000f, 0.f,/*500*/
117    .100f, 0.f,/*700*/
118    .100f, 0.f,/*1000*/
119    .100f, 0.f,/*1400*/
120    .100f, 0.f,/*2000*/
121    .100f, 0.f,/*2800*/
122    .200f, 0.f,/*4000*/
123    .300f, 0.f,/*5600*/
124    .400f, 0.f,/*8000*/
125    .400f, 0.f,/*11500*/
126    .400f, 0.f,/*16000*/
127   },
128  
129   105.f,  /* even decade + 5 is important; saves an rint() later in a
130             tight loop) */
131   -28.,
132
133   -0., -.004   /* attack/decay control */
134 };
135
136 static vorbis_info_psy _psy_set_D={
137   1,/*athp*/
138   1,/*decayp*/
139
140   -100.f,
141   -140.f,
142
143   8,
144
145   /*     0  1  2   3   4   5   6   7   8   9  10  11  12  13  14  15   16   */
146   /* x: 63 88 125 175 250 350 500 700 1k 1.4k 2k 2.8k 4k 5.6k 8k 11.5k 16k Hz */
147   /* y: 0 10 20 30 40 50 60 70 80 90 100 dB */
148    1,/* tonemaskp */
149   /*  0   10   20   30   40   50   60   70   80   90   100 */
150   {
151    {-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f}, /*63*/
152    {-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f}, /*88*/
153    {-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f}, /*125*/
154
155    {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*175*/
156    {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*250*/
157    {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*350*/
158    {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*500*/
159    {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*700*/
160
161    {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*1000*/
162    {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*1400*/
163    {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*2000*/
164    {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*2800*/
165    {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*4000*/
166    {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*5600*/
167
168    {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*8000*/
169    {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*11500*/
170    {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*16000*/
171
172   },
173
174   1,
175   {{-20.f,-20.f,-20.f,-24.f,-24.f,-24.f,-28.f,-28.f,-28.f,-28.f,-28.f},/*63*/
176    {-20.f,-20.f,-20.f,-24.f,-24.f,-24.f,-28.f,-28.f,-28.f,-28.f,-28.f},/*88*/
177    {-20.f,-20.f,-20.f,-20.f,-24.f,-24.f,-28.f,-28.f,-28.f,-28.f,-28.f},/*125*/
178    {-20.f,-20.f,-20.f,-20.f,-24.f,-24.f,-24.f,-24.f,-28.f,-28.f,-28.f},/*175*/
179    {-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-24.f,-24.f,-28.f,-28.f,-28.f},/*250*/
180    {-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-24.f,-24.f,-28.f,-28.f,-28.f},/*350*/
181    {-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-28.f,-24.f,-28.f,-28.f,-28.f},/*500*/
182    {-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-24.f,-24.f,-28.f,-28.f,-28.f},/*700*/
183    {-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-24.f,-24.f,-28.f,-28.f,-28.f},/*1000*/
184    {-20.f,-20.f,-20.f,-20.f,-24.f,-24.f,-24.f,-24.f,-28.f,-28.f,-28.f},/*1400*/
185    {-20.f,-20.f,-20.f,-20.f,-24.f,-24.f,-24.f,-24.f,-28.f,-28.f,-28.f},/*2000*/
186    {-20.f,-20.f,-20.f,-20.f,-24.f,-24.f,-24.f,-24.f,-28.f,-28.f,-28.f},/*2800*/
187    {-20.f,-20.f,-20.f,-20.f,-22.f,-20.f,-24.f,-24.f,-28.f,-28.f,-28.f},/*4000*/
188    {-20.f,-20.f,-20.f,-20.f,-22.f,-20.f,-22.f,-24.f,-28.f,-28.f,-28.f},/*5600*/
189    {-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-22.f,-24.f,-28.f,-28.f,-28.f},/*8000*/
190    {-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-22.f,-24.f,-28.f,-28.f,-28.f},/*11500*/
191    {-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-22.f,-24.f,-28.f,-28.f,-28.f},/*16000*/
192   },
193
194   1,/*noisemaskp */
195   -28.f,  /* suppress any noise curve over maxspec+n */
196   .5f,   /* low window */
197   .5f,   /* high window */
198   25,
199   25,
200   {.000f, 0.f, /*63*/
201    .000f, 0.f, /*88*/
202    .000f, 0.f, /*125*/
203    .000f, 0.f, /*175*/
204    .000f, 0.f, /*250*/
205    .000f, 0.f, /*350*/
206    .000f, 0.f, /*500*/
207    .000f, 0.f, /*700*/
208    .000f, 0.f, /*1000*/
209    .000f, 0.f, /*1400*/
210    .000f, 0.f, /*2000*/
211    .000f, 0.f, /*2800*/
212    .050f, 0.f, /*4000*/
213    .100f, 0.f, /*5600*/
214    .100f, 0.f, /*8000*/
215    .120f, 0.f, /*11500*/
216    .150f, 0.f, /*16000*/
217   },
218  
219   105.f,  /* even decade + 5 is important; saves an rint() later in a
220             tight loop) */
221   -32.,
222
223   -0.f, -.004f,   /* attack/decay control */
224
225 };
226
227 /* with GNUisms, this could be short and readable. Oh well */
228 static vorbis_info_time0 _time_set0D={0};
229 static vorbis_info_floor0 _floor_set0D={12, 44100,  64, 10,130, 2, {0,1},
230                                         0.199f, .285f};
231 static vorbis_info_floor0 _floor_set1D={30, 44100, 256, 12,150, 2, {2,3}, 
232                                         .082f, .126f};
233 static vorbis_info_residue0 _residue_set0D={0,128,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,2.5f,6.5f,40.5f},
239                                             {4,4,4,4,4},
240                                             {99,99,99,99,99}};
241
242 static vorbis_info_residue0 _residue_set1D={0,1024, 32,8,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,9999,9999,60,9999,
247                                              9999,9999},
248                                             {999.f,2.5f,4.5f,10.5f,10.5f,
249                                              20.5f,40.f},
250                                             {5,5,5,5,5,5,5},
251                                             {99,99,99,99,99,99,99,99,99}};
252
253 static vorbis_info_mapping0 _mapping_set0D={1, {0,0}, {0}, {0}, {0}, {0}};
254 static vorbis_info_mapping0 _mapping_set1D={1, {0,0}, {0}, {1}, {1}, {1}};
255 static vorbis_info_mode _mode_set0D={0,0,0,0};
256 static vorbis_info_mode _mode_set1D={1,0,0,1};
257
258 /* CD quality stereo, no channel coupling */
259 codec_setup_info info_D={
260
261   /* smallblock, largeblock */
262   {256, 2048}, 
263   /* modes,maps,times,floors,residues,books,psys */
264   2,          2,    1,     2,       2,   18,   2,
265   /* modes */
266   {&_mode_set0D,&_mode_set1D},
267   /* maps */
268   {0,0},{&_mapping_set0D,&_mapping_set1D},
269   /* times */
270   {0,0},{&_time_set0D},
271   /* floors */
272   {0,0},{&_floor_set0D,&_floor_set1D},
273   /* residue */
274   {0,0},{&_residue_set0D,&_residue_set1D},
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_256_128aux,
282    &_huff_book_res0_256_1024aux,
283
284    &_vq_book_res0_256_128_1,
285    &_vq_book_res0_256_128_2,
286    &_vq_book_res0_256_128_3,
287    &_vq_book_res0_256_128_4,
288    &_vq_book_res0_256_128_5,
289
290    &_vq_book_res0_256_1024_1,
291    &_vq_book_res0_256_1024_2,
292    &_vq_book_res0_256_1024_3,
293    &_vq_book_res0_256_1024_4,
294    &_vq_book_res0_256_1024_5,
295    &_vq_book_res0_256_1024_6,
296    &_vq_book_res0_256_1024_7,
297
298   },
299   /* psy */
300   {&_psy_set_D0,&_psy_set_D},
301
302   /* thresh sample period, preecho clamp trigger threshhold, range, minenergy */
303   256, {26.f,26.f,26.f,30.f}, {-36.f,-36.f,-36.f,-36.f}, -90.f,
304   
305   -10., 
306
307   0,
308 };
309
310 #define PREDEF_INFO_MAX 0
311
312 #endif