tuning_parameters.h 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. /***********************************************************************
  2. Copyright (c) 2006-2011, Skype Limited. All rights reserved.
  3. Redistribution and use in source and binary forms, with or without
  4. modification, are permitted provided that the following conditions
  5. are met:
  6. - Redistributions of source code must retain the above copyright notice,
  7. this list of conditions and the following disclaimer.
  8. - Redistributions in binary form must reproduce the above copyright
  9. notice, this list of conditions and the following disclaimer in the
  10. documentation and/or other materials provided with the distribution.
  11. - Neither the name of Internet Society, IETF or IETF Trust, nor the
  12. names of specific contributors, may be used to endorse or promote
  13. products derived from this software without specific prior written
  14. permission.
  15. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  16. AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  17. IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  18. ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  19. LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  20. CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  21. SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  22. INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  23. CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  24. ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  25. POSSIBILITY OF SUCH DAMAGE.
  26. ***********************************************************************/
  27. #ifndef SILK_TUNING_PARAMETERS_H
  28. #define SILK_TUNING_PARAMETERS_H
  29. #ifdef __cplusplus
  30. extern "C"
  31. {
  32. #endif
  33. /* Decay time for bitreservoir */
  34. #define BITRESERVOIR_DECAY_TIME_MS 500
  35. /*******************/
  36. /* Pitch estimator */
  37. /*******************/
  38. /* Level of noise floor for whitening filter LPC analysis in pitch analysis */
  39. #define FIND_PITCH_WHITE_NOISE_FRACTION 1e-3f
  40. /* Bandwidth expansion for whitening filter in pitch analysis */
  41. #define FIND_PITCH_BANDWIDTH_EXPANSION 0.99f
  42. /*********************/
  43. /* Linear prediction */
  44. /*********************/
  45. /* LPC analysis regularization */
  46. #define FIND_LPC_COND_FAC 1e-5f
  47. /* LTP analysis defines */
  48. #define FIND_LTP_COND_FAC 1e-5f
  49. #define LTP_DAMPING 0.05f
  50. #define LTP_SMOOTHING 0.1f
  51. /* LTP quantization settings */
  52. #define MU_LTP_QUANT_NB 0.03f
  53. #define MU_LTP_QUANT_MB 0.025f
  54. #define MU_LTP_QUANT_WB 0.02f
  55. /* Max cumulative LTP gain */
  56. #define MAX_SUM_LOG_GAIN_DB 250.0f
  57. /***********************/
  58. /* High pass filtering */
  59. /***********************/
  60. /* Smoothing parameters for low end of pitch frequency range estimation */
  61. #define VARIABLE_HP_SMTH_COEF1 0.1f
  62. #define VARIABLE_HP_SMTH_COEF2 0.015f
  63. #define VARIABLE_HP_MAX_DELTA_FREQ 0.4f
  64. /* Min and max cut-off frequency values (-3 dB points) */
  65. #define VARIABLE_HP_MIN_CUTOFF_HZ 60
  66. #define VARIABLE_HP_MAX_CUTOFF_HZ 100
  67. /***********/
  68. /* Various */
  69. /***********/
  70. /* VAD threshold */
  71. #define SPEECH_ACTIVITY_DTX_THRES 0.05f
  72. /* Speech Activity LBRR enable threshold */
  73. #define LBRR_SPEECH_ACTIVITY_THRES 0.3f
  74. /*************************/
  75. /* Perceptual parameters */
  76. /*************************/
  77. /* reduction in coding SNR during low speech activity */
  78. #define BG_SNR_DECR_dB 2.0f
  79. /* factor for reducing quantization noise during voiced speech */
  80. #define HARM_SNR_INCR_dB 2.0f
  81. /* factor for reducing quantization noise for unvoiced sparse signals */
  82. #define SPARSE_SNR_INCR_dB 2.0f
  83. /* threshold for sparseness measure above which to use lower quantization offset during unvoiced */
  84. #define SPARSENESS_THRESHOLD_QNT_OFFSET 0.75f
  85. /* warping control */
  86. #define WARPING_MULTIPLIER 0.015f
  87. /* fraction added to first autocorrelation value */
  88. #define SHAPE_WHITE_NOISE_FRACTION 5e-5f
  89. /* noise shaping filter chirp factor */
  90. #define BANDWIDTH_EXPANSION 0.95f
  91. /* difference between chirp factors for analysis and synthesis noise shaping filters at low bitrates */
  92. #define LOW_RATE_BANDWIDTH_EXPANSION_DELTA 0.01f
  93. /* extra harmonic boosting (signal shaping) at low bitrates */
  94. #define LOW_RATE_HARMONIC_BOOST 0.1f
  95. /* extra harmonic boosting (signal shaping) for noisy input signals */
  96. #define LOW_INPUT_QUALITY_HARMONIC_BOOST 0.1f
  97. /* harmonic noise shaping */
  98. #define HARMONIC_SHAPING 0.3f
  99. /* extra harmonic noise shaping for high bitrates or noisy input */
  100. #define HIGH_RATE_OR_LOW_QUALITY_HARMONIC_SHAPING 0.2f
  101. /* parameter for shaping noise towards higher frequencies */
  102. #define HP_NOISE_COEF 0.25f
  103. /* parameter for shaping noise even more towards higher frequencies during voiced speech */
  104. #define HARM_HP_NOISE_COEF 0.35f
  105. /* parameter for applying a high-pass tilt to the input signal */
  106. #define INPUT_TILT 0.05f
  107. /* parameter for extra high-pass tilt to the input signal at high rates */
  108. #define HIGH_RATE_INPUT_TILT 0.1f
  109. /* parameter for reducing noise at the very low frequencies */
  110. #define LOW_FREQ_SHAPING 4.0f
  111. /* less reduction of noise at the very low frequencies for signals with low SNR at low frequencies */
  112. #define LOW_QUALITY_LOW_FREQ_SHAPING_DECR 0.5f
  113. /* subframe smoothing coefficient for HarmBoost, HarmShapeGain, Tilt (lower -> more smoothing) */
  114. #define SUBFR_SMTH_COEF 0.4f
  115. /* parameters defining the R/D tradeoff in the residual quantizer */
  116. #define LAMBDA_OFFSET 1.2f
  117. #define LAMBDA_SPEECH_ACT -0.2f
  118. #define LAMBDA_DELAYED_DECISIONS -0.05f
  119. #define LAMBDA_INPUT_QUALITY -0.1f
  120. #define LAMBDA_CODING_QUALITY -0.2f
  121. #define LAMBDA_QUANT_OFFSET 0.8f
  122. /* Compensation in bitrate calculations for 10 ms modes */
  123. #define REDUCE_BITRATE_10_MS_BPS 2200
  124. /* Maximum time before allowing a bandwidth transition */
  125. #define MAX_BANDWIDTH_SWITCH_DELAY_MS 5000
  126. #ifdef __cplusplus
  127. }
  128. #endif
  129. #endif /* SILK_TUNING_PARAMETERS_H */