psych_16.h 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  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: 16kHz settings
  13. last mod: $Id$
  14. ********************************************************************/
  15. /* tonal masking curve level adjustments *************************/
  16. static vp_adjblock _vp_tonemask_adj_16[5]={
  17. /* adjust for mode zero */
  18. /* 63 125 250 500 1 2 4 8 16 */
  19. {{-16,-16,-16,-16,-16,-16,-10, -8, -6,-2, 0, 0, 0, 0, 0, 0, 0}}, /* -2 */
  20. {{-16,-16,-16,-16,-16,-16,-10, -8, -6,-2, 0, 0, 0, 0, 0, 0, 0}}, /* -1 */
  21. {{-16,-16,-16,-16,-16,-16,-10, -8, -6,-4, 0, 0, 0, 0, 0, 0, 0}}, /* 0.5 */
  22. {{-20,-20,-20,-20,-20,-16,-10,-10, -8,-6,-2,-2, 0, 0, 0, 0, 0}}, /* 5 */
  23. {{-30,-30,-30,-30,-30,-26,-20,-10, -8,-6,-2,-2, 0, 0, 0, 0, 0}}, /* 10 */
  24. };
  25. /* noise bias */
  26. static noise3 _psy_noisebias_16_short[5]={
  27. /* 63 125 250 500 1k 2k 4k 8k 16k*/
  28. {{{-15,-15,-15,-15,-15,-10,-10, -5, 4, 10, 10, 10, 10, 12, 12, 14, 20},
  29. {-12,-12,-12,-12,-12, -7, -7, -2, 3, 3, 4, 5, 6, 7, 8, 8, 15},
  30. {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, -6, -6, -6}}},
  31. {{{-15,-15,-15,-15,-15,-10,-10, -5, 4, 10, 10, 10, 10, 12, 12, 14, 20},
  32. {-15,-15,-15,-15,-15,-10,-10, -5, 0, 0, 4, 5, 5, 6, 8, 8, 15},
  33. {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, -6, -6, -6}}},
  34. {{{-15,-15,-15,-15,-15,-10,-10, -5, 4, 6, 6, 6, 6, 8, 10, 12, 20},
  35. {-15,-15,-15,-15,-15,-15,-15,-10, -5, -5, -5, 4, 5, 6, 8, 8, 15},
  36. {-30,-30,-30,-30,-30,-24,-20,-14,-10,-10,-10,-10,-10,-10,-10,-10,-10}}},
  37. {{{-15,-15,-15,-15,-15,-12,-10, -8, 0, 2, 4, 4, 5, 5, 5, 8, 12},
  38. {-20,-20,-20,-20,-16,-12,-20,-14,-10,-10, -8, 0, 0, 0, 0, 2, 5},
  39. {-30,-30,-30,-30,-26,-26,-26,-26,-26,-26,-26,-26,-26,-24,-20,-20,-20}}},
  40. {{{-15,-15,-15,-15,-15,-12,-10, -8, -5, -5, -5, -5, -5, 0, 0, 0, 6},
  41. {-30,-30,-30,-30,-26,-22,-20,-14,-12,-12,-10,-10,-10,-10,-10,-10, -6},
  42. {-30,-30,-30,-30,-26,-26,-26,-26,-26,-26,-26,-26,-26,-24,-20,-20,-20}}},
  43. };
  44. static noise3 _psy_noisebias_16_impulse[5]={
  45. /* 63 125 250 500 1k 2k 4k 8k 16k*/
  46. {{{-15,-15,-15,-15,-15,-10,-10, -5, 4, 10, 10, 10, 10, 12, 12, 14, 20},
  47. {-12,-12,-12,-12,-12, -7, -7, -2, 3, 3, 4, 5, 6, 7, 8, 8, 15},
  48. {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, -6, -6, -6}}},
  49. {{{-15,-15,-15,-15,-15,-10,-10, -5, 4, 10, 10, 10, 10, 12, 12, 14, 20},
  50. {-15,-15,-15,-15,-15,-10,-10, -5, 0, 0, 4, 5, 5, 6, 8, 8, 15},
  51. {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, -6, -6, -6}}},
  52. {{{-15,-15,-15,-15,-15,-10,-10, -5, 4, 4, 4, 4, 5, 5, 6, 8, 15},
  53. {-15,-15,-15,-15,-15,-15,-15,-10, -5, -5, -5, 0, 0, 0, 0, 4, 10},
  54. {-30,-30,-30,-30,-30,-24,-20,-14,-10,-10,-10,-10,-10,-10,-10,-10,-10}}},
  55. {{{-15,-15,-15,-15,-15,-12,-10, -8, 0, 0, 0, 0, 0, 0, 0, 4, 10},
  56. {-20,-20,-20,-20,-16,-12,-20,-14,-10,-10,-10,-10,-10,-10,-10, -7, -5},
  57. {-30,-30,-30,-30,-26,-26,-26,-26,-26,-26,-26,-26,-26,-24,-20,-20,-20}}},
  58. {{{-15,-15,-15,-15,-15,-12,-10, -8, -5, -5, -5, -5, -5, 0, 0, 0, 6},
  59. {-30,-30,-30,-30,-26,-22,-20,-18,-18,-18,-20,-20,-20,-20,-20,-20,-16},
  60. {-30,-30,-30,-30,-26,-26,-26,-26,-26,-26,-26,-26,-26,-24,-20,-20,-20}}},
  61. };
  62. static noise3 _psy_noisebias_16[5]={
  63. /* 63 125 250 500 1k 2k 4k 8k 16k*/
  64. {{{-10,-10,-10,-10, -5, -5, -5, 0, 4, 6, 8, 8, 10, 10, 10, 14, 20},
  65. {-10,-10,-10,-10,-10, -5, -2, -2, 2, 2, 2, 4, 5, 6, 8, 8, 15},
  66. {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, -6, -6, -6}}},
  67. {{{-10,-10,-10,-10, -5, -5, -5, 0, 4, 6, 8, 8, 10, 10, 10, 14, 20},
  68. {-10,-10,-10,-10,-10, -5, -2, -2, 0, 0, 0, 4, 5, 6, 8, 8, 15},
  69. {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, -6, -6, -6}}},
  70. {{{-10,-10,-10,-10, -5, -5, -5, 0, 4, 6, 6, 6, 6, 8, 10, 12, 20},
  71. {-15,-15,-15,-15,-15,-10, -5, -5, 0, 0, 0, 4, 5, 6, 8, 8, 15},
  72. {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, -6, -6, -6}}},
  73. {{{-15,-15,-15,-15,-15,-12,-10, -8, 0, 2, 4, 4, 5, 5, 5, 8, 12},
  74. {-20,-20,-20,-20,-16,-12,-20,-10, -5, -5, 0, 0, 0, 0, 0, 2, 5},
  75. {-30,-30,-30,-30,-26,-26,-26,-26,-26,-26,-26,-26,-26,-24,-20,-20,-20}}},
  76. {{{-15,-15,-15,-15,-15,-12,-10, -8, -5, -5, -5, -5, -5, 0, 0, 0, 6},
  77. {-30,-30,-30,-30,-26,-22,-20,-14,-12,-12,-10,-10,-10,-10,-10,-10, -6},
  78. {-30,-30,-30,-30,-26,-26,-26,-26,-26,-26,-26,-26,-26,-24,-20,-20,-20}}},
  79. };
  80. static noiseguard _psy_noiseguards_16[4]={
  81. {10,10,-1},
  82. {10,10,-1},
  83. {20,20,-1},
  84. {20,20,-1},
  85. };
  86. /* ath ****************/
  87. static int _psy_ath_floater_16[5]={
  88. -100,-100,-100,-100,-105,
  89. };
  90. static int _psy_ath_abs_16[5]={
  91. -130,-130,-130,-130,-140,
  92. };
  93. /* stereo mode by base quality level */
  94. static adj_stereo _psy_stereo_modes_16[5]={
  95. /* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 */
  96. {{ 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3},
  97. { 6, 5, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4},
  98. { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 4, 4},
  99. { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},
  100. {{ 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3},
  101. { 6, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4},
  102. { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 4, 4},
  103. { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},
  104. {{ 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3},
  105. { 6, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4},
  106. { 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 4, 4, 4, 4, 4},
  107. { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},
  108. {{ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3},
  109. { 5, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3},
  110. { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4},
  111. { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},
  112. {{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
  113. { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
  114. { 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8},
  115. { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},
  116. };
  117. /* tone master attenuation by base quality mode and bitrate tweak */
  118. static att3 _psy_tone_masteratt_16[5]={
  119. {{ 30, 28, 12}, 0, 0}, /* -2 */
  120. {{ 30, 28, 12}, 0, 0}, /* -1 */
  121. {{ 25, 23, 12}, 0, 0}, /* 0.5 */
  122. {{ 20, 12, 0}, 0, 0}, /* 5 */
  123. {{ 15, 0, -14}, 0, 0}, /* 10 */
  124. };
  125. /* lowpass by mode **************/
  126. static double _psy_lowpass_16[5]={6.,6.5,8,30.,99.};
  127. /* noise normalization **********/
  128. static int _noise_start_16[4]={ 256,256,256,9999 };
  129. static int _noise_part_16[4]={ 8,8,8,8 };
  130. static double _noise_thresh_16[4]={ .3,.3,.5,.5 };