| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 | |
| 23 | |
| 24 | |
| 25 | |
| 26 | |
| 27 | |
| 28 | #ifdef HAVE_CONFIG_H1 |
| 29 | #include "config.h" |
| 30 | #endif |
| 31 | |
| 32 | #include "main_FLP.h" |
| 33 | #include "tuning_parameters.h" |
| 34 | |
| 35 | |
| 36 | |
| 37 | |
| 38 | static OPUS_INLINEinline void silk_prefilt_FLP( |
| 39 | silk_prefilter_state_FLP *P, |
| 40 | silk_floatfloat st_res[], |
| 41 | silk_floatfloat xw[], |
| 42 | silk_floatfloat *HarmShapeFIR, |
| 43 | silk_floatfloat Tilt, |
| 44 | silk_floatfloat LF_MA_shp, |
| 45 | silk_floatfloat LF_AR_shp, |
| 46 | opus_intint lag, |
| 47 | opus_intint length |
| 48 | ); |
| 49 | |
| 50 | static void silk_warped_LPC_analysis_filter_FLP( |
| 51 | silk_floatfloat state[], |
| 52 | silk_floatfloat res[], |
| 53 | const silk_floatfloat coef[], |
| 54 | const silk_floatfloat input[], |
| 55 | const silk_floatfloat lambda, |
| 56 | const opus_intint length, |
| 57 | const opus_intint order |
| 58 | ) |
| 59 | { |
| 60 | opus_intint n, i; |
| 61 | silk_floatfloat acc, tmp1, tmp2; |
| 62 | |
| 63 | |
| 64 | silk_assert( ( order & 1 ) == 0 ); |
| 65 | |
| 66 | for( n = 0; n < length; n++ ) { |
| 4 | | Assuming 'n' is >= 'length' | |
|
| 5 | | Loop condition is false. Execution continues on line 66 | |
|
| 67 | |
| 68 | tmp2 = state[ 0 ] + lambda * state[ 1 ]; |
| 69 | state[ 0 ] = input[ n ]; |
| 70 | |
| 71 | tmp1 = state[ 1 ] + lambda * ( state[ 2 ] - tmp2 ); |
| 72 | state[ 1 ] = tmp2; |
| 73 | acc = coef[ 0 ] * tmp2; |
| 74 | |
| 75 | for( i = 2; i < order; i += 2 ) { |
| 76 | |
| 77 | tmp2 = state[ i ] + lambda * ( state[ i + 1 ] - tmp1 ); |
| 78 | state[ i ] = tmp1; |
| 79 | acc += coef[ i - 1 ] * tmp1; |
| 80 | |
| 81 | tmp1 = state[ i + 1 ] + lambda * ( state[ i + 2 ] - tmp2 ); |
| 82 | state[ i + 1 ] = tmp2; |
| 83 | acc += coef[ i ] * tmp2; |
| 84 | } |
| 85 | state[ order ] = tmp1; |
| 86 | acc += coef[ order - 1 ] * tmp1; |
| 87 | res[ n ] = input[ n ] - acc; |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | |
| 92 | |
| 93 | |
| 94 | void silk_prefilter_FLP( |
| 95 | silk_encoder_state_FLP *psEnc, |
| 96 | const silk_encoder_control_FLP *psEncCtrl, |
| 97 | silk_floatfloat xw[], |
| 98 | const silk_floatfloat x[] |
| 99 | ) |
| 100 | { |
| 101 | silk_prefilter_state_FLP *P = &psEnc->sPrefilt; |
| 102 | opus_intint j, k, lag; |
| 103 | silk_floatfloat HarmShapeGain, Tilt, LF_MA_shp, LF_AR_shp; |
| 104 | silk_floatfloat B[ 2 ]; |
| 105 | const silk_floatfloat *AR1_shp; |
| 106 | const silk_floatfloat *px; |
| 107 | silk_floatfloat *pxw; |
| 108 | silk_floatfloat HarmShapeFIR[ 3 ]; |
| 109 | silk_floatfloat st_res[ MAX_SUB_FRAME_LENGTH( 5 * 16 ) + MAX_LPC_ORDER16 ]; |
| 110 | |
| 111 | |
| 112 | px = x; |
| 113 | pxw = xw; |
| 114 | lag = P->lagPrev; |
| 115 | for( k = 0; k < psEnc->sCmn.nb_subfr; k++ ) { |
| 1 | Loop condition is true. Entering loop body | |
|
| 116 | |
| 117 | if( psEnc->sCmn.indices.signalType == TYPE_VOICED2 ) { |
| |
| 118 | lag = psEncCtrl->pitchL[ k ]; |
| 119 | } |
| 120 | |
| 121 | |
| 122 | HarmShapeGain = psEncCtrl->HarmShapeGain[ k ] * ( 1.0f - psEncCtrl->HarmBoost[ k ] ); |
| 123 | HarmShapeFIR[ 0 ] = 0.25f * HarmShapeGain; |
| 124 | HarmShapeFIR[ 1 ] = 32767.0f / 65536.0f * HarmShapeGain; |
| 125 | HarmShapeFIR[ 2 ] = 0.25f * HarmShapeGain; |
| 126 | Tilt = psEncCtrl->Tilt[ k ]; |
| 127 | LF_MA_shp = psEncCtrl->LF_MA_shp[ k ]; |
| 128 | LF_AR_shp = psEncCtrl->LF_AR_shp[ k ]; |
| 129 | AR1_shp = &psEncCtrl->AR1[ k * MAX_SHAPE_LPC_ORDER16 ]; |
| 130 | |
| 131 | |
| 132 | silk_warped_LPC_analysis_filter_FLP( P->sAR_shp, st_res, AR1_shp, px, |
| 3 | | Calling 'silk_warped_LPC_analysis_filter_FLP' | |
|
| 6 | | Returning from 'silk_warped_LPC_analysis_filter_FLP' | |
|
| 133 | (silk_floatfloat)psEnc->sCmn.warping_Q16 / 65536.0f, psEnc->sCmn.subfr_length, psEnc->sCmn.shapingLPCOrder ); |
| 134 | |
| 135 | |
| 136 | B[ 0 ] = psEncCtrl->GainsPre[ k ]; |
| 137 | B[ 1 ] = -psEncCtrl->GainsPre[ k ] * |
| 138 | ( psEncCtrl->HarmBoost[ k ] * HarmShapeGain + INPUT_TILT0.05f + psEncCtrl->coding_quality * HIGH_RATE_INPUT_TILT0.1f ); |
| 139 | pxw[ 0 ] = B[ 0 ] * st_res[ 0 ] + B[ 1 ] * P->sHarmHP; |
| 7 | | The right operand of '*' is a garbage value |
|
| 140 | for( j = 1; j < psEnc->sCmn.subfr_length; j++ ) { |
| 141 | pxw[ j ] = B[ 0 ] * st_res[ j ] + B[ 1 ] * st_res[ j - 1 ]; |
| 142 | } |
| 143 | P->sHarmHP = st_res[ psEnc->sCmn.subfr_length - 1 ]; |
| 144 | |
| 145 | silk_prefilt_FLP( P, pxw, pxw, HarmShapeFIR, Tilt, LF_MA_shp, LF_AR_shp, lag, psEnc->sCmn.subfr_length ); |
| 146 | |
| 147 | px += psEnc->sCmn.subfr_length; |
| 148 | pxw += psEnc->sCmn.subfr_length; |
| 149 | } |
| 150 | P->lagPrev = psEncCtrl->pitchL[ psEnc->sCmn.nb_subfr - 1 ]; |
| 151 | } |
| 152 | |
| 153 | |
| 154 | |
| 155 | |
| 156 | static OPUS_INLINEinline void silk_prefilt_FLP( |
| 157 | silk_prefilter_state_FLP *P, |
| 158 | silk_floatfloat st_res[], |
| 159 | silk_floatfloat xw[], |
| 160 | silk_floatfloat *HarmShapeFIR, |
| 161 | silk_floatfloat Tilt, |
| 162 | silk_floatfloat LF_MA_shp, |
| 163 | silk_floatfloat LF_AR_shp, |
| 164 | opus_intint lag, |
| 165 | opus_intint length |
| 166 | ) |
| 167 | { |
| 168 | opus_intint i; |
| 169 | opus_intint idx, LTP_shp_buf_idx; |
| 170 | silk_floatfloat n_Tilt, n_LF, n_LTP; |
| 171 | silk_floatfloat sLF_AR_shp, sLF_MA_shp; |
| 172 | silk_floatfloat *LTP_shp_buf; |
| 173 | |
| 174 | |
| 175 | LTP_shp_buf = P->sLTP_shp; |
| 176 | LTP_shp_buf_idx = P->sLTP_shp_buf_idx; |
| 177 | sLF_AR_shp = P->sLF_AR_shp; |
| 178 | sLF_MA_shp = P->sLF_MA_shp; |
| 179 | |
| 180 | for( i = 0; i < length; i++ ) { |
| 181 | if( lag > 0 ) { |
| 182 | silk_assert( HARM_SHAPE_FIR_TAPS == 3 ); |
| 183 | idx = lag + LTP_shp_buf_idx; |
| 184 | n_LTP = LTP_shp_buf[ ( idx - HARM_SHAPE_FIR_TAPS3 / 2 - 1) & LTP_MASK( 512 - 1 ) ] * HarmShapeFIR[ 0 ]; |
| 185 | n_LTP += LTP_shp_buf[ ( idx - HARM_SHAPE_FIR_TAPS3 / 2 ) & LTP_MASK( 512 - 1 ) ] * HarmShapeFIR[ 1 ]; |
| 186 | n_LTP += LTP_shp_buf[ ( idx - HARM_SHAPE_FIR_TAPS3 / 2 + 1) & LTP_MASK( 512 - 1 ) ] * HarmShapeFIR[ 2 ]; |
| 187 | } else { |
| 188 | n_LTP = 0; |
| 189 | } |
| 190 | |
| 191 | n_Tilt = sLF_AR_shp * Tilt; |
| 192 | n_LF = sLF_AR_shp * LF_AR_shp + sLF_MA_shp * LF_MA_shp; |
| 193 | |
| 194 | sLF_AR_shp = st_res[ i ] - n_Tilt; |
| 195 | sLF_MA_shp = sLF_AR_shp - n_LF; |
| 196 | |
| 197 | LTP_shp_buf_idx = ( LTP_shp_buf_idx - 1 ) & LTP_MASK( 512 - 1 ); |
| 198 | LTP_shp_buf[ LTP_shp_buf_idx ] = sLF_MA_shp; |
| 199 | |
| 200 | xw[ i ] = sLF_MA_shp - n_LTP; |
| 201 | } |
| 202 | |
| 203 | P->sLF_AR_shp = sLF_AR_shp; |
| 204 | P->sLF_MA_shp = sLF_MA_shp; |
| 205 | P->sLTP_shp_buf_idx = LTP_shp_buf_idx; |
| 206 | } |