residue_44p51.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451
  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-2010 *
  9. * by the Xiph.Org Foundation https://xiph.org/ *
  10. * *
  11. ********************************************************************
  12. function: toplevel residue templates for 32/44.1/48kHz uncoupled
  13. ********************************************************************/
  14. #include "vorbis/codec.h"
  15. #include "backends.h"
  16. #include "books/coupled/res_books_51.h"
  17. /***** residue backends *********************************************/
  18. static const vorbis_info_residue0 _residue_44p_lo={
  19. 0,-1, -1, 7,-1,-1,
  20. /* 0 1 2 3 4 5 6 7 8 */
  21. {0},
  22. {-1},
  23. { 0, 1, 2, 7, 17, 31},
  24. { 0, 0, 99, 7, 17, 31},
  25. };
  26. static const vorbis_info_residue0 _residue_44p={
  27. 0,-1, -1, 8,-1,-1,
  28. /* 0 1 2 3 4 5 6 7 8 */
  29. {0},
  30. {-1},
  31. { 0, 1, 1, 2, 7, 17, 31},
  32. { 0, 0, 99, 99, 7, 17, 31},
  33. };
  34. static const vorbis_info_residue0 _residue_44p_hi={
  35. 0,-1, -1, 8,-1,-1,
  36. /* 0 1 2 3 4 5 6 7 8 */
  37. {0},
  38. {-1},
  39. { 0, 1, 2, 4, 7, 17, 31},
  40. { 0, 1, 2, 4, 7, 17, 31},
  41. };
  42. static const vorbis_info_residue0 _residue_44p_lfe={
  43. 0,-1, -1, 2,-1,-1,
  44. /* 0 1 2 3 4 5 6 7 8 */
  45. {0},
  46. {-1},
  47. { 32},
  48. { -1}
  49. };
  50. static const static_bookblock _resbook_44p_n1={
  51. {
  52. {0},
  53. {0,&_44pn1_p1_0},
  54. {&_44pn1_p2_0,&_44pn1_p2_1,0},
  55. {&_44pn1_p3_0,&_44pn1_p3_1,0},
  56. {&_44pn1_p4_0,&_44pn1_p4_1,0},
  57. {&_44pn1_p5_0,&_44pn1_p5_1,&_44pn1_p4_1},
  58. {&_44pn1_p6_0,&_44pn1_p6_1,&_44pn1_p6_2},
  59. }
  60. };
  61. static const static_bookblock _resbook_44p_0={
  62. {
  63. {0},
  64. {0,&_44p0_p1_0},
  65. {&_44p0_p2_0,&_44p0_p2_1,0},
  66. {&_44p0_p3_0,&_44p0_p3_1,0},
  67. {&_44p0_p4_0,&_44p0_p4_1,0},
  68. {&_44p0_p5_0,&_44p0_p5_1,&_44p0_p4_1},
  69. {&_44p0_p6_0,&_44p0_p6_1,&_44p0_p6_2},
  70. }
  71. };
  72. static const static_bookblock _resbook_44p_1={
  73. {
  74. {0},
  75. {0,&_44p1_p1_0},
  76. {&_44p1_p2_0,&_44p1_p2_1,0},
  77. {&_44p1_p3_0,&_44p1_p3_1,0},
  78. {&_44p1_p4_0,&_44p1_p4_1,0},
  79. {&_44p1_p5_0,&_44p1_p5_1,&_44p1_p4_1},
  80. {&_44p1_p6_0,&_44p1_p6_1,&_44p1_p6_2},
  81. }
  82. };
  83. static const static_bookblock _resbook_44p_2={
  84. {
  85. {0},
  86. {0,0,&_44p2_p1_0},
  87. {0,&_44p2_p2_0,0},
  88. {&_44p2_p3_0,&_44p2_p3_1,0},
  89. {&_44p2_p4_0,&_44p2_p4_1,0},
  90. {&_44p2_p5_0,&_44p2_p5_1,0},
  91. {&_44p2_p6_0,&_44p2_p6_1,&_44p2_p5_1},
  92. {&_44p2_p7_0,&_44p2_p7_1,&_44p2_p7_2,&_44p2_p7_3}
  93. }
  94. };
  95. static const static_bookblock _resbook_44p_3={
  96. {
  97. {0},
  98. {0,0,&_44p3_p1_0},
  99. {0,&_44p3_p2_0,0},
  100. {&_44p3_p3_0,&_44p3_p3_1,0},
  101. {&_44p3_p4_0,&_44p3_p4_1,0},
  102. {&_44p3_p5_0,&_44p3_p5_1,0},
  103. {&_44p3_p6_0,&_44p3_p6_1,&_44p3_p5_1},
  104. {&_44p3_p7_0,&_44p3_p7_1,&_44p3_p7_2,&_44p3_p7_3}
  105. }
  106. };
  107. static const static_bookblock _resbook_44p_4={
  108. {
  109. {0},
  110. {0,0,&_44p4_p1_0},
  111. {0,&_44p4_p2_0,0},
  112. {&_44p4_p3_0,&_44p4_p3_1,0},
  113. {&_44p4_p4_0,&_44p4_p4_1,0},
  114. {&_44p4_p5_0,&_44p4_p5_1,0},
  115. {&_44p4_p6_0,&_44p4_p6_1,&_44p4_p5_1},
  116. {&_44p4_p7_0,&_44p4_p7_1,&_44p4_p7_2,&_44p4_p7_3}
  117. }
  118. };
  119. static const static_bookblock _resbook_44p_5={
  120. {
  121. {0},
  122. {0,0,&_44p5_p1_0},
  123. {0,&_44p5_p2_0,0},
  124. {&_44p5_p3_0,&_44p5_p3_1,0},
  125. {&_44p5_p4_0,&_44p5_p4_1,0},
  126. {&_44p5_p5_0,&_44p5_p5_1,0},
  127. {&_44p5_p6_0,&_44p5_p6_1,&_44p5_p5_1},
  128. {&_44p5_p7_0,&_44p5_p7_1,&_44p5_p7_2,&_44p5_p7_3}
  129. }
  130. };
  131. static const static_bookblock _resbook_44p_6={
  132. {
  133. {0},
  134. {0,0,&_44p6_p1_0},
  135. {0,&_44p6_p2_0,0},
  136. {&_44p6_p3_0,&_44p6_p3_1,0},
  137. {&_44p6_p4_0,&_44p6_p4_1,0},
  138. {&_44p6_p5_0,&_44p6_p5_1,0},
  139. {&_44p6_p6_0,&_44p6_p6_1,&_44p6_p5_1},
  140. {&_44p6_p7_0,&_44p6_p7_1,&_44p6_p7_2,&_44p6_p7_3}
  141. }
  142. };
  143. static const static_bookblock _resbook_44p_7={
  144. {
  145. {0},
  146. {0,0,&_44p7_p1_0},
  147. {0,&_44p7_p2_0,0},
  148. {&_44p7_p3_0,&_44p7_p3_1,0},
  149. {&_44p7_p4_0,&_44p7_p4_1,0},
  150. {&_44p7_p5_0,&_44p7_p5_1,0},
  151. {&_44p7_p6_0,&_44p7_p6_1,&_44p7_p5_1},
  152. {&_44p7_p7_0,&_44p7_p7_1,&_44p7_p7_2,&_44p7_p7_3}
  153. }
  154. };
  155. static const static_bookblock _resbook_44p_8={
  156. {
  157. {0},
  158. {0,0,&_44p8_p1_0},
  159. {0,&_44p8_p2_0,0},
  160. {&_44p8_p3_0,&_44p8_p3_1,0},
  161. {&_44p8_p4_0,&_44p8_p4_1,0},
  162. {&_44p8_p5_0,&_44p8_p5_1,0},
  163. {&_44p8_p6_0,&_44p8_p6_1,&_44p8_p5_1},
  164. {&_44p8_p7_0,&_44p8_p7_1,&_44p8_p7_2,&_44p8_p7_3}
  165. }
  166. };
  167. static const static_bookblock _resbook_44p_9={
  168. {
  169. {0},
  170. {0,0,&_44p9_p1_0},
  171. {0,&_44p9_p2_0,0},
  172. {&_44p9_p3_0,&_44p9_p3_1,0},
  173. {&_44p9_p4_0,&_44p9_p4_1,0},
  174. {&_44p9_p5_0,&_44p9_p5_1,0},
  175. {&_44p9_p6_0,&_44p9_p6_1,&_44p9_p5_1},
  176. {&_44p9_p7_0,&_44p9_p7_1,&_44p9_p7_2,&_44p9_p7_3}
  177. }
  178. };
  179. static const static_bookblock _resbook_44p_ln1={
  180. {
  181. {&_44pn1_l0_0,&_44pn1_l0_1,0},
  182. {&_44pn1_l1_0,&_44pn1_p6_1,&_44pn1_p6_2},
  183. }
  184. };
  185. static const static_bookblock _resbook_44p_l0={
  186. {
  187. {&_44p0_l0_0,&_44p0_l0_1,0},
  188. {&_44p0_l1_0,&_44p0_p6_1,&_44p0_p6_2},
  189. }
  190. };
  191. static const static_bookblock _resbook_44p_l1={
  192. {
  193. {&_44p1_l0_0,&_44p1_l0_1,0},
  194. {&_44p1_l1_0,&_44p1_p6_1,&_44p1_p6_2},
  195. }
  196. };
  197. static const static_bookblock _resbook_44p_l2={
  198. {
  199. {&_44p2_l0_0,&_44p2_l0_1,0},
  200. {&_44p2_l1_0,&_44p2_p7_2,&_44p2_p7_3},
  201. }
  202. };
  203. static const static_bookblock _resbook_44p_l3={
  204. {
  205. {&_44p3_l0_0,&_44p3_l0_1,0},
  206. {&_44p3_l1_0,&_44p3_p7_2,&_44p3_p7_3},
  207. }
  208. };
  209. static const static_bookblock _resbook_44p_l4={
  210. {
  211. {&_44p4_l0_0,&_44p4_l0_1,0},
  212. {&_44p4_l1_0,&_44p4_p7_2,&_44p4_p7_3},
  213. }
  214. };
  215. static const static_bookblock _resbook_44p_l5={
  216. {
  217. {&_44p5_l0_0,&_44p5_l0_1,0},
  218. {&_44p5_l1_0,&_44p5_p7_2,&_44p5_p7_3},
  219. }
  220. };
  221. static const static_bookblock _resbook_44p_l6={
  222. {
  223. {&_44p6_l0_0,&_44p6_l0_1,0},
  224. {&_44p6_l1_0,&_44p6_p7_2,&_44p6_p7_3},
  225. }
  226. };
  227. static const static_bookblock _resbook_44p_l7={
  228. {
  229. {&_44p7_l0_0,&_44p7_l0_1,0},
  230. {&_44p7_l1_0,&_44p7_p7_2,&_44p7_p7_3},
  231. }
  232. };
  233. static const static_bookblock _resbook_44p_l8={
  234. {
  235. {&_44p8_l0_0,&_44p8_l0_1,0},
  236. {&_44p8_l1_0,&_44p8_p7_2,&_44p8_p7_3},
  237. }
  238. };
  239. static const static_bookblock _resbook_44p_l9={
  240. {
  241. {&_44p9_l0_0,&_44p9_l0_1,0},
  242. {&_44p9_l1_0,&_44p9_p7_2,&_44p9_p7_3},
  243. }
  244. };
  245. static const vorbis_info_mapping0 _map_nominal_51[2]={
  246. {2, {0,0,0,0,0,1}, {0,2}, {0,2}, 4,{0,3,0,0},{2,4,1,3}},
  247. {2, {0,0,0,0,0,1}, {1,2}, {1,2}, 4,{0,3,0,0},{2,4,1,3}}
  248. };
  249. static const vorbis_info_mapping0 _map_nominal_51u[2]={
  250. {2, {0,0,0,0,0,1}, {0,2}, {0,2}, 0,{0},{0}},
  251. {2, {0,0,0,0,0,1}, {1,2}, {1,2}, 0,{0},{0}}
  252. };
  253. static const vorbis_residue_template _res_44p51_n1[]={
  254. {2,0,30, &_residue_44p_lo,
  255. &_huff_book__44pn1_short,&_huff_book__44pn1_short,
  256. &_resbook_44p_n1,&_resbook_44p_n1},
  257. {2,0,30, &_residue_44p_lo,
  258. &_huff_book__44pn1_long,&_huff_book__44pn1_long,
  259. &_resbook_44p_n1,&_resbook_44p_n1},
  260. {1,2,6, &_residue_44p_lfe,
  261. &_huff_book__44pn1_lfe,&_huff_book__44pn1_lfe,
  262. &_resbook_44p_ln1,&_resbook_44p_ln1}
  263. };
  264. static const vorbis_residue_template _res_44p51_0[]={
  265. {2,0,15, &_residue_44p_lo,
  266. &_huff_book__44p0_short,&_huff_book__44p0_short,
  267. &_resbook_44p_0,&_resbook_44p_0},
  268. {2,0,30, &_residue_44p_lo,
  269. &_huff_book__44p0_long,&_huff_book__44p0_long,
  270. &_resbook_44p_0,&_resbook_44p_0},
  271. {1,2,6, &_residue_44p_lfe,
  272. &_huff_book__44p0_lfe,&_huff_book__44p0_lfe,
  273. &_resbook_44p_l0,&_resbook_44p_l0}
  274. };
  275. static const vorbis_residue_template _res_44p51_1[]={
  276. {2,0,15, &_residue_44p_lo,
  277. &_huff_book__44p1_short,&_huff_book__44p1_short,
  278. &_resbook_44p_1,&_resbook_44p_1},
  279. {2,0,30, &_residue_44p_lo,
  280. &_huff_book__44p1_long,&_huff_book__44p1_long,
  281. &_resbook_44p_1,&_resbook_44p_1},
  282. {1,2,6, &_residue_44p_lfe,
  283. &_huff_book__44p1_lfe,&_huff_book__44p1_lfe,
  284. &_resbook_44p_l1,&_resbook_44p_l1}
  285. };
  286. static const vorbis_residue_template _res_44p51_2[]={
  287. {2,0,15, &_residue_44p,
  288. &_huff_book__44p2_short,&_huff_book__44p2_short,
  289. &_resbook_44p_2,&_resbook_44p_2},
  290. {2,0,30, &_residue_44p,
  291. &_huff_book__44p2_long,&_huff_book__44p2_long,
  292. &_resbook_44p_2,&_resbook_44p_2},
  293. {1,2,6, &_residue_44p_lfe,
  294. &_huff_book__44p2_lfe,&_huff_book__44p2_lfe,
  295. &_resbook_44p_l2,&_resbook_44p_l2}
  296. };
  297. static const vorbis_residue_template _res_44p51_3[]={
  298. {2,0,15, &_residue_44p,
  299. &_huff_book__44p3_short,&_huff_book__44p3_short,
  300. &_resbook_44p_3,&_resbook_44p_3},
  301. {2,0,30, &_residue_44p,
  302. &_huff_book__44p3_long,&_huff_book__44p3_long,
  303. &_resbook_44p_3,&_resbook_44p_3},
  304. {1,2,6, &_residue_44p_lfe,
  305. &_huff_book__44p3_lfe,&_huff_book__44p3_lfe,
  306. &_resbook_44p_l3,&_resbook_44p_l3}
  307. };
  308. static const vorbis_residue_template _res_44p51_4[]={
  309. {2,0,15, &_residue_44p,
  310. &_huff_book__44p4_short,&_huff_book__44p4_short,
  311. &_resbook_44p_4,&_resbook_44p_4},
  312. {2,0,30, &_residue_44p,
  313. &_huff_book__44p4_long,&_huff_book__44p4_long,
  314. &_resbook_44p_4,&_resbook_44p_4},
  315. {1,2,6, &_residue_44p_lfe,
  316. &_huff_book__44p4_lfe,&_huff_book__44p4_lfe,
  317. &_resbook_44p_l4,&_resbook_44p_l4}
  318. };
  319. static const vorbis_residue_template _res_44p51_5[]={
  320. {2,0,15, &_residue_44p_hi,
  321. &_huff_book__44p5_short,&_huff_book__44p5_short,
  322. &_resbook_44p_5,&_resbook_44p_5},
  323. {2,0,30, &_residue_44p_hi,
  324. &_huff_book__44p5_long,&_huff_book__44p5_long,
  325. &_resbook_44p_5,&_resbook_44p_5},
  326. {1,2,6, &_residue_44p_lfe,
  327. &_huff_book__44p5_lfe,&_huff_book__44p5_lfe,
  328. &_resbook_44p_l5,&_resbook_44p_l5}
  329. };
  330. static const vorbis_residue_template _res_44p51_6[]={
  331. {2,0,15, &_residue_44p_hi,
  332. &_huff_book__44p6_short,&_huff_book__44p6_short,
  333. &_resbook_44p_6,&_resbook_44p_6},
  334. {2,0,30, &_residue_44p_hi,
  335. &_huff_book__44p6_long,&_huff_book__44p6_long,
  336. &_resbook_44p_6,&_resbook_44p_6},
  337. {1,2,6, &_residue_44p_lfe,
  338. &_huff_book__44p6_lfe,&_huff_book__44p6_lfe,
  339. &_resbook_44p_l6,&_resbook_44p_l6}
  340. };
  341. static const vorbis_residue_template _res_44p51_7[]={
  342. {2,0,15, &_residue_44p_hi,
  343. &_huff_book__44p7_short,&_huff_book__44p7_short,
  344. &_resbook_44p_7,&_resbook_44p_7},
  345. {2,0,30, &_residue_44p_hi,
  346. &_huff_book__44p7_long,&_huff_book__44p7_long,
  347. &_resbook_44p_7,&_resbook_44p_7},
  348. {1,2,6, &_residue_44p_lfe,
  349. &_huff_book__44p6_lfe,&_huff_book__44p6_lfe,
  350. &_resbook_44p_l6,&_resbook_44p_l6}
  351. };
  352. static const vorbis_residue_template _res_44p51_8[]={
  353. {2,0,15, &_residue_44p_hi,
  354. &_huff_book__44p8_short,&_huff_book__44p8_short,
  355. &_resbook_44p_8,&_resbook_44p_8},
  356. {2,0,30, &_residue_44p_hi,
  357. &_huff_book__44p8_long,&_huff_book__44p8_long,
  358. &_resbook_44p_8,&_resbook_44p_8},
  359. {1,2,6, &_residue_44p_lfe,
  360. &_huff_book__44p6_lfe,&_huff_book__44p6_lfe,
  361. &_resbook_44p_l6,&_resbook_44p_l6}
  362. };
  363. static const vorbis_residue_template _res_44p51_9[]={
  364. {2,0,15, &_residue_44p_hi,
  365. &_huff_book__44p9_short,&_huff_book__44p9_short,
  366. &_resbook_44p_9,&_resbook_44p_9},
  367. {2,0,30, &_residue_44p_hi,
  368. &_huff_book__44p9_long,&_huff_book__44p9_long,
  369. &_resbook_44p_9,&_resbook_44p_9},
  370. {1,2,6, &_residue_44p_lfe,
  371. &_huff_book__44p6_lfe,&_huff_book__44p6_lfe,
  372. &_resbook_44p_l6,&_resbook_44p_l6}
  373. };
  374. static const vorbis_mapping_template _mapres_template_44_51[]={
  375. { _map_nominal_51, _res_44p51_n1 }, /* -1 */
  376. { _map_nominal_51, _res_44p51_0 }, /* 0 */
  377. { _map_nominal_51, _res_44p51_1 }, /* 1 */
  378. { _map_nominal_51, _res_44p51_2 }, /* 2 */
  379. { _map_nominal_51, _res_44p51_3 }, /* 3 */
  380. { _map_nominal_51, _res_44p51_4 }, /* 4 */
  381. { _map_nominal_51u, _res_44p51_5 }, /* 5 */
  382. { _map_nominal_51u, _res_44p51_6 }, /* 6 */
  383. { _map_nominal_51u, _res_44p51_7 }, /* 7 */
  384. { _map_nominal_51u, _res_44p51_8 }, /* 8 */
  385. { _map_nominal_51u, _res_44p51_9 }, /* 9 */
  386. };