Bug 1857998 [wpt PR 42432] - [css-nesting-ident] Enable relaxed syntax, a=testonly
[gecko.git] / media / libopus / silk / tuning_parameters.h
blobd70275fd8f5dd15e3c68bd28d3215b40c49bbe54
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 ***********************************************************************/
28 #ifndef SILK_TUNING_PARAMETERS_H
29 #define SILK_TUNING_PARAMETERS_H
31 #ifdef __cplusplus
32 extern "C"
34 #endif
36 /* Decay time for bitreservoir */
37 #define BITRESERVOIR_DECAY_TIME_MS 500
39 /*******************/
40 /* Pitch estimator */
41 /*******************/
43 /* Level of noise floor for whitening filter LPC analysis in pitch analysis */
44 #define FIND_PITCH_WHITE_NOISE_FRACTION 1e-3f
46 /* Bandwidth expansion for whitening filter in pitch analysis */
47 #define FIND_PITCH_BANDWIDTH_EXPANSION 0.99f
49 /*********************/
50 /* Linear prediction */
51 /*********************/
53 /* LPC analysis regularization */
54 #define FIND_LPC_COND_FAC 1e-5f
56 /* Max cumulative LTP gain */
57 #define MAX_SUM_LOG_GAIN_DB 250.0f
59 /* LTP analysis defines */
60 #define LTP_CORR_INV_MAX 0.03f
62 /***********************/
63 /* High pass filtering */
64 /***********************/
66 /* Smoothing parameters for low end of pitch frequency range estimation */
67 #define VARIABLE_HP_SMTH_COEF1 0.1f
68 #define VARIABLE_HP_SMTH_COEF2 0.015f
69 #define VARIABLE_HP_MAX_DELTA_FREQ 0.4f
71 /* Min and max cut-off frequency values (-3 dB points) */
72 #define VARIABLE_HP_MIN_CUTOFF_HZ 60
73 #define VARIABLE_HP_MAX_CUTOFF_HZ 100
75 /***********/
76 /* Various */
77 /***********/
79 /* VAD threshold */
80 #define SPEECH_ACTIVITY_DTX_THRES 0.05f
82 /* Speech Activity LBRR enable threshold */
83 #define LBRR_SPEECH_ACTIVITY_THRES 0.3f
85 /*************************/
86 /* Perceptual parameters */
87 /*************************/
89 /* reduction in coding SNR during low speech activity */
90 #define BG_SNR_DECR_dB 2.0f
92 /* factor for reducing quantization noise during voiced speech */
93 #define HARM_SNR_INCR_dB 2.0f
95 /* factor for reducing quantization noise for unvoiced sparse signals */
96 #define SPARSE_SNR_INCR_dB 2.0f
98 /* threshold for sparseness measure above which to use lower quantization offset during unvoiced */
99 #define ENERGY_VARIATION_THRESHOLD_QNT_OFFSET 0.6f
101 /* warping control */
102 #define WARPING_MULTIPLIER 0.015f
104 /* fraction added to first autocorrelation value */
105 #define SHAPE_WHITE_NOISE_FRACTION 3e-5f
107 /* noise shaping filter chirp factor */
108 #define BANDWIDTH_EXPANSION 0.94f
110 /* harmonic noise shaping */
111 #define HARMONIC_SHAPING 0.3f
113 /* extra harmonic noise shaping for high bitrates or noisy input */
114 #define HIGH_RATE_OR_LOW_QUALITY_HARMONIC_SHAPING 0.2f
116 /* parameter for shaping noise towards higher frequencies */
117 #define HP_NOISE_COEF 0.25f
119 /* parameter for shaping noise even more towards higher frequencies during voiced speech */
120 #define HARM_HP_NOISE_COEF 0.35f
122 /* parameter for applying a high-pass tilt to the input signal */
123 #define INPUT_TILT 0.05f
125 /* parameter for extra high-pass tilt to the input signal at high rates */
126 #define HIGH_RATE_INPUT_TILT 0.1f
128 /* parameter for reducing noise at the very low frequencies */
129 #define LOW_FREQ_SHAPING 4.0f
131 /* less reduction of noise at the very low frequencies for signals with low SNR at low frequencies */
132 #define LOW_QUALITY_LOW_FREQ_SHAPING_DECR 0.5f
134 /* subframe smoothing coefficient for HarmBoost, HarmShapeGain, Tilt (lower -> more smoothing) */
135 #define SUBFR_SMTH_COEF 0.4f
137 /* parameters defining the R/D tradeoff in the residual quantizer */
138 #define LAMBDA_OFFSET 1.2f
139 #define LAMBDA_SPEECH_ACT -0.2f
140 #define LAMBDA_DELAYED_DECISIONS -0.05f
141 #define LAMBDA_INPUT_QUALITY -0.1f
142 #define LAMBDA_CODING_QUALITY -0.2f
143 #define LAMBDA_QUANT_OFFSET 0.8f
145 /* Compensation in bitrate calculations for 10 ms modes */
146 #define REDUCE_BITRATE_10_MS_BPS 2200
148 /* Maximum time before allowing a bandwidth transition */
149 #define MAX_BANDWIDTH_SWITCH_DELAY_MS 5000
151 #ifdef __cplusplus
153 #endif
155 #endif /* SILK_TUNING_PARAMETERS_H */