residue_44.h 9.7 KB

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