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