psych_8.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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: 8kHz psychoacoustic settings
  13. last mod: $Id$
  14. ********************************************************************/
  15. /* noise compander lookups */
  16. static compandblock _psy_compand_8[3]={
  17. {{
  18. 0, 1, 2, 3, 4, 5, 6, 7, /* 7dB */
  19. 8, 8, 9, 9,10,10,11, 11, /* 15dB */
  20. 12,12,13,13,14,14,15, 16, /* 23dB */
  21. 17,18,19,20,21,22,23, 24, /* 31dB */
  22. 25,26,27,28,29,30,31, 32, /* 39dB */
  23. }},
  24. {{
  25. 0, 1, 2, 3, 4, 5, 6, 7, /* 7dB */
  26. 8, 8, 9, 9,10,10,11, 11, /* 15dB */
  27. 12,12,13,13,14,14,15, 15, /* 23dB */
  28. 16,16,17,17,17,18,18, 19, /* 31dB */
  29. 19,19,20,21,22,23,24, 25, /* 39dB */
  30. }},
  31. {{
  32. 0, 1, 2, 3, 4, 5, 6, 6, /* 7dB */
  33. 7, 7, 6, 6, 5, 5, 4, 4, /* 15dB */
  34. 3, 3, 3, 4, 5, 6, 7, 8, /* 23dB */
  35. 9,10,11,12,13,14,15, 16, /* 31dB */
  36. 17,18,19,20,21,22,23, 24, /* 39dB */
  37. }},
  38. };
  39. /* tonal masking curve level adjustments *************************/
  40. static vp_adjblock _vp_tonemask_adj_8[4]={
  41. /* adjust for mode zero */
  42. /* 63 125 250 500 1 2 4 8 16 */
  43. {{-15,-15,-15,-15,-10,-10, -6,-2, 0, 0, 0, 0, 3, 3,99,99,99}}, /* -2 */
  44. {{-15,-15,-15,-15,-10,-10, -6,-2, 0, 0, 0, 0, 0, 0,99,99,99}}, /* -1 */
  45. {{-15,-15,-15,-15,-10,-10, -6,-2, 0, 0, 0, 0, 0, 0,99,99,99}}, /* 0 */
  46. {{-15,-15,-15,-15,-10,-10, -6,-2, 0, 0, 0, 0, 0, 0,99,99,99}}, /* 10 */
  47. };
  48. /* noise bias */
  49. static noise3 _psy_noisebias_8[4]={
  50. /* 63 125 250 500 1k 2k 4k 8k 16k*/
  51. {{{-10,-10,-10,-10, -5, -5, -5, 3, 4, 8, 8, 8, 10, 10, 99, 99, 99},
  52. {-10,-10,-10,-10, -5, -2, -2, 3, 3, 4, 4, 5, 6, 8, 99, 99, 99},
  53. {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, 99, 99, 99}}},
  54. {{{-10,-10,-10,-10, -5, -5, -5, 0, 4, 8, 8, 8, 10, 10, 99, 99, 99},
  55. {-10,-10,-10,-10, -5, -5, -5, 0, 0, 4, 4, 4, 4, 4, 99, 99, 99},
  56. {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, 99, 99, 99}}},
  57. {{{-10,-10,-10,-10, -5, -5, -5, 0, 4, 8, 8, 8, 10, 10, 99, 99, 99},
  58. {-10,-10,-10,-10,-10,-10, -5, -5, -5, 0, 0, 0, 0, 0, 99, 99, 99},
  59. {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, 99, 99, 99}}},
  60. {{{-15,-15,-15,-15,-15,-12,-10, -8, 0, 2, 4, 4, 5, 5, 99, 99, 99},
  61. {-30,-30,-30,-30,-26,-22,-20,-14,-12,-12,-10,-10,-10,-10, 99, 99, 99},
  62. {-30,-30,-30,-30,-26,-26,-26,-26,-26,-26,-26,-26,-26,-24, 99, 99, 99}}},
  63. };
  64. static noiseguard _psy_noiseguards_8[3]={
  65. {10,10,-1},
  66. {10,10,-1},
  67. {10,10,-1},
  68. };
  69. /* ath ****************/
  70. static int _psy_ath_floater_8[4]={
  71. -100,-100,-100,-105,
  72. };
  73. static int _psy_ath_abs_8[4]={
  74. -130,-130,-130,-140,
  75. };
  76. /* stereo mode by base quality level */
  77. static adj_stereo _psy_stereo_modes_8[4]={
  78. /* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 */
  79. {{ 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3},
  80. { 6, 5, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4},
  81. { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
  82. { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},
  83. {{ 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3},
  84. { 6, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4},
  85. { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
  86. { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},
  87. {{ 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3},
  88. { 6, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4},
  89. { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
  90. { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},
  91. {{ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3},
  92. { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4},
  93. { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
  94. { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},
  95. };
  96. /* tone master attenuation by base quality mode and bitrate tweak */
  97. static att3 _psy_tone_masteratt_8[4]={
  98. {{ 33, 28, 13}, 0, 0}, /* -2 */
  99. {{ 32, 28, 12}, 0, 0}, /* -1 */
  100. {{ 30, 26, 12}, 0, 0}, /* 0 */
  101. {{ 20, 0, -14}, 0, 0}, /* 10 */
  102. };
  103. /* lowpass by mode **************/
  104. static double _psy_lowpass_8[4]={2.6,3.,4.,4.};
  105. /* noise normalization **********/
  106. static int _noise_start_8[3]={
  107. 64,64,64,
  108. };
  109. static int _noise_part_8[3]={
  110. 8,8,8,
  111. };