residue_44u.h 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  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-2007 *
  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/uncoupled/res_books_uncoupled.h"
  17. /***** residue backends *********************************************/
  18. static const vorbis_info_residue0 _residue_44_low_un={
  19. 0,-1, -1, 8,-1,-1,
  20. {0},
  21. {-1},
  22. { 0, 1, 1, 2, 2, 4, 28},
  23. { -1, 25, -1, 45, -1, -1, -1}
  24. };
  25. static const vorbis_info_residue0 _residue_44_mid_un={
  26. 0,-1, -1, 10,-1,-1,
  27. /* 0 1 2 3 4 5 6 7 8 9 */
  28. {0},
  29. {-1},
  30. { 0, 1, 1, 2, 2, 4, 4, 16, 60},
  31. { -1, 30, -1, 50, -1, 80, -1, -1, -1}
  32. };
  33. static const vorbis_info_residue0 _residue_44_hi_un={
  34. 0,-1, -1, 10,-1,-1,
  35. /* 0 1 2 3 4 5 6 7 8 9 */
  36. {0},
  37. {-1},
  38. { 0, 1, 2, 4, 8, 16, 32, 71,157},
  39. { -1, -1, -1, -1, -1, -1, -1, -1, -1}
  40. };
  41. /* mapping conventions:
  42. only one submap (this would change for efficient 5.1 support for example)*/
  43. /* Four psychoacoustic profiles are used, one for each blocktype */
  44. static const vorbis_info_mapping0 _map_nominal_u[2]={
  45. {1, {0,0,0,0,0,0}, {0}, {0}, 0,{0},{0}},
  46. {1, {0,0,0,0,0,0}, {1}, {1}, 0,{0},{0}}
  47. };
  48. static const static_bookblock _resbook_44u_n1={
  49. {
  50. {0},
  51. {0,0,&_44un1__p1_0},
  52. {0,0,&_44un1__p2_0},
  53. {0,0,&_44un1__p3_0},
  54. {0,0,&_44un1__p4_0},
  55. {0,0,&_44un1__p5_0},
  56. {&_44un1__p6_0,&_44un1__p6_1},
  57. {&_44un1__p7_0,&_44un1__p7_1,&_44un1__p7_2}
  58. }
  59. };
  60. static const static_bookblock _resbook_44u_0={
  61. {
  62. {0},
  63. {0,0,&_44u0__p1_0},
  64. {0,0,&_44u0__p2_0},
  65. {0,0,&_44u0__p3_0},
  66. {0,0,&_44u0__p4_0},
  67. {0,0,&_44u0__p5_0},
  68. {&_44u0__p6_0,&_44u0__p6_1},
  69. {&_44u0__p7_0,&_44u0__p7_1,&_44u0__p7_2}
  70. }
  71. };
  72. static const static_bookblock _resbook_44u_1={
  73. {
  74. {0},
  75. {0,0,&_44u1__p1_0},
  76. {0,0,&_44u1__p2_0},
  77. {0,0,&_44u1__p3_0},
  78. {0,0,&_44u1__p4_0},
  79. {0,0,&_44u1__p5_0},
  80. {&_44u1__p6_0,&_44u1__p6_1},
  81. {&_44u1__p7_0,&_44u1__p7_1,&_44u1__p7_2}
  82. }
  83. };
  84. static const static_bookblock _resbook_44u_2={
  85. {
  86. {0},
  87. {0,0,&_44u2__p1_0},
  88. {0,0,&_44u2__p2_0},
  89. {0,0,&_44u2__p3_0},
  90. {0,0,&_44u2__p4_0},
  91. {0,0,&_44u2__p5_0},
  92. {&_44u2__p6_0,&_44u2__p6_1},
  93. {&_44u2__p7_0,&_44u2__p7_1,&_44u2__p7_2}
  94. }
  95. };
  96. static const static_bookblock _resbook_44u_3={
  97. {
  98. {0},
  99. {0,0,&_44u3__p1_0},
  100. {0,0,&_44u3__p2_0},
  101. {0,0,&_44u3__p3_0},
  102. {0,0,&_44u3__p4_0},
  103. {0,0,&_44u3__p5_0},
  104. {&_44u3__p6_0,&_44u3__p6_1},
  105. {&_44u3__p7_0,&_44u3__p7_1,&_44u3__p7_2}
  106. }
  107. };
  108. static const static_bookblock _resbook_44u_4={
  109. {
  110. {0},
  111. {0,0,&_44u4__p1_0},
  112. {0,0,&_44u4__p2_0},
  113. {0,0,&_44u4__p3_0},
  114. {0,0,&_44u4__p4_0},
  115. {0,0,&_44u4__p5_0},
  116. {&_44u4__p6_0,&_44u4__p6_1},
  117. {&_44u4__p7_0,&_44u4__p7_1,&_44u4__p7_2}
  118. }
  119. };
  120. static const static_bookblock _resbook_44u_5={
  121. {
  122. {0},
  123. {0,0,&_44u5__p1_0},
  124. {0,0,&_44u5__p2_0},
  125. {0,0,&_44u5__p3_0},
  126. {0,0,&_44u5__p4_0},
  127. {0,0,&_44u5__p5_0},
  128. {0,0,&_44u5__p6_0},
  129. {&_44u5__p7_0,&_44u5__p7_1},
  130. {&_44u5__p8_0,&_44u5__p8_1},
  131. {&_44u5__p9_0,&_44u5__p9_1,&_44u5__p9_2}
  132. }
  133. };
  134. static const static_bookblock _resbook_44u_6={
  135. {
  136. {0},
  137. {0,0,&_44u6__p1_0},
  138. {0,0,&_44u6__p2_0},
  139. {0,0,&_44u6__p3_0},
  140. {0,0,&_44u6__p4_0},
  141. {0,0,&_44u6__p5_0},
  142. {0,0,&_44u6__p6_0},
  143. {&_44u6__p7_0,&_44u6__p7_1},
  144. {&_44u6__p8_0,&_44u6__p8_1},
  145. {&_44u6__p9_0,&_44u6__p9_1,&_44u6__p9_2}
  146. }
  147. };
  148. static const static_bookblock _resbook_44u_7={
  149. {
  150. {0},
  151. {0,0,&_44u7__p1_0},
  152. {0,0,&_44u7__p2_0},
  153. {0,0,&_44u7__p3_0},
  154. {0,0,&_44u7__p4_0},
  155. {0,0,&_44u7__p5_0},
  156. {0,0,&_44u7__p6_0},
  157. {&_44u7__p7_0,&_44u7__p7_1},
  158. {&_44u7__p8_0,&_44u7__p8_1},
  159. {&_44u7__p9_0,&_44u7__p9_1,&_44u7__p9_2}
  160. }
  161. };
  162. static const static_bookblock _resbook_44u_8={
  163. {
  164. {0},
  165. {0,0,&_44u8_p1_0},
  166. {0,0,&_44u8_p2_0},
  167. {0,0,&_44u8_p3_0},
  168. {0,0,&_44u8_p4_0},
  169. {&_44u8_p5_0,&_44u8_p5_1},
  170. {&_44u8_p6_0,&_44u8_p6_1},
  171. {&_44u8_p7_0,&_44u8_p7_1},
  172. {&_44u8_p8_0,&_44u8_p8_1},
  173. {&_44u8_p9_0,&_44u8_p9_1,&_44u8_p9_2}
  174. }
  175. };
  176. static const static_bookblock _resbook_44u_9={
  177. {
  178. {0},
  179. {0,0,&_44u9_p1_0},
  180. {0,0,&_44u9_p2_0},
  181. {0,0,&_44u9_p3_0},
  182. {0,0,&_44u9_p4_0},
  183. {&_44u9_p5_0,&_44u9_p5_1},
  184. {&_44u9_p6_0,&_44u9_p6_1},
  185. {&_44u9_p7_0,&_44u9_p7_1},
  186. {&_44u9_p8_0,&_44u9_p8_1},
  187. {&_44u9_p9_0,&_44u9_p9_1,&_44u9_p9_2}
  188. }
  189. };
  190. static const vorbis_residue_template _res_44u_n1[]={
  191. {1,0,32, &_residue_44_low_un,
  192. &_huff_book__44un1__short,&_huff_book__44un1__short,
  193. &_resbook_44u_n1,&_resbook_44u_n1},
  194. {1,0,32, &_residue_44_low_un,
  195. &_huff_book__44un1__long,&_huff_book__44un1__long,
  196. &_resbook_44u_n1,&_resbook_44u_n1}
  197. };
  198. static const vorbis_residue_template _res_44u_0[]={
  199. {1,0,16, &_residue_44_low_un,
  200. &_huff_book__44u0__short,&_huff_book__44u0__short,
  201. &_resbook_44u_0,&_resbook_44u_0},
  202. {1,0,32, &_residue_44_low_un,
  203. &_huff_book__44u0__long,&_huff_book__44u0__long,
  204. &_resbook_44u_0,&_resbook_44u_0}
  205. };
  206. static const vorbis_residue_template _res_44u_1[]={
  207. {1,0,16, &_residue_44_low_un,
  208. &_huff_book__44u1__short,&_huff_book__44u1__short,
  209. &_resbook_44u_1,&_resbook_44u_1},
  210. {1,0,32, &_residue_44_low_un,
  211. &_huff_book__44u1__long,&_huff_book__44u1__long,
  212. &_resbook_44u_1,&_resbook_44u_1}
  213. };
  214. static const vorbis_residue_template _res_44u_2[]={
  215. {1,0,16, &_residue_44_low_un,
  216. &_huff_book__44u2__short,&_huff_book__44u2__short,
  217. &_resbook_44u_2,&_resbook_44u_2},
  218. {1,0,32, &_residue_44_low_un,
  219. &_huff_book__44u2__long,&_huff_book__44u2__long,
  220. &_resbook_44u_2,&_resbook_44u_2}
  221. };
  222. static const vorbis_residue_template _res_44u_3[]={
  223. {1,0,16, &_residue_44_low_un,
  224. &_huff_book__44u3__short,&_huff_book__44u3__short,
  225. &_resbook_44u_3,&_resbook_44u_3},
  226. {1,0,32, &_residue_44_low_un,
  227. &_huff_book__44u3__long,&_huff_book__44u3__long,
  228. &_resbook_44u_3,&_resbook_44u_3}
  229. };
  230. static const vorbis_residue_template _res_44u_4[]={
  231. {1,0,16, &_residue_44_low_un,
  232. &_huff_book__44u4__short,&_huff_book__44u4__short,
  233. &_resbook_44u_4,&_resbook_44u_4},
  234. {1,0,32, &_residue_44_low_un,
  235. &_huff_book__44u4__long,&_huff_book__44u4__long,
  236. &_resbook_44u_4,&_resbook_44u_4}
  237. };
  238. static const vorbis_residue_template _res_44u_5[]={
  239. {1,0,16, &_residue_44_mid_un,
  240. &_huff_book__44u5__short,&_huff_book__44u5__short,
  241. &_resbook_44u_5,&_resbook_44u_5},
  242. {1,0,32, &_residue_44_mid_un,
  243. &_huff_book__44u5__long,&_huff_book__44u5__long,
  244. &_resbook_44u_5,&_resbook_44u_5}
  245. };
  246. static const vorbis_residue_template _res_44u_6[]={
  247. {1,0,16, &_residue_44_mid_un,
  248. &_huff_book__44u6__short,&_huff_book__44u6__short,
  249. &_resbook_44u_6,&_resbook_44u_6},
  250. {1,0,32, &_residue_44_mid_un,
  251. &_huff_book__44u6__long,&_huff_book__44u6__long,
  252. &_resbook_44u_6,&_resbook_44u_6}
  253. };
  254. static const vorbis_residue_template _res_44u_7[]={
  255. {1,0,16, &_residue_44_mid_un,
  256. &_huff_book__44u7__short,&_huff_book__44u7__short,
  257. &_resbook_44u_7,&_resbook_44u_7},
  258. {1,0,32, &_residue_44_mid_un,
  259. &_huff_book__44u7__long,&_huff_book__44u7__long,
  260. &_resbook_44u_7,&_resbook_44u_7}
  261. };
  262. static const vorbis_residue_template _res_44u_8[]={
  263. {1,0,16, &_residue_44_hi_un,
  264. &_huff_book__44u8__short,&_huff_book__44u8__short,
  265. &_resbook_44u_8,&_resbook_44u_8},
  266. {1,0,32, &_residue_44_hi_un,
  267. &_huff_book__44u8__long,&_huff_book__44u8__long,
  268. &_resbook_44u_8,&_resbook_44u_8}
  269. };
  270. static const vorbis_residue_template _res_44u_9[]={
  271. {1,0,16, &_residue_44_hi_un,
  272. &_huff_book__44u9__short,&_huff_book__44u9__short,
  273. &_resbook_44u_9,&_resbook_44u_9},
  274. {1,0,32, &_residue_44_hi_un,
  275. &_huff_book__44u9__long,&_huff_book__44u9__long,
  276. &_resbook_44u_9,&_resbook_44u_9}
  277. };
  278. static const vorbis_mapping_template _mapres_template_44_uncoupled[]={
  279. { _map_nominal_u, _res_44u_n1 }, /* -1 */
  280. { _map_nominal_u, _res_44u_0 }, /* 0 */
  281. { _map_nominal_u, _res_44u_1 }, /* 1 */
  282. { _map_nominal_u, _res_44u_2 }, /* 2 */
  283. { _map_nominal_u, _res_44u_3 }, /* 3 */
  284. { _map_nominal_u, _res_44u_4 }, /* 4 */
  285. { _map_nominal_u, _res_44u_5 }, /* 5 */
  286. { _map_nominal_u, _res_44u_6 }, /* 6 */
  287. { _map_nominal_u, _res_44u_7 }, /* 7 */
  288. { _map_nominal_u, _res_44u_8 }, /* 8 */
  289. { _map_nominal_u, _res_44u_9 }, /* 9 */
  290. };