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-2009 * 9 * by the Xiph.Org Foundation https://xiph.org/ * 10 * * 11 ******************************************************************** 12 13 function: toplevel residue templates for 32/44.1/48kHz 14 15 ********************************************************************/ 16 17 #include "vorbis/codec.h" 18 #include "backends.h" 19 #include "books/coupled/res_books_stereo.h" 20 21 /***** residue backends *********************************************/ 22 23 static const vorbis_info_residue0 _residue_44_low={ 24 0,-1, -1, 9,-1,-1, 25 /* 0 1 2 3 4 5 6 7 */ 26 {0}, 27 {-1}, 28 { 0, 1, 2, 2, 4, 8, 16, 32}, 29 { 0, 0, 0,999, 4, 8, 16, 32}, 30 }; 31 32 static const vorbis_info_residue0 _residue_44_mid={ 33 0,-1, -1, 10,-1,-1, 34 /* 0 1 2 3 4 5 6 7 8 */ 35 {0}, 36 {-1}, 37 { 0, 1, 1, 2, 2, 4, 8, 16, 32}, 38 { 0, 0,999, 0,999, 4, 8, 16, 32}, 39 }; 40 41 static const vorbis_info_residue0 _residue_44_high={ 42 0,-1, -1, 10,-1,-1, 43 /* 0 1 2 3 4 5 6 7 8 */ 44 {0}, 45 {-1}, 46 { 0, 1, 2, 4, 8, 16, 32, 71,157}, 47 { 0, 1, 2, 3, 4, 8, 16, 71,157}, 48 }; 49 50 static const static_bookblock _resbook_44s_n1={ 51 { 52 {0},{0,0,&_44cn1_s_p1_0},{0,0,&_44cn1_s_p2_0}, 53 {0,0,&_44cn1_s_p3_0},{0,0,&_44cn1_s_p4_0},{0,0,&_44cn1_s_p5_0}, 54 {&_44cn1_s_p6_0,&_44cn1_s_p6_1},{&_44cn1_s_p7_0,&_44cn1_s_p7_1}, 55 {&_44cn1_s_p8_0,&_44cn1_s_p8_1,&_44cn1_s_p8_2} 56 } 57 }; 58 static const static_bookblock _resbook_44sm_n1={ 59 { 60 {0},{0,0,&_44cn1_sm_p1_0},{0,0,&_44cn1_sm_p2_0}, 61 {0,0,&_44cn1_sm_p3_0},{0,0,&_44cn1_sm_p4_0},{0,0,&_44cn1_sm_p5_0}, 62 {&_44cn1_sm_p6_0,&_44cn1_sm_p6_1},{&_44cn1_sm_p7_0,&_44cn1_sm_p7_1}, 63 {&_44cn1_sm_p8_0,&_44cn1_sm_p8_1,&_44cn1_sm_p8_2} 64 } 65 }; 66 67 static const static_bookblock _resbook_44s_0={ 68 { 69 {0},{0,0,&_44c0_s_p1_0},{0,0,&_44c0_s_p2_0}, 70 {0,0,&_44c0_s_p3_0},{0,0,&_44c0_s_p4_0},{0,0,&_44c0_s_p5_0}, 71 {&_44c0_s_p6_0,&_44c0_s_p6_1},{&_44c0_s_p7_0,&_44c0_s_p7_1}, 72 {&_44c0_s_p8_0,&_44c0_s_p8_1,&_44c0_s_p8_2} 73 } 74 }; 75 static const static_bookblock _resbook_44sm_0={ 76 { 77 {0},{0,0,&_44c0_sm_p1_0},{0,0,&_44c0_sm_p2_0}, 78 {0,0,&_44c0_sm_p3_0},{0,0,&_44c0_sm_p4_0},{0,0,&_44c0_sm_p5_0}, 79 {&_44c0_sm_p6_0,&_44c0_sm_p6_1},{&_44c0_sm_p7_0,&_44c0_sm_p7_1}, 80 {&_44c0_sm_p8_0,&_44c0_sm_p8_1,&_44c0_sm_p8_2} 81 } 82 }; 83 84 static const static_bookblock _resbook_44s_1={ 85 { 86 {0},{0,0,&_44c1_s_p1_0},{0,0,&_44c1_s_p2_0}, 87 {0,0,&_44c1_s_p3_0},{0,0,&_44c1_s_p4_0},{0,0,&_44c1_s_p5_0}, 88 {&_44c1_s_p6_0,&_44c1_s_p6_1},{&_44c1_s_p7_0,&_44c1_s_p7_1}, 89 {&_44c1_s_p8_0,&_44c1_s_p8_1,&_44c1_s_p8_2} 90 } 91 }; 92 static const static_bookblock _resbook_44sm_1={ 93 { 94 {0},{0,0,&_44c1_sm_p1_0},{0,0,&_44c1_sm_p2_0}, 95 {0,0,&_44c1_sm_p3_0},{0,0,&_44c1_sm_p4_0},{0,0,&_44c1_sm_p5_0}, 96 {&_44c1_sm_p6_0,&_44c1_sm_p6_1},{&_44c1_sm_p7_0,&_44c1_sm_p7_1}, 97 {&_44c1_sm_p8_0,&_44c1_sm_p8_1,&_44c1_sm_p8_2} 98 } 99 }; 100 101 static const static_bookblock _resbook_44s_2={ 102 { 103 {0},{0,0,&_44c2_s_p1_0},{0,0,&_44c2_s_p2_0},{0,0,&_44c2_s_p3_0}, 104 {0,0,&_44c2_s_p4_0},{0,0,&_44c2_s_p5_0},{0,0,&_44c2_s_p6_0}, 105 {&_44c2_s_p7_0,&_44c2_s_p7_1},{&_44c2_s_p8_0,&_44c2_s_p8_1}, 106 {&_44c2_s_p9_0,&_44c2_s_p9_1,&_44c2_s_p9_2} 107 } 108 }; 109 static const static_bookblock _resbook_44s_3={ 110 { 111 {0},{0,0,&_44c3_s_p1_0},{0,0,&_44c3_s_p2_0},{0,0,&_44c3_s_p3_0}, 112 {0,0,&_44c3_s_p4_0},{0,0,&_44c3_s_p5_0},{0,0,&_44c3_s_p6_0}, 113 {&_44c3_s_p7_0,&_44c3_s_p7_1},{&_44c3_s_p8_0,&_44c3_s_p8_1}, 114 {&_44c3_s_p9_0,&_44c3_s_p9_1,&_44c3_s_p9_2} 115 } 116 }; 117 static const static_bookblock _resbook_44s_4={ 118 { 119 {0},{0,0,&_44c4_s_p1_0},{0,0,&_44c4_s_p2_0},{0,0,&_44c4_s_p3_0}, 120 {0,0,&_44c4_s_p4_0},{0,0,&_44c4_s_p5_0},{0,0,&_44c4_s_p6_0}, 121 {&_44c4_s_p7_0,&_44c4_s_p7_1},{&_44c4_s_p8_0,&_44c4_s_p8_1}, 122 {&_44c4_s_p9_0,&_44c4_s_p9_1,&_44c4_s_p9_2} 123 } 124 }; 125 static const static_bookblock _resbook_44s_5={ 126 { 127 {0},{0,0,&_44c5_s_p1_0},{0,0,&_44c5_s_p2_0},{0,0,&_44c5_s_p3_0}, 128 {0,0,&_44c5_s_p4_0},{0,0,&_44c5_s_p5_0},{0,0,&_44c5_s_p6_0}, 129 {&_44c5_s_p7_0,&_44c5_s_p7_1},{&_44c5_s_p8_0,&_44c5_s_p8_1}, 130 {&_44c5_s_p9_0,&_44c5_s_p9_1,&_44c5_s_p9_2} 131 } 132 }; 133 static const static_bookblock _resbook_44s_6={ 134 { 135 {0},{0,0,&_44c6_s_p1_0},{0,0,&_44c6_s_p2_0},{0,0,&_44c6_s_p3_0}, 136 {0,0,&_44c6_s_p4_0}, 137 {&_44c6_s_p5_0,&_44c6_s_p5_1}, 138 {&_44c6_s_p6_0,&_44c6_s_p6_1}, 139 {&_44c6_s_p7_0,&_44c6_s_p7_1}, 140 {&_44c6_s_p8_0,&_44c6_s_p8_1}, 141 {&_44c6_s_p9_0,&_44c6_s_p9_1,&_44c6_s_p9_2} 142 } 143 }; 144 static const static_bookblock _resbook_44s_7={ 145 { 146 {0},{0,0,&_44c7_s_p1_0},{0,0,&_44c7_s_p2_0},{0,0,&_44c7_s_p3_0}, 147 {0,0,&_44c7_s_p4_0}, 148 {&_44c7_s_p5_0,&_44c7_s_p5_1}, 149 {&_44c7_s_p6_0,&_44c7_s_p6_1}, 150 {&_44c7_s_p7_0,&_44c7_s_p7_1}, 151 {&_44c7_s_p8_0,&_44c7_s_p8_1}, 152 {&_44c7_s_p9_0,&_44c7_s_p9_1,&_44c7_s_p9_2} 153 } 154 }; 155 static const static_bookblock _resbook_44s_8={ 156 { 157 {0},{0,0,&_44c8_s_p1_0},{0,0,&_44c8_s_p2_0},{0,0,&_44c8_s_p3_0}, 158 {0,0,&_44c8_s_p4_0}, 159 {&_44c8_s_p5_0,&_44c8_s_p5_1}, 160 {&_44c8_s_p6_0,&_44c8_s_p6_1}, 161 {&_44c8_s_p7_0,&_44c8_s_p7_1}, 162 {&_44c8_s_p8_0,&_44c8_s_p8_1}, 163 {&_44c8_s_p9_0,&_44c8_s_p9_1,&_44c8_s_p9_2} 164 } 165 }; 166 static const static_bookblock _resbook_44s_9={ 167 { 168 {0},{0,0,&_44c9_s_p1_0},{0,0,&_44c9_s_p2_0},{0,0,&_44c9_s_p3_0}, 169 {0,0,&_44c9_s_p4_0}, 170 {&_44c9_s_p5_0,&_44c9_s_p5_1}, 171 {&_44c9_s_p6_0,&_44c9_s_p6_1}, 172 {&_44c9_s_p7_0,&_44c9_s_p7_1}, 173 {&_44c9_s_p8_0,&_44c9_s_p8_1}, 174 {&_44c9_s_p9_0,&_44c9_s_p9_1,&_44c9_s_p9_2} 175 } 176 }; 177 178 static const vorbis_residue_template _res_44s_n1[]={ 179 {2,0,32, &_residue_44_low, 180 &_huff_book__44cn1_s_short,&_huff_book__44cn1_sm_short, 181 &_resbook_44s_n1,&_resbook_44sm_n1}, 182 183 {2,0,32, &_residue_44_low, 184 &_huff_book__44cn1_s_long,&_huff_book__44cn1_sm_long, 185 &_resbook_44s_n1,&_resbook_44sm_n1} 186 }; 187 static const vorbis_residue_template _res_44s_0[]={ 188 {2,0,16, &_residue_44_low, 189 &_huff_book__44c0_s_short,&_huff_book__44c0_sm_short, 190 &_resbook_44s_0,&_resbook_44sm_0}, 191 192 {2,0,32, &_residue_44_low, 193 &_huff_book__44c0_s_long,&_huff_book__44c0_sm_long, 194 &_resbook_44s_0,&_resbook_44sm_0} 195 }; 196 static const vorbis_residue_template _res_44s_1[]={ 197 {2,0,16, &_residue_44_low, 198 &_huff_book__44c1_s_short,&_huff_book__44c1_sm_short, 199 &_resbook_44s_1,&_resbook_44sm_1}, 200 201 {2,0,32, &_residue_44_low, 202 &_huff_book__44c1_s_long,&_huff_book__44c1_sm_long, 203 &_resbook_44s_1,&_resbook_44sm_1} 204 }; 205 206 static const vorbis_residue_template _res_44s_2[]={ 207 {2,0,16, &_residue_44_mid, 208 &_huff_book__44c2_s_short,&_huff_book__44c2_s_short, 209 &_resbook_44s_2,&_resbook_44s_2}, 210 211 {2,0,32, &_residue_44_mid, 212 &_huff_book__44c2_s_long,&_huff_book__44c2_s_long, 213 &_resbook_44s_2,&_resbook_44s_2} 214 }; 215 static const vorbis_residue_template _res_44s_3[]={ 216 {2,0,16, &_residue_44_mid, 217 &_huff_book__44c3_s_short,&_huff_book__44c3_s_short, 218 &_resbook_44s_3,&_resbook_44s_3}, 219 220 {2,0,32, &_residue_44_mid, 221 &_huff_book__44c3_s_long,&_huff_book__44c3_s_long, 222 &_resbook_44s_3,&_resbook_44s_3} 223 }; 224 static const vorbis_residue_template _res_44s_4[]={ 225 {2,0,16, &_residue_44_mid, 226 &_huff_book__44c4_s_short,&_huff_book__44c4_s_short, 227 &_resbook_44s_4,&_resbook_44s_4}, 228 229 {2,0,32, &_residue_44_mid, 230 &_huff_book__44c4_s_long,&_huff_book__44c4_s_long, 231 &_resbook_44s_4,&_resbook_44s_4} 232 }; 233 static const vorbis_residue_template _res_44s_5[]={ 234 {2,0,16, &_residue_44_mid, 235 &_huff_book__44c5_s_short,&_huff_book__44c5_s_short, 236 &_resbook_44s_5,&_resbook_44s_5}, 237 238 {2,0,32, &_residue_44_mid, 239 &_huff_book__44c5_s_long,&_huff_book__44c5_s_long, 240 &_resbook_44s_5,&_resbook_44s_5} 241 }; 242 static const vorbis_residue_template _res_44s_6[]={ 243 {2,0,16, &_residue_44_high, 244 &_huff_book__44c6_s_short,&_huff_book__44c6_s_short, 245 &_resbook_44s_6,&_resbook_44s_6}, 246 247 {2,0,32, &_residue_44_high, 248 &_huff_book__44c6_s_long,&_huff_book__44c6_s_long, 249 &_resbook_44s_6,&_resbook_44s_6} 250 }; 251 static const vorbis_residue_template _res_44s_7[]={ 252 {2,0,16, &_residue_44_high, 253 &_huff_book__44c7_s_short,&_huff_book__44c7_s_short, 254 &_resbook_44s_7,&_resbook_44s_7}, 255 256 {2,0,32, &_residue_44_high, 257 &_huff_book__44c7_s_long,&_huff_book__44c7_s_long, 258 &_resbook_44s_7,&_resbook_44s_7} 259 }; 260 static const vorbis_residue_template _res_44s_8[]={ 261 {2,0,16, &_residue_44_high, 262 &_huff_book__44c8_s_short,&_huff_book__44c8_s_short, 263 &_resbook_44s_8,&_resbook_44s_8}, 264 265 {2,0,32, &_residue_44_high, 266 &_huff_book__44c8_s_long,&_huff_book__44c8_s_long, 267 &_resbook_44s_8,&_resbook_44s_8} 268 }; 269 static const vorbis_residue_template _res_44s_9[]={ 270 {2,0,16, &_residue_44_high, 271 &_huff_book__44c9_s_short,&_huff_book__44c9_s_short, 272 &_resbook_44s_9,&_resbook_44s_9}, 273 274 {2,0,32, &_residue_44_high, 275 &_huff_book__44c9_s_long,&_huff_book__44c9_s_long, 276 &_resbook_44s_9,&_resbook_44s_9} 277 }; 278 279 static const vorbis_mapping_template _mapres_template_44_stereo[]={ 280 { _map_nominal, _res_44s_n1 }, /* -1 */ 281 { _map_nominal, _res_44s_0 }, /* 0 */ 282 { _map_nominal, _res_44s_1 }, /* 1 */ 283 { _map_nominal, _res_44s_2 }, /* 2 */ 284 { _map_nominal, _res_44s_3 }, /* 3 */ 285 { _map_nominal, _res_44s_4 }, /* 4 */ 286 { _map_nominal, _res_44s_5 }, /* 5 */ 287 { _map_nominal, _res_44s_6 }, /* 6 */ 288 { _map_nominal, _res_44s_7 }, /* 7 */ 289 { _map_nominal, _res_44s_8 }, /* 8 */ 290 { _map_nominal, _res_44s_9 }, /* 9 */ 291 }; 292