1 /********************************************************************
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. *
8 * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 *
9 * by the XIPHOPHORUS Company http://www.xiph.org/ *
11 ********************************************************************
13 function: toplevel residue templates for 32/44.1/48kHz
14 last mod: $Id: residue_44.h,v 1.12 2002/06/28 22:19:54 xiphmont Exp $
16 ********************************************************************/
18 #include "vorbis/codec.h"
20 #include "books/coupled/res_books_44c.h"
22 /***** residue backends *********************************************/
24 /* the books used depend on stereo-or-not, but the residue setup below
25 can apply to coupled or not. These templates are for a first pass;
26 a last pass is mechanically added in vorbisenc for residue backfill
27 at 1/3 and 1/9, as well as an optional middle pass for stereo
31 static vorbis_info_residue0 _residue_44_mid={
33 /* 0 1 2 3 4 5 6 7 8 */
36 { .5, 1.5, 1.5, 2.5, 2.5, 4.5, 8.5, 16.5, 32.5},
37 { .5, .5, 999., .5, 999., 4.5, 8.5, 16.5, 32.5},
40 static vorbis_info_residue0 _residue_44_high={
42 /* 0 1 2 3 4 5 6 7 8 */
45 { .5, 1.5, 2.5, 4.5, 8.5, 16.5, 32.5, 71.5,157.5},
46 { .5, 1.5, 2.5, 3.5, 4.5, 8.5, 16.5, 71.5,157.5},
49 /* mapping conventions:
50 only one submap (this would change for efficient 5.1 support for example)*/
51 /* Four psychoacoustic profiles are used, one for each blocktype */
52 static vorbis_info_mapping0 _map_nominal[2]={
53 {1, {0,0}, {0}, {0}, 1,{0},{1}},
54 {1, {0,0}, {1}, {1}, 1,{0},{1}}
57 static static_bookblock _resbook_44s_0={
59 {0},{0,0,&_44c0_s_p1_0},{0,0,&_44c0_s_p2_0},{0,0,&_44c0_s_p3_0},
60 {0,0,&_44c0_s_p4_0},{0,0,&_44c0_s_p5_0},{0,0,&_44c0_s_p6_0},
61 {&_44c0_s_p7_0,&_44c0_s_p7_1},{&_44c0_s_p8_0,&_44c0_s_p8_1},
62 {&_44c0_s_p9_0,&_44c0_s_p9_1,&_44c0_s_p9_2}
65 static static_bookblock _resbook_44sm_0={
67 {0},{0,0,&_44c0_sm_p1_0},{0,0,&_44c0_sm_p2_0},{0,0,&_44c0_sm_p3_0},
68 {0,0,&_44c0_sm_p4_0},{0,0,&_44c0_sm_p5_0},{0,0,&_44c0_sm_p6_0},
69 {&_44c0_sm_p7_0,&_44c0_sm_p7_1},{&_44c0_sm_p8_0,&_44c0_sm_p8_1},
70 {&_44c0_sm_p9_0,&_44c0_sm_p9_1,&_44c0_sm_p9_2}
73 static static_bookblock _resbook_44s_1={
75 {0},{0,0,&_44c1_s_p1_0},{0,0,&_44c1_s_p2_0},{0,0,&_44c1_s_p3_0},
76 {0,0,&_44c1_s_p4_0},{0,0,&_44c1_s_p5_0},{0,0,&_44c1_s_p6_0},
77 {&_44c1_s_p7_0,&_44c1_s_p7_1},{&_44c1_s_p8_0,&_44c1_s_p8_1},
78 {&_44c1_s_p9_0,&_44c1_s_p9_1,&_44c1_s_p9_2}
81 static static_bookblock _resbook_44sm_1={
83 {0},{0,0,&_44c1_sm_p1_0},{0,0,&_44c1_sm_p2_0},{0,0,&_44c1_sm_p3_0},
84 {0,0,&_44c1_sm_p4_0},{0,0,&_44c1_sm_p5_0},{0,0,&_44c1_sm_p6_0},
85 {&_44c1_sm_p7_0,&_44c1_sm_p7_1},{&_44c1_sm_p8_0,&_44c1_sm_p8_1},
86 {&_44c1_sm_p9_0,&_44c1_sm_p9_1,&_44c1_sm_p9_2}
89 static static_bookblock _resbook_44s_2={
91 {0},{0,0,&_44c2_s_p1_0},{0,0,&_44c2_s_p2_0},{0,0,&_44c2_s_p3_0},
92 {0,0,&_44c2_s_p4_0},{0,0,&_44c2_s_p5_0},{0,0,&_44c2_s_p6_0},
93 {&_44c2_s_p7_0,&_44c2_s_p7_1},{&_44c2_s_p8_0,&_44c2_s_p8_1},
94 {&_44c2_s_p9_0,&_44c2_s_p9_1,&_44c2_s_p9_2}
97 static static_bookblock _resbook_44s_3={
99 {0},{0,0,&_44c3_s_p1_0},{0,0,&_44c3_s_p2_0},{0,0,&_44c3_s_p3_0},
100 {0,0,&_44c3_s_p4_0},{0,0,&_44c3_s_p5_0},{0,0,&_44c3_s_p6_0},
101 {&_44c3_s_p7_0,&_44c3_s_p7_1},{&_44c3_s_p8_0,&_44c3_s_p8_1},
102 {&_44c3_s_p9_0,&_44c3_s_p9_1,&_44c3_s_p9_2}
105 static static_bookblock _resbook_44s_4={
107 {0},{0,0,&_44c4_s_p1_0},{0,0,&_44c4_s_p2_0},{0,0,&_44c4_s_p3_0},
108 {0,0,&_44c4_s_p4_0},{0,0,&_44c4_s_p5_0},{0,0,&_44c4_s_p6_0},
109 {&_44c4_s_p7_0,&_44c4_s_p7_1},{&_44c4_s_p8_0,&_44c4_s_p8_1},
110 {&_44c4_s_p9_0,&_44c4_s_p9_1,&_44c4_s_p9_2}
113 static static_bookblock _resbook_44s_5={
115 {0},{0,0,&_44c5_s_p1_0},{0,0,&_44c5_s_p2_0},{0,0,&_44c5_s_p3_0},
116 {0,0,&_44c5_s_p4_0},{0,0,&_44c5_s_p5_0},{0,0,&_44c5_s_p6_0},
117 {&_44c5_s_p7_0,&_44c5_s_p7_1},{&_44c5_s_p8_0,&_44c5_s_p8_1},
118 {&_44c5_s_p9_0,&_44c5_s_p9_1,&_44c5_s_p9_2}
121 static static_bookblock _resbook_44s_6={
123 {0},{0,0,&_44c6_s_p1_0},{0,0,&_44c6_s_p2_0},{0,0,&_44c6_s_p3_0},
125 {&_44c6_s_p5_0,&_44c6_s_p5_1},
126 {&_44c6_s_p6_0,&_44c6_s_p6_1},
127 {&_44c6_s_p7_0,&_44c6_s_p7_1},
128 {&_44c6_s_p8_0,&_44c6_s_p8_1},
129 {&_44c6_s_p9_0,&_44c6_s_p9_1,&_44c6_s_p9_2}
132 static static_bookblock _resbook_44s_7={
134 {0},{0,0,&_44c7_s_p1_0},{0,0,&_44c7_s_p2_0},{0,0,&_44c7_s_p3_0},
136 {&_44c7_s_p5_0,&_44c7_s_p5_1},
137 {&_44c7_s_p6_0,&_44c7_s_p6_1},
138 {&_44c7_s_p7_0,&_44c7_s_p7_1},
139 {&_44c7_s_p8_0,&_44c7_s_p8_1},
140 {&_44c7_s_p9_0,&_44c7_s_p9_1,&_44c7_s_p9_2}
143 static static_bookblock _resbook_44s_8={
145 {0},{0,0,&_44c8_s_p1_0},{0,0,&_44c8_s_p2_0},{0,0,&_44c8_s_p3_0},
147 {&_44c8_s_p5_0,&_44c8_s_p5_1},
148 {&_44c8_s_p6_0,&_44c8_s_p6_1},
149 {&_44c8_s_p7_0,&_44c8_s_p7_1},
150 {&_44c8_s_p8_0,&_44c8_s_p8_1},
151 {&_44c8_s_p9_0,&_44c8_s_p9_1,&_44c8_s_p9_2}
154 static static_bookblock _resbook_44s_9={
156 {0},{0,0,&_44c9_s_p1_0},{0,0,&_44c9_s_p2_0},{0,0,&_44c9_s_p3_0},
158 {&_44c9_s_p5_0,&_44c9_s_p5_1},
159 {&_44c9_s_p6_0,&_44c9_s_p6_1},
160 {&_44c9_s_p7_0,&_44c9_s_p7_1},
161 {&_44c9_s_p8_0,&_44c9_s_p8_1},
162 {&_44c9_s_p9_0,&_44c9_s_p9_1,&_44c9_s_p9_2}
167 static vorbis_residue_template _res_44s_0[]={
168 {2,0, &_residue_44_mid,
169 &_huff_book__44c0_s_short,&_huff_book__44c0_sm_short,
170 &_resbook_44s_0,&_resbook_44sm_0},
172 {2,0, &_residue_44_mid,
173 &_huff_book__44c0_s_long,&_huff_book__44c0_sm_long,
174 &_resbook_44s_0,&_resbook_44sm_0}
176 static vorbis_residue_template _res_44s_1[]={
177 {2,0, &_residue_44_mid,
178 &_huff_book__44c1_s_short,&_huff_book__44c1_sm_short,
179 &_resbook_44s_1,&_resbook_44sm_1},
181 {2,0, &_residue_44_mid,
182 &_huff_book__44c1_s_long,&_huff_book__44c1_sm_long,
183 &_resbook_44s_1,&_resbook_44sm_1}
185 static vorbis_residue_template _res_44s_2[]={
186 {2,0, &_residue_44_mid,
187 &_huff_book__44c2_s_short,&_huff_book__44c2_sm_short,
188 &_resbook_44s_2,&_resbook_44s_2},
190 {2,0, &_residue_44_mid,
191 &_huff_book__44c2_s_long,&_huff_book__44c2_sm_long,
192 &_resbook_44s_2,&_resbook_44s_2}
194 static vorbis_residue_template _res_44s_3[]={
195 {2,0, &_residue_44_mid,
196 &_huff_book__44c3_s_short,&_huff_book__44c3_sm_short,
197 &_resbook_44s_3,&_resbook_44s_3},
199 {2,0, &_residue_44_mid,
200 &_huff_book__44c3_s_long,&_huff_book__44c3_sm_long,
201 &_resbook_44s_3,&_resbook_44s_3}
203 static vorbis_residue_template _res_44s_4[]={
204 {2,0, &_residue_44_mid,
205 &_huff_book__44c4_s_short,&_huff_book__44c4_sm_short,
206 &_resbook_44s_4,&_resbook_44s_4},
208 {2,0, &_residue_44_mid,
209 &_huff_book__44c4_s_long,&_huff_book__44c4_sm_long,
210 &_resbook_44s_4,&_resbook_44s_4}
212 static vorbis_residue_template _res_44s_5[]={
213 {2,0, &_residue_44_mid,
214 &_huff_book__44c5_s_short,&_huff_book__44c5_sm_short,
215 &_resbook_44s_5,&_resbook_44s_5},
217 {2,0, &_residue_44_mid,
218 &_huff_book__44c5_s_long,&_huff_book__44c5_sm_long,
219 &_resbook_44s_5,&_resbook_44s_5}
221 static vorbis_residue_template _res_44s_6[]={
222 {2,0, &_residue_44_high,
223 &_huff_book__44c6_s_short,&_huff_book__44c6_sm_short,
224 &_resbook_44s_6,&_resbook_44s_6},
226 {2,0, &_residue_44_high,
227 &_huff_book__44c6_s_long,&_huff_book__44c6_sm_long,
228 &_resbook_44s_6,&_resbook_44s_6}
230 static vorbis_residue_template _res_44s_7[]={
231 {2,0, &_residue_44_high,
232 &_huff_book__44c7_s_short,&_huff_book__44c7_sm_short,
233 &_resbook_44s_7,&_resbook_44s_7},
235 {2,0, &_residue_44_high,
236 &_huff_book__44c7_s_long,&_huff_book__44c7_sm_long,
237 &_resbook_44s_7,&_resbook_44s_7}
239 static vorbis_residue_template _res_44s_8[]={
240 {2,0, &_residue_44_high,
241 &_huff_book__44c8_s_short,&_huff_book__44c8_sm_short,
242 &_resbook_44s_8,&_resbook_44s_8},
244 {2,0, &_residue_44_high,
245 &_huff_book__44c8_s_long,&_huff_book__44c8_sm_long,
246 &_resbook_44s_8,&_resbook_44s_8}
248 static vorbis_residue_template _res_44s_9[]={
249 {2,0, &_residue_44_high,
250 &_huff_book__44c9_s_short,&_huff_book__44c9_sm_short,
251 &_resbook_44s_9,&_resbook_44s_9},
253 {2,0, &_residue_44_high,
254 &_huff_book__44c9_s_long,&_huff_book__44c9_sm_long,
255 &_resbook_44s_9,&_resbook_44s_9}
259 static vorbis_mapping_template _mapres_template_44_stereo[]={
260 { _map_nominal, _res_44s_0 }, /* 0 */
261 { _map_nominal, _res_44s_1 }, /* 1 */
262 { _map_nominal, _res_44s_2 }, /* 2 */
263 { _map_nominal, _res_44s_3 }, /* 3 */
264 { _map_nominal, _res_44s_4 }, /* 4 */
265 { _map_nominal, _res_44s_5 }, /* 5 */
266 { _map_nominal, _res_44s_6 }, /* 6 */
267 { _map_nominal, _res_44s_7 }, /* 7 */
268 { _map_nominal, _res_44s_8 }, /* 8 */
269 { _map_nominal, _res_44s_9 }, /* 9 */