psych_44.h 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642
  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-2001 *
  9. * by the XIPHOPHORUS Company http://www.xiph.org/ *
  10. * *
  11. ********************************************************************
  12. function: key psychoacoustic settings for 44.1/48kHz
  13. last mod: $Id: psych_44.h,v 1.3.2.2 2001/12/18 23:49:22 xiphmont Exp $
  14. ********************************************************************/
  15. /* preecho trigger settings *****************************************/
  16. static vorbis_info_psy_global _psy_global_44[3]={
  17. {8, /* lines per eighth octave */
  18. //{990.f,990.f,990.f,990.f}, {-990.f,-990.f,-990.f,-990.f}, -90.f,
  19. //{0.f,0.f,0.f,0.f}, {-0.f,-0.f,-0.f,-0.f}, -90.f,
  20. {30.f,30.f,30.f,34.f}, {-990.f,-990.f,-990.f,-990.f}, -90.f,
  21. -6.f, 0,
  22. },
  23. {8, /* lines per eighth octave */
  24. // {990.f,990.f,990.f,990.f}, {-990.f,-990.f,-990.f,-990.f}, -90.f,
  25. {26.f,26.f,26.f,30.f}, {-90.f,-90.f,-90.f,-90.f}, -90.f,
  26. -6.f, 0,
  27. },
  28. {8, /* lines per eighth octave */
  29. {26.f,26.f,26.f,30.f}, {-26.f,-26.f,-26.f,-30.f}, -90.f,
  30. -6.f, 0,
  31. }
  32. };
  33. /* noise compander lookups * low, mid, high quality ****************/
  34. static float _psy_compand_44_short[3][NOISE_COMPAND_LEVELS]={
  35. /* sub-mode Z */
  36. {
  37. 0.f, 1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f, /* 7dB */
  38. 8.f, 9.f,10.f,11.f,12.f,13.f,14.f, 15.f, /* 15dB */
  39. 16.f,17.f,18.f,19.f,20.f,21.f,22.f, 23.f, /* 23dB */
  40. 24.f,25.f,26.f,27.f,28.f,29.f,30.f, 31.f, /* 31dB */
  41. 32.f,33.f,34.f,35.f,36.f,37.f,38.f, 39.f, /* 39dB */
  42. },
  43. /* mode_Z nominal */
  44. {
  45. 0.f, 1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 6.f, /* 7dB */
  46. 7.f, 7.f, 7.f, 7.f, 6.f, 6.f, 6.f, 7.f, /* 15dB */
  47. 7.f, 8.f, 9.f,10.f,11.f,12.f,13.f, 14.f, /* 23dB */
  48. 15.f,16.f,17.f,17.f,17.f,18.f,18.f, 19.f, /* 31dB */
  49. 19.f,19.f,20.f,21.f,22.f,23.f,24.f, 25.f, /* 39dB */
  50. },
  51. /* mode A */
  52. {
  53. 0.f, 1.f, 2.f, 3.f, 4.f, 5.f, 5.f, 5.f, /* 7dB */
  54. 6.f, 6.f, 6.f, 5.f, 4.f, 4.f, 4.f, 4.f, /* 15dB */
  55. 4.f, 4.f, 5.f, 5.f, 5.f, 6.f, 6.f, 6.f, /* 23dB */
  56. 7.f, 7.f, 7.f, 8.f, 8.f, 8.f, 9.f, 10.f, /* 31dB */
  57. 11.f,12.f,13.f,14.f,15.f,16.f,17.f, 18.f, /* 39dB */
  58. }
  59. };
  60. static float _psy_compand_44[3][NOISE_COMPAND_LEVELS]={
  61. /* sub-mode Z */
  62. {
  63. 0.f, 1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f, /* 7dB */
  64. 8.f, 9.f,10.f,11.f,12.f,13.f,14.f, 15.f, /* 15dB */
  65. 16.f,17.f,18.f,19.f,20.f,21.f,22.f, 23.f, /* 23dB */
  66. 24.f,25.f,26.f,27.f,28.f,29.f,30.f, 31.f, /* 31dB */
  67. 32.f,33.f,34.f,35.f,36.f,37.f,38.f, 39.f, /* 39dB */
  68. },
  69. /* mode_Z nominal */
  70. {
  71. 0.f, 1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f, /* 7dB */
  72. 8.f, 9.f,10.f,11.f,12.f,12.f,13.f, 13.f, /* 15dB */
  73. 13.f,14.f,14.f,14.f,15.f,15.f,15.f, 15.f, /* 23dB */
  74. 16.f,16.f,17.f,17.f,17.f,18.f,18.f, 19.f, /* 31dB */
  75. 19.f,19.f,20.f,21.f,22.f,23.f,24.f, 25.f, /* 39dB */
  76. },
  77. /* mode A */
  78. {
  79. 0.f, 1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f, /* 7dB */
  80. 8.f, 8.f, 7.f, 6.f, 5.f, 4.f, 4.f, 4.f, /* 15dB */
  81. 4.f, 4.f, 5.f, 5.f, 5.f, 6.f, 6.f, 6.f, /* 23dB */
  82. 7.f, 7.f, 7.f, 8.f, 8.f, 8.f, 9.f, 10.f, /* 31dB */
  83. 11.f,12.f,13.f,14.f,15.f,16.f,17.f, 18.f, /* 39dB */
  84. }
  85. };
  86. /* tonal masking curve level adjustments *************************/
  87. static vp_adjblock _vp_tonemask_adj_longblock[6]={
  88. /* adjust for mode zero */
  89. {{
  90. { 10, 10, 5, }, /*63*/
  91. { 10, 10, 5, },
  92. { 10, 10, 5, }, /* 125 */
  93. { 10, 10, 5, },
  94. { 10, 10, 5, }, /* 250 */
  95. { 10, 10, 5, },
  96. { 10, 10, 5, }, /* 500 */
  97. { 10, 10, 5, },
  98. { 10, 10, 5, }, /* 1000 */
  99. { 10, 10, 5, },
  100. { 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10}, /* 2000 */
  101. { 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10},
  102. { 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10}, /* 4000 */
  103. { 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10},
  104. { 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10}, /* 8000 */
  105. { 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10},
  106. { 16, 16, 14, 12, 12, 15, 15, 15, 15, 15, 10}, /* 16000 */
  107. }},
  108. /* adjust for mode two */
  109. {{
  110. { 10, 10, 5, }, /*63*/
  111. { 10, 10, 5, },
  112. { 10, 10, 5, }, /* 125 */
  113. { 10, 10, 5, },
  114. { 10, 10, 5, }, /* 250 */
  115. { 10, 10, 5, },
  116. { 10, 10, 5, }, /* 500 */
  117. { 10, 10, 5, },
  118. { 10, 10, 5, }, /* 1000 */
  119. { 10, 10, 5, },
  120. { 0, }, /* 2000 */
  121. { 0, },
  122. { 10, 5, 5, }, /* 4000 */
  123. { 10, 10, 5, },
  124. { 10, 10, 7, 5, }, /* 8000 */
  125. { 10, 10, 7, 7, 5, 5, 10, 10, 10, 5, },
  126. { 16, 16, 14, 8, 8, 8, 10, 10, 10, 5, }, /* 16000 */
  127. }},
  128. /* adjust for mode four */
  129. {{
  130. { 10, 5, 5, }, /*63*/
  131. { 10, 5, 5, },
  132. { 10, 5, 5, }, /* 125 */
  133. { 10, 5, 5, },
  134. { 10, 5, 5, }, /* 250 */
  135. { 10, 5, 5, },
  136. { 10, 5, 5, }, /* 500 */
  137. { 10, 5, 5, },
  138. { 10, 5, 5, }, /* 1000 */
  139. { 10, 5, 5, },
  140. { 0, }, /* 2000 */
  141. { 0, },
  142. { 0, }, /* 4000 */
  143. { 10, 5, 5, },
  144. { 10, 10, 7, 5, }, /* 8000 */
  145. { 10, 10, 7, 5, 5, 5, 10, 10, 10, 5, },
  146. { 16, 16, 14, 8, 8, 8, 10, 10, 10, 5, }, /* 16000 */
  147. }},
  148. /* adjust for mode six */
  149. {{
  150. { 10, 5, 5, }, /*63*/
  151. { 10, 5, 5, },
  152. { 10, 5, 5, }, /* 125 */
  153. { 10, 5, 5, },
  154. { 10, 5, 5, }, /* 250 */
  155. { 10, 5, 5, },
  156. { 10, 5, 5, }, /* 500 */
  157. { 10, 5, 5, },
  158. { 10, 5, 5, }, /* 1000 */
  159. { 10, 5, 5, },
  160. { 0, }, /* 2000 */
  161. { 0, },
  162. { 0, }, /* 4000 */
  163. { 10, 5, 5, },
  164. { 10, 10, 7, 5, }, /* 8000 */
  165. { 10, 10, 7, 5, 5, 5, 5, 5, 5, },
  166. { 12, 10, 10, 5, 5, 5, 5, 5, 5, }, /* 16000 */
  167. }},
  168. /* adjust for mode eight */
  169. {{
  170. { 0, }, /*63*/
  171. { 0, },
  172. { 0, }, /* 125 */
  173. { 0, },
  174. { 0, }, /* 250 */
  175. { 0, },
  176. { 0, }, /* 500 */
  177. { 0, },
  178. { 0, }, /* 1000 */
  179. { 0, },
  180. { 0, }, /* 2000 */
  181. { 0, },
  182. { 0, }, /* 4000 */
  183. { 0, },
  184. { 0, }, /* 8000 */
  185. { 0, },
  186. { 5, 5, 5, 5, 5, 5, 5, }, /* 16000 */
  187. }},
  188. /* adjust for mode ten */
  189. {{
  190. { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15}, /*63*/
  191. { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15},
  192. { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15}, /*125*/
  193. { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15},
  194. { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15}, /*250*/
  195. { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15},
  196. { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15}, /*500*/
  197. { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15},
  198. { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15}, /*1000*/
  199. { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15},
  200. { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15}, /*2000*/
  201. { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15},
  202. { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15}, /*4000*/
  203. { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15},
  204. { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15}, /*8000*/
  205. { 0, 0, 0, -5,-10,-10,-10,-15,-15,-15,-15},
  206. { 0, 0, 0, 0, 0, -5, -5,-10,-15,-15,-15}, /*16000*/
  207. }},
  208. };
  209. static vp_adjblock _vp_tonemask_adj_otherblock[6]={
  210. /* adjust for mode zero */
  211. {{
  212. { 0, 0, 0, 0,-10,-10,-10,-10,-10,-10,-10}, /*63*/
  213. { 0, 0, 0, 0,-10,-10,-10,-10,-10,-10,-10},
  214. { 0, 0, 0, 0,-10,-10,-10,-10,-10,-10,-10}, /*125*/
  215. { 0, 0, 0, 0,-10,-10,-10,-10,-10,-10,-10},
  216. { 0, 0, 0, 0,-10,-10,-10,-10,-10,-10,-10}, /*250*/
  217. { 0, 0, 0, 0,-10,-10,-10,-10,-10,-10,-10},
  218. { 5, 5, 5, 0, -5, -5, -5, -5, -5, -5, -5}, /*500*/
  219. { 5, 5, 5, 0, -5, -5, -5, -5, -5, -5, -5},
  220. { 5, 5, 5, }, /*1000*/
  221. { 5, 5, 5, },
  222. { 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10}, /*2000*/
  223. { 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10},
  224. { 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10}, /*4000*/
  225. { 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10},
  226. { 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10}, /*8000*/
  227. { 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10},
  228. { 16, 16, 14, 12, 12, 15, 15, 15, 15, 15, 10}, /*16000*/
  229. }},
  230. /* adjust for mode two */
  231. {{
  232. { 0, 0, 0, 0,-10,-10,-10,-10,-10,-10,-10}, /*63*/
  233. { 0, 0, 0, 0,-10,-10,-10,-10,-10,-10,-10},
  234. { 0, 0, 0, 0,-10,-10,-10,-10,-10,-10,-10}, /*125*/
  235. { 0, 0, 0, 0,-10,-10,-10,-10,-10,-10,-10},
  236. { 0, 0, 0, 0,-10,-10,-10,-10,-10,-10,-10}, /*250*/
  237. { 0, 0, 0, 0,-10,-10,-10,-10,-10,-10,-10},
  238. { 5, 5, 5, 0, -5, -5, -5, -5, -5, -5, -5}, /*500*/
  239. { 5, 5, 5, 0, -5, -5, -5, -5, -5, -5, -5},
  240. { 10, 10, 5, }, /* 1000 */
  241. { 10, 10, 5, },
  242. { 0, }, /* 2000 */
  243. { 0, },
  244. { 0, }, /* 4000 */
  245. { 10, 5, 5, },
  246. { 10, 10, 7, 5, }, /* 8000 */
  247. { 10, 10, 7, 7, 5, 5, 10, 10, 10, 5, },
  248. { 16, 16, 14, 8, 8, 8, 10, 10, 10, 5, }, /* 16000 */
  249. }},
  250. /* adjust for mode four */
  251. {{
  252. { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15}, /*63*/
  253. { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15},
  254. { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15}, /*125*/
  255. { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15},
  256. { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15}, /*250*/
  257. { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15},
  258. { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15}, /*500*/
  259. { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15},
  260. { 5, 5, 5, }, /* 1000 */
  261. { 5, 5, 5, },
  262. { 0, }, /* 2000 */
  263. { 0, },
  264. { 0, }, /* 4000 */
  265. { 10, 5, 5, },
  266. { 10, 10, 7, 5, }, /* 8000 */
  267. { 10, 10, 7, 5, 5, 5, 10, 10, 10, 5, },
  268. { 16, 16, 14, 8, 8, 8, 10, 10, 10, 5, }, /* 16000 */
  269. }},
  270. /* adjust for mode six */
  271. {{
  272. { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15}, /*63*/
  273. { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15},
  274. { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15}, /*125*/
  275. { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15},
  276. { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15}, /*250*/
  277. { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15},
  278. { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15}, /*500*/
  279. { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15},
  280. { 5, 5, 5, }, /* 1000 */
  281. { 5, 5, 5, },
  282. { 0, }, /* 2000 */
  283. { 0, },
  284. { 0, }, /* 4000 */
  285. { 10, 5, 5, },
  286. { 10, 10, 7, 5, }, /* 8000 */
  287. { 10, 10, 7, 5, 5, 5, 5, 5, 5, },
  288. { 12, 10, 10, 5, 5, 5, 5, 5, 5, }, /* 16000 */
  289. }},
  290. /* adjust for mode eight */
  291. {{
  292. {-10,-10,-10,-15,-15,-15,-15,-20,-20,-20,-20}, /*63*/
  293. {-10,-10,-10,-15,-15,-15,-15,-20,-20,-20,-20},
  294. {-10,-10,-10,-15,-15,-15,-15,-20,-20,-20,-20}, /*125*/
  295. {-10,-10,-10,-15,-15,-15,-15,-20,-20,-20,-20},
  296. {-10,-10,-10,-15,-15,-15,-15,-20,-20,-20,-20}, /*250*/
  297. {-10,-10,-10,-15,-15,-15,-15,-20,-20,-20,-20},
  298. {-10,-10,-10,-15,-15,-15,-15,-20,-20,-20,-20}, /*500*/
  299. {-10,-10,-10,-15,-15,-15,-15,-20,-20,-20,-20},
  300. { 0,-10,-10,-15,-15,-15,-15,-15,-15,-15,-15},
  301. { 0,-10,-10,-15,-15,-15,-15,-15,-15,-15,-15},
  302. { 0, }, /* 2000 */
  303. { 0, },
  304. { 0, }, /* 4000 */
  305. { 0, },
  306. { 0, }, /* 8000 */
  307. { 0, },
  308. { 5, 5, 5, 5, 5, 5, 5, }, /* 16000 */
  309. }},
  310. /* adjust for mode ten */
  311. {{
  312. { 0, 0, 0, -5,-15,-20,-20,-20,-20,-20,-20}, /*63*/
  313. { 0, 0, 0, -5,-15,-20,-20,-20,-20,-20,-20},
  314. { 0, 0, 0, -5,-15,-20,-20,-20,-20,-20,-20}, /*125*/
  315. { 0, 0, 0, -5,-15,-20,-20,-20,-20,-20,-20},
  316. { 0, 0, 0, -5,-15,-20,-20,-20,-20,-20,-20}, /*250*/
  317. { 0, 0, 0, -5,-15,-20,-20,-20,-20,-20,-20},
  318. { 0, 0, 0, -5,-15,-20,-20,-20,-20,-20,-20}, /*500*/
  319. { 0, 0, 0, -5,-15,-20,-20,-20,-20,-20,-20},
  320. { 0, 0, 0, -5,-15,-20,-20,-20,-20,-20,-20}, /*1000*/
  321. { 0, 0, 0, -5,-15,-20,-20,-20,-20,-20,-20},
  322. { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15}, /*2000*/
  323. { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15},
  324. { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15}, /*4000*/
  325. { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15},
  326. { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15}, /*8000*/
  327. { 0, 0, 0, -5,-10,-10,-10,-15,-15,-15,-15},
  328. { 0, 0, 0, 0, 0, -5, -5,-10,-15,-15,-15}, /*16000*/
  329. }},
  330. };
  331. static vp_adjblock _vp_peakguard[6]={
  332. /* zero */
  333. {{
  334. {-14,-16,-18,-19,-24,-24,-24,-24,-24,-24,-24},/*63*/
  335. {-14,-16,-18,-19,-24,-24,-24,-24,-24,-24,-24},
  336. {-14,-16,-18,-19,-24,-24,-24,-24,-24,-24,-24},/*125*/
  337. {-14,-16,-18,-19,-24,-24,-24,-24,-24,-24,-24},
  338. {-14,-16,-18,-19,-24,-24,-24,-24,-24,-24,-24},/*250*/
  339. {-14,-16,-18,-19,-24,-24,-24,-24,-24,-24,-24},
  340. {-10,-10,-10,-10,-16,-16,-18,-20,-22,-24,-24},/*500*/
  341. {-10,-10,-10,-10,-14,-14,-16,-20,-22,-24,-24},
  342. {-10,-10,-10,-10,-14,-14,-16,-20,-22,-24,-24},/*1000*/
  343. {-10,-10,-10,-10,-14,-14,-16,-20,-22,-24,-24},
  344. {-10,-10,-10,-10,-14,-14,-16,-20,-22,-24,-24},/*2000*/
  345. {-10,-10,-10,-12,-16,-16,-16,-20,-22,-24,-24},
  346. {-10,-10,-10,-12,-16,-16,-16,-20,-22,-24,-24},/*4000*/
  347. {-10,-10,-10,-12,-12,-14,-16,-18,-22,-24,-24},
  348. {-10,-10,-10,-10,-10,-14,-16,-18,-22,-24,-24},/*8000*/
  349. {-10,-10,-10,-10,-10,-14,-16,-18,-22,-24,-24},
  350. {-10,-10,-10,-10,-10,-12,-16,-18,-22,-24,-24},/*16000*/
  351. }},
  352. /* two */
  353. {{
  354. {-14,-20,-20,-20,-26,-30,-30,-30,-30,-30,-30},/*63*/
  355. {-14,-20,-20,-20,-26,-30,-30,-30,-30,-30,-30},
  356. {-14,-20,-20,-20,-26,-30,-30,-30,-30,-30,-30},/*125*/
  357. {-14,-20,-20,-20,-26,-30,-30,-30,-30,-30,-30},
  358. {-14,-20,-20,-20,-26,-30,-30,-30,-30,-30,-30},/*250*/
  359. {-14,-20,-20,-20,-26,-30,-30,-30,-30,-30,-30},
  360. {-14,-20,-20,-20,-26,-30,-30,-30,-30,-30,-30},/*500*/
  361. {-10,-10,-10,-10,-14,-14,-14,-20,-26,-30,-30},
  362. {-10,-10,-10,-10,-14,-14,-14,-20,-22,-30,-30},/*1000*/
  363. {-10,-10,-10,-10,-14,-14,-16,-20,-22,-30,-30},
  364. {-10,-10,-10,-10,-14,-14,-16,-20,-22,-30,-30},/*2000*/
  365. {-10,-10,-10,-10,-14,-14,-16,-20,-22,-30,-30},
  366. {-10,-10,-10,-10,-14,-14,-16,-20,-22,-30,-30},/*4000*/
  367. {-10,-10,-10,-10,-10,-11,-12,-13,-22,-30,-30},
  368. {-10,-10,-10,-10,-10,-11,-12,-13,-22,-30,-30},/*8000*/
  369. {-10,-10,-10,-10,-10,-10,-10,-11,-22,-30,-30},
  370. {-10,-10,-10,-10,-10,-10,-10,-10,-20,-30,-30},/*16000*/
  371. }},
  372. /* four */
  373. {{
  374. {-14,-20,-20,-20,-26,-32,-32,-32,-32,-32,-40},/*63*/
  375. {-14,-20,-20,-20,-26,-32,-32,-32,-32,-32,-40},
  376. {-14,-20,-20,-20,-26,-32,-32,-32,-32,-32,-40},/*125*/
  377. {-14,-20,-20,-20,-20,-20,-20,-30,-32,-32,-40},
  378. {-14,-20,-20,-20,-20,-20,-20,-30,-32,-32,-40},/*250*/
  379. {-14,-20,-20,-20,-20,-20,-20,-24,-32,-32,-40},
  380. {-14,-20,-20,-20,-20,-20,-20,-24,-32,-32,-40},/*500*/
  381. {-10,-10,-10,-10,-14,-16,-20,-24,-26,-32,-40},
  382. {-10,-10,-10,-10,-14,-16,-20,-24,-22,-32,-40},/*1000*/
  383. {-10,-10,-10,-10,-14,-16,-20,-24,-22,-32,-40},
  384. {-10,-10,-10,-10,-14,-16,-20,-24,-22,-32,-40},/*2000*/
  385. {-10,-10,-10,-10,-14,-16,-20,-24,-22,-32,-40},
  386. {-10,-10,-10,-10,-14,-14,-16,-20,-22,-32,-40},/*4000*/
  387. {-10,-10,-10,-10,-10,-11,-12,-13,-22,-32,-40},
  388. {-10,-10,-10,-10,-10,-11,-12,-13,-22,-32,-40},/*8000*/
  389. {-10,-10,-10,-10,-10,-10,-10,-11,-22,-32,-40},
  390. {-10,-10,-10,-10,-10,-10,-10,-10,-20,-32,-40},/*16000*/
  391. }},
  392. /* six */
  393. {{
  394. {-14,-20,-20,-20,-26,-32,-32,-32,-32,-32,-40},/*63*/
  395. {-14,-20,-20,-20,-26,-32,-32,-32,-32,-32,-40},
  396. {-14,-20,-20,-20,-26,-32,-32,-32,-32,-32,-40},/*125*/
  397. {-14,-20,-20,-20,-26,-32,-32,-32,-32,-32,-40},
  398. {-14,-20,-20,-20,-26,-32,-32,-32,-32,-32,-40},/*250*/
  399. {-14,-20,-20,-20,-26,-32,-32,-32,-32,-32,-40},
  400. {-14,-20,-20,-20,-26,-32,-32,-32,-32,-32,-40},/*500*/
  401. {-14,-14,-14,-16,-20,-22,-24,-24,-28,-32,-40},
  402. {-14,-14,-14,-16,-20,-22,-24,-24,-28,-32,-40},/*1000*/
  403. {-14,-14,-14,-16,-20,-22,-24,-24,-28,-32,-40},
  404. {-14,-14,-16,-20,-24,-26,-26,-28,-30,-32,-40},/*2000*/
  405. {-14,-14,-16,-20,-24,-26,-26,-28,-30,-32,-40},
  406. {-14,-14,-16,-20,-24,-26,-26,-28,-30,-32,-40},/*4000*/
  407. {-14,-14,-14,-20,-22,-22,-24,-24,-26,-32,-40},
  408. {-14,-14,-14,-18,-20,-20,-24,-24,-24,-32,-40},/*8000*/
  409. {-14,-14,-14,-18,-20,-20,-24,-24,-24,-32,-40},
  410. {-14,-14,-14,-18,-20,-20,-22,-24,-24,-32,-40},/*16000*/
  411. }},
  412. /* eight */
  413. {{
  414. {-14,-20,-24,-26,-32,-34,-36,-38,-40,-40,-40},/*63*/
  415. {-14,-20,-24,-26,-32,-34,-36,-38,-40,-40,-40},/*88*/
  416. {-14,-20,-24,-26,-32,-34,-36,-38,-40,-40,-40},/*125*/
  417. {-14,-20,-24,-26,-32,-34,-36,-38,-40,-40,-40},/*170*/
  418. {-14,-20,-24,-26,-32,-34,-36,-38,-40,-40,-40},/*250*/
  419. {-14,-20,-24,-26,-32,-34,-36,-38,-40,-40,-40},/*350*/
  420. {-14,-20,-24,-26,-32,-34,-36,-38,-40,-40,-40},/*500*/
  421. {-14,-20,-24,-26,-32,-34,-36,-38,-40,-40,-40},/*700*/
  422. {-14,-20,-24,-26,-32,-34,-36,-38,-40,-40,-40},/*1000*/
  423. {-14,-20,-24,-26,-32,-34,-36,-38,-40,-40,-40},/*1400*/
  424. {-14,-20,-24,-26,-32,-34,-36,-38,-40,-40,-40},/*2000*/
  425. {-14,-20,-24,-26,-32,-34,-36,-38,-40,-40,-40},/*2800*/
  426. {-14,-20,-24,-26,-32,-34,-36,-38,-40,-40,-40},/*4000*/
  427. {-14,-20,-24,-26,-32,-34,-36,-38,-40,-40,-40},/*5600*/
  428. {-14,-20,-24,-26,-32,-34,-36,-38,-40,-40,-40},/*8000*/
  429. {-14,-20,-24,-26,-32,-34,-36,-38,-40,-40,-40},/*11500*/
  430. {-14,-20,-24,-26,-32,-34,-36,-38,-40,-40,-40},/*16600*/
  431. }},
  432. /* ten */
  433. {{
  434. {-14,-20,-24,-26,-32,-34,-36,-38,-40,-44,-46},/*63*/
  435. {-14,-20,-24,-26,-32,-34,-36,-38,-40,-44,-46},/*88*/
  436. {-14,-20,-24,-26,-32,-34,-36,-38,-40,-44,-46},/*125*/
  437. {-14,-20,-24,-26,-32,-34,-36,-38,-40,-44,-46},/*170*/
  438. {-14,-20,-24,-26,-32,-34,-36,-38,-40,-44,-46},/*250*/
  439. {-14,-20,-24,-26,-32,-34,-36,-38,-40,-44,-46},/*350*/
  440. {-14,-20,-24,-26,-32,-34,-36,-38,-40,-44,-46},/*500*/
  441. {-14,-20,-24,-26,-32,-34,-36,-38,-40,-44,-46},/*700*/
  442. {-14,-20,-24,-26,-32,-34,-36,-38,-40,-44,-46},/*1000*/
  443. {-14,-20,-24,-26,-32,-34,-36,-38,-40,-44,-46},/*1400*/
  444. {-14,-20,-24,-26,-32,-34,-36,-38,-40,-44,-46},/*2000*/
  445. {-14,-20,-24,-26,-32,-34,-36,-38,-40,-44,-46},/*2800*/
  446. {-14,-20,-24,-26,-32,-34,-36,-38,-40,-44,-46},/*4000*/
  447. {-14,-20,-24,-26,-32,-34,-36,-38,-40,-44,-46},/*5600*/
  448. {-14,-20,-24,-26,-32,-34,-36,-38,-40,-44,-46},/*8000*/
  449. {-14,-20,-24,-26,-32,-34,-36,-38,-40,-44,-46},/*11500*/
  450. {-14,-20,-24,-26,-32,-34,-36,-38,-40,-44,-46},/*16600*/
  451. }}
  452. };
  453. static int _psy_noisebias_long[11][17]={
  454. /*63 125 250 500 1k 2k 4k 8k 16k*/
  455. {-20,-20,-18,-18,-18,-16,-14, -8, -6, -2, 0, 2, 3, 3, 4, 4, 10},
  456. {-20,-20,-20,-20,-20,-20,-20,-10, -6, -2, -2, -2, 1, 1, 2, 2, 4},
  457. {-20,-20,-20,-20,-20,-20,-20,-10, -6, -2, -3, -3, -1, -1, 0, 1, 2},
  458. {-20,-20,-20,-20,-20,-20,-20,-10, -6, -2, -3, -3, -1, -1, 0, 1, 2},
  459. {-20,-20,-20,-20,-20,-20,-20,-10, -6, -3, -4, -4, -2, -1, 0, 0, 2},
  460. {-20,-20,-20,-20,-20,-20,-20,-18,-10, -4, -6, -6, -3, -2, -2, -2, 0},
  461. {-24,-24,-24,-24,-24,-24,-24,-18,-14, -8, -8, -8, -7, -7, -6, -6, -4},
  462. {-24,-24,-24,-24,-24,-24,-24,-18,-14,-14,-16,-16,-14,-12,-10,-10, -8},
  463. {-24,-24,-24,-24,-24,-24,-24,-20,-20,-20,-20,-20,-16,-16,-14,-14,-10},
  464. {-30,-30,-30,-30,-30,-30,-30,-30,-30,-30,-30,-30,-30,-24,-24,-24,-24},
  465. {-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-46},
  466. };
  467. static int _psy_noisebias_impulse[11][17]={
  468. /*63 125 250 500 1k 2k 4k 8k 16k*/
  469. {-20,-20,-20,-20,-20,-18,-14,-10,-10, -2, 2, 2, 2, 2, 2, 3, 6},
  470. {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, -4, -4, -2, -2, -2, -2, 2},
  471. {-30,-30,-30,-30,-26,-22,-20,-14,-10, -6, -6, -6, -4, -4, -4, -2, 0},
  472. {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -6, -6, -4, -4, -4, -2, -2},
  473. {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, -6, -4, -2},
  474. {-30,-30,-30,-30,-30,-30,-24,-20,-10,-12,-14,-14,-10, -9, -8, -6, -4},
  475. {-34,-34,-34,-34,-30,-30,-24,-20,-14,-14,-16,-16,-14,-12,-10,-10, -8},
  476. {-34,-34,-34,-34,-30,-30,-30,-24,-20,-20,-20,-20,-20,-18,-16,-16,-14},
  477. {-34,-34,-34,-34,-30,-30,-30,-30,-30,-26,-26,-26,-26,-22,-20,-20,-16},
  478. {-40,-40,-40,-40,-40,-40,-40,-40,-40,-36,-36,-36,-36,-36,-36,-30,-30},
  479. {-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50},
  480. };
  481. static int _psy_noisebias_other[11][17]={
  482. /*63 125 250 500 1k 2k 4k 8k 16k*/
  483. {-20,-20,-20,-20,-20,-18,-14,-10, -6, -2, 2, 2, 3, 3, 4, 4, 10},
  484. {-26,-26,-26,-26,-26,-22,-20,-14,-10, -2, -2, -2, 1, 1, 2, 2, 4},
  485. {-30,-30,-30,-30,-26,-22,-20,-14,-10, -2, -3, -3, -1, -1, 0, 1, 2},
  486. {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, -3, -3, -1, -1, 0, 1, 2},
  487. {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, -4, -4, -2, -1, 0, 0, 2},
  488. {-30,-30,-30,-30,-30,-30,-24,-20,-10, -4, -6, -6, -3, -2, -2, -2, 0},
  489. {-34,-34,-34,-34,-30,-30,-24,-20,-14, -8, -8, -8, -7, -7, -6, -6, -4},
  490. {-34,-34,-34,-34,-30,-30,-24,-20,-14,-14,-16,-16,-14,-12,-10,-10, -8},
  491. {-34,-34,-34,-34,-30,-30,-30,-20,-20,-20,-20,-20,-16,-16,-14,-14,-10},
  492. {-40,-40,-40,-40,-40,-40,-40,-30,-30,-30,-30,-30,-30,-24,-24,-24,-24},
  493. {-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-46},
  494. };
  495. static int _psy_noiseguards_short[33]={
  496. 2,2,-1,
  497. 4,4,-1,
  498. 4,4,15,
  499. 4,4,15,
  500. 4,4,15,
  501. 4,4,15,
  502. 4,4,15,
  503. 4,4,15,
  504. 4,4,15,
  505. 4,4,15,
  506. 4,4,15,
  507. };
  508. static int _psy_noiseguards_long[33]={
  509. 10,10,100,
  510. 10,10,100,
  511. 10,10,100,
  512. 10,10,100,
  513. 10,10,100,
  514. 10,10,100,
  515. 10,10,100,
  516. 10,10,100,
  517. 10,10,100,
  518. 10,10,100,
  519. 10,10,100,
  520. };
  521. static double _psy_tone_masteratt[11]={
  522. 3.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,
  523. };
  524. static double _psy_tone_masterguard[11]={
  525. -18.,-24.,-24.,-24.,-26.,-40.,-40.,-40.,-45.,-45.,-45.,
  526. };
  527. static double _psy_tone_suppress[11]={
  528. -10.,-20.,-20.,-20.,-30.,-30.,-40.,-40.,-45.,-45.,-45.,
  529. };
  530. static double _psy_tone_0dB[11]={
  531. 95.,95.,95.,95.,95.,105.,105.,105.,105.,105.,105.,
  532. };
  533. static double _psy_noise_suppress[11]={
  534. -0.,-24.,-24.,-24.,-24.,-30.,-40.,-40.,-45.,-45.,-45.,
  535. };
  536. static int _psy_ehmer_bandlimit[11]={
  537. 0,0,0,0,4,4,30,30,30,30,30,
  538. };
  539. static vorbis_info_psy _psy_info_template={
  540. {-1},-110.,-140.,
  541. /* tonemask att,guard,suppr,curves peakattp,curvelimitp,peaksettings*/
  542. 0.f, -40.f,-40.f, {{{0.}}}, 1, 0, {{{0.}}},
  543. /*noisemaskp,supp, low/high window, low/hi guard, minimum */
  544. 1, -0.f, .5f, .5f, 0,0,0,
  545. {-1},{-1},105.f,{{-1,-1,{{-1,-1,-1,-1}}}}
  546. };
  547. /* ath ****************/
  548. static double _psy_ath_floater[11]={
  549. -100.,-100.,-100.,-100.,-100.,-100.,-105.,-105.,-105.,-110.,-120.,
  550. };
  551. static double _psy_ath_abs[11]={
  552. -110.,-110.,-120.,-140.,-140.,-140.,-140.,-140.,-140.,-140.,-150.,
  553. };
  554. static float ATH_Bark_dB[][27]={
  555. {
  556. 0.f, 15.f, 15.f, 15.f, 11.f, 10.f, 8.f, 7.f, 7.f, 7.f,
  557. 6.f, 2.f, 0.f, 0.f, -2.f, -5.f, -6.f, -6.f, -4.f, 4.f,
  558. 14.f, 20.f, 19.f, 17.f, 30.f, 60.f, 60.f,
  559. },
  560. {
  561. 0.f, 15.f, 15.f, 15.f, 11.f, 10.f, 8.f, 7.f, 7.f, 7.f,
  562. 6.f, 2.f, 0.f, 0.f, -2.f, -5.f, -6.f, -6.f, -4.f, 0.f,
  563. 2.f, 6.f, 5.f, 5.f, 15.f, 25.f, 35.f,
  564. },
  565. {
  566. 0.f, 15.f, 15.f, 15.f, 11.f, 10.f, 8.f, 7.f, 7.f, 7.f,
  567. 6.f, 2.f, 0.f, 0.f, -3.f, -5.f, -6.f, -6.f,-4.5f, 0.f,
  568. 2.f, 6.f, 5.f, 5.f, 15.f, 15.f, 15.f,
  569. }
  570. };
  571. /* stereo ****************/
  572. static int _psy_stereo_point_dB_44[11]={3, 3, 2, 2, 1, 0, 0, 0, 0, 0, 0};
  573. static double _psy_stereo_point_kHz_44[2][11]={
  574. {4., 6., 6., 6., 10., 6., 6., 4., 4., 4., 4.},
  575. {6., 6., 6., 10., 10., 6., 6., 4., 4., 4., 4.}
  576. };
  577. /* lowpass **************/
  578. static double _psy_lowpass_44[11]={
  579. 15.1,15.8,16.5,17.9,20.5,48.,999.,999.,999.,999.,999.
  580. };