residue_44u.h 8.9 KB

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