masking.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. /********************************************************************
  2. * *
  3. * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. *
  4. * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
  5. * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. *
  6. * PLEASE READ THESE TERMS DISTRIBUTING. *
  7. * *
  8. * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 *
  9. * by Monty <monty@xiph.org> and The XIPHOPHORUS Company *
  10. * http://www.xiph.org/ *
  11. * *
  12. ********************************************************************
  13. function: masking curve data for psychoacoustics
  14. last mod: $Id: masking.h,v 1.2.2.2 2000/06/14 01:24:18 xiphmont Exp $
  15. ********************************************************************/
  16. #ifndef _V_MASKING_H_
  17. #define _V_MASKING_H_
  18. double ATH_Bark_dB[]={
  19. 70, 25, 15, 11, 9, 8, 7.5, 7, 7, 7,
  20. 6, 4, 2, 0, -3, -5, -6, -6, -4.5, 2.5,
  21. 11, 18, 21, 17, 25, 80, 120};
  22. /* The below masking curves are straight from the R. Ehmer
  23. (J. Acoustical Society of America) papers ca 1958-59. I modified
  24. them slightly as Ehmer does not correct for the Absolute Threshold
  25. of Hearing, and the low dB portions of the curves are thus highly
  26. suspect. */
  27. /* Let's all do the Trek thing and just call them 'Ehmer curves' ;-)
  28. Note these are octaves, not Bark scale. */
  29. #define EHMER_OFFSET 16
  30. #define EHMER_MAX 56
  31. double tone_125_80dB_SL[EHMER_MAX]={
  32. 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 69, 67, 66, 65, 63, 61,
  33. 60, 58, 56, 54, 52, 51, 49, 47, 45, 43, 42, 40, 38, 36, 34, 32,
  34. 30, 28, 26, 24, 22, 20, 17, 15, 12, 10, 6, 3, 0, -4, -8,-12,
  35. -900,-900,-900,-900,-900,-900,-900,-900};
  36. double tone_125_100dB_SL[EHMER_MAX]={
  37. 85, 85, 85, 85, 85, 85, 85, 85, 85, 84, 84, 83, 82, 81, 80, 79,
  38. 78, 77, 75, 74, 73, 72, 71, 70, 69, 68, 67, 65, 64, 63, 62, 60,
  39. 58, 57, 55, 54, 52, 50, 48, 46, 44, 42, 40, 38, 36, 34, 31, 29,
  40. 27, 24, 22, 20, 18, 15, 13, 11};
  41. double tone_250_40dB_SL[EHMER_MAX]={
  42. -900,-900,-900,-900,-900,-900,-900,-900, -19, -13, -7, -1, 4, 9, 15, 20,
  43. 22, 23, 22, 19, 18, 18, 16, 13, 9, 7, 3, 1, -1, -3, -6, -8,
  44. -10, -13, -16, -19, -21, -24, -28, -32, -900,-900,-900,-900,-900,-900,-900,-900,
  45. -900,-900,-900,-900,-900,-900,-900,-900};
  46. double tone_250_60dB_SL[EHMER_MAX]={
  47. -900,-900,-900,-900,-900,-900,-900, -10, -5, 1, 7, 13, 19, 25, 30, 33,
  48. 36, 39, 38, 37, 38, 39, 39, 40, 38, 36, 35, 34, 33, 31, 29, 28,
  49. 28, 28, 25, 20, 14, 10, 5, 0, -5,-10,-15,-20,-25,-30,-35,-40,
  50. -900,-900,-900,-900,-900,-900,-900,-900};
  51. double tone_250_80dB_SL[EHMER_MAX]={
  52. -900,-900,-900,-900,-900,-900,-900, -10, 10, 17, 24, 30, 37, 41, 48, 49,
  53. 60, /* minor hack */
  54. 53, 54, 53, 53, 54, 55, 57, 57, 57, 58, 59, 60, 58, 57, 58,
  55. 59, 58, 57, 54, 52, 50, 49, 47, 46, 47, 46, 44, 43, 42, 41, 40,
  56. 38, 32, 27, 22, 17, 11, 6, 0};
  57. double tone_500_40dB_SL[EHMER_MAX]={
  58. -900,-900,-900,-900,-900,-900,-900, -10, -26, -20, -14, -8, -2, 4, 10, 17,
  59. 23, 16, 12, 9, 6, 3, 0, -3, -7, -10, -13, -16, -20, -23, -26, -30,
  60. -900,-900,-900,-900,-900,-900,-900,-900, -900,-900,-900,-900,-900,-900,-900,-900,
  61. -900,-900,-900,-900,-900,-900,-900,-900};
  62. double tone_500_60dB_SL[EHMER_MAX]={
  63. -900,-900,-900,-900,-900,-900,-900,-900, -18, -12, -6, 0, 6, 13, 20, 30,
  64. 39, 34, 31, 29, 29, 27, 24, 21, 18, 16, 13, 8, 6, 3, 1, -1,
  65. -5, -2, -5, -8, -12, -15, -18, -22, -900,-900,-900,-900,-900,-900,-900,-900,
  66. -900,-900,-900,-900,-900,-900,-900,-900};
  67. double tone_500_80dB_SL[EHMER_MAX]={
  68. -900,-900,-900,-900,-900,-900,-900,-900, -22,-16,-10, 0, 10, 20, 32, 43,
  69. 53, 52, 52, 50, 49, 50, 52, 55, 55, 54, 51, 49, 46, 44, 44, 42,
  70. 38, 34, 32, 29, 29, 28, 25, 23, 20, 16, 10, 7, 4, 2, -1, -4,
  71. -7, -10, -15, -20, -25, -30, -35, -40};
  72. double tone_500_100dB_SL[EHMER_MAX]={
  73. -900,-900,-900,-900,-900,-900,-900, -10, -7, 2, 10, 19, 27, 35, 55, 56,
  74. 62, 61, 60, 58, 57, 57, 59, 63, 65, 66, 62, 60, 57, 57, 58, 58,
  75. 57, 56, 56, 56, 57, 57, 56, 57, 57, 54, 47, 41, 37, 28, 21, 16,
  76. 10, 3, -3, -8, -13, -18, -23, -28};
  77. double tone_1000_40dB_SL[EHMER_MAX]={
  78. -900,-900,-900,-900,-900,-900,-900,-900, -55, -40, -30, -20, -10, 0, 9, 20,
  79. 27, 20, 13, 14, 13, 5, -1, -6, -11, -20, -30,-900,-900,-900,-900,-900,
  80. -900,-900,-900,-900,-900,-900,-900,-900, -900,-900,-900,-900,-900,-900,-900,-900,
  81. -900,-900,-900,-900,-900,-900,-900,-900};
  82. double tone_1000_60dB_SL[EHMER_MAX]={
  83. -900,-900,-900,-900,-900,-900,-900, -43, -33,-23,-13, -3, 7, 17, 25, 37,
  84. 42, 33, 25, 25, 23, 18, 13, 9, 4, -1, -7,-13,-18, -23, -28, -33,
  85. -900,-900,-900,-900,-900,-900,-900,-900, -900,-900,-900,-900,-900,-900,-900,-900,
  86. -900,-900,-900,-900,-900,-900,-900,-900};
  87. double tone_1000_80dB_SL[EHMER_MAX]={
  88. -900,-900,-900,-900,-900,-900,-900, -35, -25,-14, -4, 6, 16, 27, 33, 50,
  89. 59, 57, 47, 41, 40, 43, 47, 48, 47, 42, 39, 37, 37, 36, 35, 32,
  90. 30, 27, 21, 15, 5, -2, -10, -18, -900,-900,-900,-900,-900,-900,-900,-900,
  91. -900,-900,-900,-900,-900,-900,-900,-900};
  92. double tone_1000_100dB_SL[EHMER_MAX]={
  93. -900,-900,-900,-900,-900,-900, -40, -30, -20,-10, 0, 10, 23, 33, 45, 60,
  94. 70, 72, 55, 49, 43, 40, 44, 54, 59, 58, 49, 43, 52, 57, 57, 58,
  95. 58, 54, 49, 47, 42, 39, 33, 28, 20, 15, 5, 0, -5,-15,-20,-25,
  96. -900,-900,-900,-900,-900,-900,-900,-900};
  97. double tone_2000_40dB_SL[EHMER_MAX]={
  98. -900,-900,-900,-900,-900,-900,-900,-900, -40, -30, -21, -12, -3, 5, 12, 20,
  99. 24, 21, 14, 5, -5, -15, -25, -35, -900,-900,-900,-900,-900,-900,-900,-900,
  100. -900,-900,-900,-900,-900,-900,-900,-900, -900,-900,-900,-900,-900,-900,-900,-900,
  101. -900,-900,-900,-900,-900,-900,-900,-900};
  102. double tone_2000_60dB_SL[EHMER_MAX]={
  103. -900,-900,-900,-900,-900,-900,-900,-900, -40, -30, -21, -12, -2, 8, 19, 31,
  104. 38, 34, 24, 17, 14, 13, 11, 7, 3, -2, -6, -10, -14, -20, -26, -32,
  105. -900,-900,-900,-900,-900,-900,-900,-900, -900,-900,-900,-900,-900,-900,-900,-900,
  106. -900,-900,-900,-900,-900,-900,-900,-900};
  107. double tone_2000_80dB_SL[EHMER_MAX]={
  108. -900,-900,-900,-900,-900,-900,-900,-900, -40, -30, -21, -12, -2, 13, 28, 40,
  109. 51, 51, 43, 35, 28, 29, 35, 37, 37, 35, 31, 28, 25, 22, 19, 15,
  110. 11, 8, 6, 2, -6, -14, -22, -30, -900,-900,-900,-900,-900,-900,-900,-900,
  111. -900,-900,-900,-900,-900,-900,-900,-900};
  112. double tone_2000_100dB_SL[EHMER_MAX]={
  113. -900,-900,-900,-900,-900,-900,-900,-900, -40, -30, -21, -10, 6, 25, 42, 60,
  114. 66, 60, 53, 43, 35, 31, 34, 47, 58, 51, 43, 45, 54, 59, 59, 56,
  115. 54, 51, 40, 29, 20, 11, 2, -8, -17, -26, -35,-900,-900,-900,-900,-900,
  116. -900,-900,-900,-900,-900,-900,-900,-900};
  117. double tone_4000_40dB_SL[EHMER_MAX]={
  118. -900,-900,-900,-900,-900,-900,-900,-900, -40, -30, -21, -12, 0, 3, 10, 18,
  119. 24, 21, 14, 5, -5, -15, -25, -35, -900,-900,-900,-900,-900,-900,-900,-900,
  120. -900,-900,-900,-900,-900,-900,-900,-900, -900,-900,-900,-900,-900,-900,-900,-900,
  121. -900,-900,-900,-900,-900,-900,-900,-900};
  122. double tone_4000_60dB_SL[EHMER_MAX]={
  123. -900,-900,-900,-900,-900,-900,-900,-900, -40, -30, -21, -12, -2, 8, 19, 31,
  124. 38, 34, 26, 20, 16, 11, 9, 7, 3, -2, -6, -10, -14, -20, -26, -32,
  125. -900,-900,-900,-900,-900,-900,-900,-900, -900,-900,-900,-900,-900,-900,-900,-900,
  126. -900,-900,-900,-900,-900,-900,-900,-900};
  127. double tone_4000_80dB_SL[EHMER_MAX]={
  128. -900,-900,-900,-900,-900,-900,-900,-900, -60, -50, -40, -29, -12, 5, 19, 37,
  129. 51, 49, 38, 32, 36, 36, 36, 31, 30, 22, 15, 5, -5, -16, -24, -32,
  130. -900,-900,-900,-900,-900,-900,-900,-900, -900,-900,-900,-900,-900,-900,-900,-900,
  131. -900,-900,-900,-900,-900,-900,-900,-900};
  132. double tone_4000_100dB_SL[EHMER_MAX]={
  133. -20, -12, -8, -4, 0, 4, 8, 11, 15, 22, 26, 28, 32, 36, 43, 52,
  134. 65, 61, 45, 41, 48, 49, 40, 30, 45, 30, 20, 10, 0, -10, -19, -28,
  135. -37,-900,-900,-900,-900,-900,-900,-900, -900,-900,-900,-900,-900,-900,-900,-900,
  136. -900,-900,-900,-900,-900,-900,-900,-900};
  137. double tone_8000_80dB_SL[EHMER_MAX]={
  138. -900,-900,-900,-900,-900,-900,-900, -10, -1, 2, 6, 10, 13, 19, 25, 35,
  139. 63, 60, 56, 53, 50, 47, 44, 41, 38, 35, 32, 29, 26, 22, 15, 5,
  140. -5, -15, -25, -35,-900,-900,-900,-900, -900,-900,-900,-900,-900,-900,-900,-900,
  141. -900,-900,-900,-900,-900,-900,-900,-900};
  142. double tone_8000_100dB_SL[EHMER_MAX]={
  143. -18, -12, -7, -3, 0, 2, 6, 9, 12, 19, 22, 21, 19, 21, 40, 40,
  144. 80, 60, 35, 25, 15, 5, -5, -15, -25, -35,-900,-900,-900,-900,-900,-900,
  145. -900,-900,-900,-900,-900,-900,-900,-900, -900,-900,-900,-900,-900,-900,-900,-900,
  146. -900,-900,-900,-900,-900,-900,-900,-900};
  147. double noise_500_60dB_SL[EHMER_MAX]={
  148. -900,-900,-900,-900,-900, -20, -11, -2, 7, 16, 25, 34, 43, 52, 61, 66,
  149. 69, 68, 58, 50, 44, 38, 32, 28, 25, 24, 20, 18, 17, 12, 10, 8,
  150. 5, 0, -5, -8, -12, -15, -18, -22, -900,-900,-900,-900,-900,-900,-900,-900,
  151. -900,-900,-900,-900,-900,-900,-900,-900};
  152. double noise_500_80dB_SL[EHMER_MAX]={
  153. -900,-900,-900, -20, -10, -1, 8, 17, 26, 35, 44, 53, 62, 70, 79, 83,
  154. 85, 85, 81, 77, 74, 71, 68, 63, 61, 59, 56, 55, 54, 52, 48, 47,
  155. 45, 46, 45, 43, 40, 37, 33, 32, 35, 32, 30, 29, 20, 10, 0, -10,
  156. -20, -30,-900,-900,-900,-900,-900,-900};
  157. double noise_1000_60dB_SL[EHMER_MAX]={
  158. -900,-900,-900,-900, -24, -15, -6, 3, 12, 21, 28, 34, 40, 48, 57, 60,
  159. 61, 56, 54, 45, 36, 27, 21, 19, 17, 13, 10, 0, -10, -20, -20,-900,
  160. -900,-900,-900,-900,-900,-900,-900,-900, -900,-900,-900,-900,-900,-900,-900,-900,
  161. -900,-900,-900,-900,-900,-900,-900,-900};
  162. double noise_1000_80dB_SL[EHMER_MAX]={
  163. -900, -26, -17, -8, 1, 10, 19, 28, 37, 41, 46, 51, 58, 68, 74, 81,
  164. 80, 81, 70, 66, 58, 61, 59, 55, 54, 53, 52, 49, 48, 42, 38, 38,
  165. 39, 34, 30, 27, 20, 10, 0, -10, -20, -30,-900,-900,-900,-900,-900,-900,
  166. -900,-900,-900,-900,-900,-900,-900,-900};
  167. double noise_2000_60dB_SL[EHMER_MAX]={
  168. -900,-900,-900, -34, -25, -16, -7, 2, 11, 18, 23, 30, 35, 42, 51, 58,
  169. 58, 57, 50, 40,-900,-900,-900,-900, -900,-900,-900,-900,-900,-900,-900,-900,
  170. -900,-900,-900,-900,-900,-900,-900,-900, -900,-900,-900,-900,-900,-900,-900,-900,
  171. -900,-900,-900,-900,-900,-900,-900,-900};
  172. double noise_2000_80dB_SL[EHMER_MAX]={
  173. -900, -26, -17, -8, 1, 10, 19, 28, 33, 38, 43, 48, 53, 62, 70, 77,
  174. 77, 75, 70, 67, 68, 66, 62, 61, 60, 59, 52, 47, 39, 35, 34, 35,
  175. 35, 33, 30, 27, 20, 10, 0, -10, -20, -30,-900,-900,-900,-900,-900,-900,
  176. -900,-900,-900,-900,-900,-900,-900,-900};
  177. double noise_4000_60dB_SL[EHMER_MAX]={
  178. -900,-900,-900, -34, -25, -16, -7, 2, 11, 20, 25, 31, 37, 45, 56, 62,
  179. 64, 61,-900,-900,-900,-900,-900,-900, -900,-900,-900,-900,-900,-900,-900,-900,
  180. -900,-900,-900,-900,-900,-900,-900,-900, -900,-900,-900,-900,-900,-900,-900,-900,
  181. -900,-900,-900,-900,-900,-900,-900,-900};
  182. double noise_4000_80dB_SL[EHMER_MAX]={
  183. -900, -26, -17, -8, 1, 10, 19, 26, 33, 39, 45, 50, 55, 65, 75, 82,
  184. 84, 81, 78, 72, 70, 69, 66, 61, 50, 48, 46, 40, 35, 30, 25, 20,
  185. 15, 10, 5, 0, -10, -20, -30,-900, -900,-900,-900,-900,-900,-900,-900,-900,
  186. -900,-900,-900,-900,-900,-900,-900,-900};
  187. #endif