1 /********************************************************************
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. *
8 * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 *
9 * by the XIPHOPHORUS Company http://www.xiph.org/ *
11 ********************************************************************
13 function: predefined encoding modes
14 last mod: $Id: mode_D.h,v 1.11 2001/02/15 19:06:02 xiphmont Exp $
16 ********************************************************************/
22 #include "vorbis/codec.h"
25 #include "books/lsp12_0.vqh"
26 #include "books/lsp30_0.vqh"
27 #include "books/lsp12_1.vqh"
28 #include "books/lsp30_1.vqh"
30 #include "books/res0_256_128aux.vqh"
31 #include "books/res0_256_1024aux.vqh"
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"
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"
48 static vorbis_info_psy _psy_set_D0={
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 */
62 /* 0 10 20 30 40 50 60 70 80 90 100 */
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*/
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*/
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*/
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*/
106 -15.f, /* suppress any noise curve over maxspec+n */
107 .5f, /* low window */
108 .5f, /* high window */
126 .850f, -5.f,/*11500*/
127 .850f, -4.f,/*16000*/
130 105.f, /* even decade + 5 is important; saves an rint() later in a
134 -0., -.004 /* attack/decay control */
137 static vorbis_info_psy _psy_set_D={
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 */
150 /* 0 10 20 30 40 50 60 70 80 90 100 */
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*/
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*/
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*/
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*/
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*/
204 -15.f, /* suppress any noise curve over maxspec+n */
205 .5f, /* low window */
206 .5f, /* high window */
222 .500f, -12.f, /*5600*/
223 .500f, -12.f, /*8000*/
224 .500f, -10.f, /*11500*/
225 .500f, -10.f, /*16000*/
228 105.f, /* even decade + 5 is important; saves an rint() later in a
232 -0.f, -.004f, /* attack/decay control */
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},
240 static vorbis_info_floor0 _floor_set1D={30, 44100, 256, 12,150, 2, {2,3},
242 static vorbis_info_residue0 _residue_set0D={0,128,16,6,4,
246 {0,99999,9999,9999,9999},
247 {999.f,1.5f,2.5f,6.5f,40.5f},
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},
255 {0,9999,9999,60,9999,
257 {999.f,2.5f,4.5f,10.5f,10.5f,
260 {99,99,99,99,99,99,99,99,99}};
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};
267 /* CD quality stereo, no channel coupling */
268 codec_setup_info info_D={
270 /* smallblock, largeblock */
272 /* modes,maps,times,floors,residues,books,psys */
273 2, 2, 1, 2, 2, 18, 2,
275 {&_mode_set0D,&_mode_set1D},
277 {0,0},{&_mapping_set0D,&_mapping_set1D},
279 {0,0},{&_time_set0D},
281 {0,0},{&_floor_set0D,&_floor_set1D},
283 {0,0},{&_residue_set0D,&_residue_set1D},
285 {&_vq_book_lsp12_0, /* 0 */
286 &_vq_book_lsp12_1, /* 1 */
287 &_vq_book_lsp30_0, /* 2 */
288 &_vq_book_lsp30_1, /* 3 */
290 &_huff_book_res0_256_128aux,
291 &_huff_book_res0_256_1024aux,
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,
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,
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,
318 #define PREDEF_INFO_MAX 0