Update SILK code using the CELT range coder
[opus.git] / src_common / SKP_Silk_perceptual_parameters.h
similarity index 60%
rename from src/SKP_Silk_perceptual_parameters_FIX.h
rename to src_common/SKP_Silk_perceptual_parameters.h
index dfa7c45..1fcf718 100644 (file)
@@ -25,8 +25,8 @@ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
 ***********************************************************************/\r
 \r
-#ifndef SKP_SILK_PERCEPTUAL_PARAMETERS_FIX_H\r
-#define SKP_SILK_PERCEPTUAL_PARAMETERS_FIX_H\r
+#ifndef SKP_SILK_PERCEPTUAL_PARAMETERS_H\r
+#define SKP_SILK_PERCEPTUAL_PARAMETERS_H\r
 \r
 #ifdef __cplusplus\r
 extern "C"\r
@@ -34,88 +34,82 @@ extern "C"
 #endif\r
 \r
 /* reduction in coding SNR during low speech activity */\r
-#define BG_SNR_DECR_dB_Q7                               (3<<7)\r
+#define BG_SNR_DECR_dB                              4.0f\r
 \r
 /* factor for reducing quantization noise during voiced speech */\r
-#define HARM_SNR_INCR_dB_Q7                             (2<<7)\r
+#define HARM_SNR_INCR_dB                            2.0f\r
 \r
 /* factor for reducing quantization noise for unvoiced sparse signals */\r
-#define SPARSE_SNR_INCR_dB_Q7                           (2<<7)\r
+#define SPARSE_SNR_INCR_dB                          2.0f\r
 \r
 /* threshold for sparseness measure above which to use lower quantization offset during unvoiced */\r
-#define SPARSENESS_THRESHOLD_QNT_OFFSET_Q8              (3<<6) // 0.75\r
+#define SPARSENESS_THRESHOLD_QNT_OFFSET             0.75f\r
 \r
 \r
 /* noise shaping filter chirp factor */\r
-#define BANDWIDTH_EXPANSION_Q16                         61604 // 0.94\r
+#define BANDWIDTH_EXPANSION                         0.95f\r
 \r
 /* difference between chirp factors for analysis and synthesis noise shaping filters at low bitrates */\r
-#define LOW_RATE_BANDWIDTH_EXPANSION_DELTA_Q16          655 //0.01f\r
+#define LOW_RATE_BANDWIDTH_EXPANSION_DELTA          0.01f\r
 \r
-/* factor to reduce all bandwidth expansion coefficients for super wideband, relative to wideband */\r
-#define SWB_BANDWIDTH_EXPANSION_REDUCTION_Q16           (1<<16) // 1.0f;\r
+/* factor to reduce all bandwdith expansion coefficients for super wideband, relative to wideband */\r
+#define SWB_BANDWIDTH_EXPANSION_REDUCTION           1.0f\r
 \r
 /* gain reduction for fricatives */\r
-#define DE_ESSER_COEF_SWB_dB_Q7                         (2 << 7)\r
-#define DE_ESSER_COEF_WB_dB_Q7                          (1 << 7)\r
-\r
+#define DE_ESSER_COEF_SWB_dB                        2.0f\r
+#define DE_ESSER_COEF_WB_dB                         1.0f\r
 \r
 /* extra harmonic boosting (signal shaping) at low bitrates */\r
-#define LOW_RATE_HARMONIC_BOOST_Q16                     6554 // 0.1\r
+#define LOW_RATE_HARMONIC_BOOST                     0.1f\r
 \r
 /* extra harmonic boosting (signal shaping) for noisy input signals */\r
-#define LOW_INPUT_QUALITY_HARMONIC_BOOST_Q16            6554 // 0.1\r
+#define LOW_INPUT_QUALITY_HARMONIC_BOOST            0.1f\r
 \r
 /* harmonic noise shaping */\r
-#define HARMONIC_SHAPING_Q16                            19661 // 0.3\r
+#define HARMONIC_SHAPING                            0.3f\r
 \r
 /* extra harmonic noise shaping for high bitrates or noisy input */\r
-#define HIGH_RATE_OR_LOW_QUALITY_HARMONIC_SHAPING_Q16   13107 // 0.2\r
+#define HIGH_RATE_OR_LOW_QUALITY_HARMONIC_SHAPING   0.2f\r
 \r
 \r
 /* parameter for shaping noise towards higher frequencies */\r
-#define HP_NOISE_COEF_Q16                               19661 // 0.3\r
+#define HP_NOISE_COEF                               0.3f\r
 \r
 /* parameter for shaping noise extra towards higher frequencies during voiced speech */\r
-#define HARM_HP_NOISE_COEF_Q24                          7549747 // 0.45\r
+#define HARM_HP_NOISE_COEF                          0.4f\r
 \r
 /* parameter for applying a high-pass tilt to the input signal */\r
-#define INPUT_TILT_Q26                                  2684355 // 0.04\r
+#define INPUT_TILT                                  0.04f\r
 \r
 /* parameter for extra high-pass tilt to the input signal at high rates */\r
-#define HIGH_RATE_INPUT_TILT_Q12                        246 // 0.06\r
+#define HIGH_RATE_INPUT_TILT                        0.04f\r
 \r
 /* parameter for reducing noise at the very low frequencies */\r
-#define LOW_FREQ_SHAPING_Q0                             3\r
+#define LOW_FREQ_SHAPING                            3.0f\r
 \r
 /* less reduction of noise at the very low frequencies for signals with low SNR at low frequencies */\r
-#define LOW_QUALITY_LOW_FREQ_SHAPING_DECR_Q1            1 // 0.5_Q0\r
+#define LOW_QUALITY_LOW_FREQ_SHAPING_DECR           0.5f\r
 \r
 /* fraction added to first autocorrelation value */\r
-#define SHAPE_WHITE_NOISE_FRACTION_Q20                  50 // 50_Q20 = 4.7684e-5\r
+#define SHAPE_WHITE_NOISE_FRACTION                  3.8147e-5f\r
 \r
 /* fraction of first autocorrelation value added to residual energy value; limits prediction gain */\r
-#define SHAPE_MIN_ENERGY_RATIO_Q24                      256\r
+#define SHAPE_MIN_ENERGY_RATIO                      1.526e-5f       // 1.526e-5 = 1/65536\r
 \r
 /* noise floor to put a low limit on the quantization step size */\r
-#define NOISE_FLOOR_dB_Q7                               (4 << 7)\r
+#define NOISE_FLOOR_dB                              4.0f\r
 \r
 /* noise floor relative to active speech gain level */\r
-#define RELATIVE_MIN_GAIN_dB_Q7                         -6400 // -50_Q0 = -6400_Q7\r
+#define RELATIVE_MIN_GAIN_dB                        -50.0f\r
 \r
 /* subframe smoothing coefficient for determining active speech gain level (lower -> more smoothing) */\r
-#define GAIN_SMOOTHING_COEF_Q10                         1 // 1e-3_Q0 = 1.024_Q10\r
+#define GAIN_SMOOTHING_COEF                         1e-3f\r
 \r
 /* subframe smoothing coefficient for HarmBoost, HarmShapeGain, Tilt (lower -> more smoothing) */\r
-#define SUBFR_SMTH_COEF_Q16                             26214 // 0.4\r
-\r
-#define NOISE_GAIN_VL_Q16                               7864\r
-#define NOISE_GAIN_VH_Q16                               7864\r
-#define NOISE_GAIN_UVL_Q16                              6554\r
-#define NOISE_GAIN_UVH_Q16                              9830\r
+#define SUBFR_SMTH_COEF                             0.4f\r
 \r
 #ifdef __cplusplus\r
 }\r
 #endif\r
 \r
-#endif //SKP_SILK_PERCEPTUAL_PARAMETERS_FIX_H\r
+#endif\r