| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 */ | 36 */ |
| 37 | 37 |
| 38 /* Function prototype: filtering ar_g_Q0[] and ar_f_Q0[] through an AR filter | 38 /* Function prototype: filtering ar_g_Q0[] and ar_f_Q0[] through an AR filter |
| 39 with coefficients cth_Q15[] and sth_Q15[]. | 39 with coefficients cth_Q15[] and sth_Q15[]. |
| 40 Implemented for both generic and ARMv7 platforms. | 40 Implemented for both generic and ARMv7 platforms. |
| 41 */ | 41 */ |
| 42 void WebRtcIsacfix_FilterArLoop(int16_t* ar_g_Q0, | 42 void WebRtcIsacfix_FilterArLoop(int16_t* ar_g_Q0, |
| 43 int16_t* ar_f_Q0, | 43 int16_t* ar_f_Q0, |
| 44 int16_t* cth_Q15, | 44 int16_t* cth_Q15, |
| 45 int16_t* sth_Q15, | 45 int16_t* sth_Q15, |
| 46 int16_t order_coef); | 46 size_t order_coef); |
| 47 | 47 |
| 48 /* Inner loop used for function WebRtcIsacfix_NormLatticeFilterMa(). It does: | 48 /* Inner loop used for function WebRtcIsacfix_NormLatticeFilterMa(). It does: |
| 49 for 0 <= n < HALF_SUBFRAMELEN - 1: | 49 for 0 <= n < HALF_SUBFRAMELEN - 1: |
| 50 *ptr2 = input2 * (*ptr2) + input0 * (*ptr0)); | 50 *ptr2 = input2 * (*ptr2) + input0 * (*ptr0)); |
| 51 *ptr1 = input1 * (*ptr0) + input0 * (*ptr2); | 51 *ptr1 = input1 * (*ptr0) + input0 * (*ptr2); |
| 52 Note, function WebRtcIsacfix_FilterMaLoopNeon and WebRtcIsacfix_FilterMaLoopC | 52 Note, function WebRtcIsacfix_FilterMaLoopNeon and WebRtcIsacfix_FilterMaLoopC |
| 53 are not bit-exact. The accuracy by the ARM Neon function is same or better. | 53 are not bit-exact. The accuracy by the ARM Neon function is same or better. |
| 54 */ | 54 */ |
| 55 void WebRtcIsacfix_FilterMaLoopC(int16_t input0, // Filter coefficient | 55 void WebRtcIsacfix_FilterMaLoopC(int16_t input0, // Filter coefficient |
| 56 int16_t input1, // Filter coefficient | 56 int16_t input1, // Filter coefficient |
| (...skipping 22 matching lines...) Expand all Loading... |
| 79 | 79 |
| 80 // Calculate *ptr1 = input1 * (*ptr0) + input0 * (*ptr2); | 80 // Calculate *ptr1 = input1 * (*ptr0) + input0 * (*ptr2); |
| 81 tmp32a = WEBRTC_SPL_MUL_16_32_RSFT15(input1, *ptr0); // Q15*Q15>>15 = Q15 | 81 tmp32a = WEBRTC_SPL_MUL_16_32_RSFT15(input1, *ptr0); // Q15*Q15>>15 = Q15 |
| 82 tmp32b = WEBRTC_SPL_MUL_16_32_RSFT15(input0, *ptr2); // Q15*Q15>>15 = Q15 | 82 tmp32b = WEBRTC_SPL_MUL_16_32_RSFT15(input0, *ptr2); // Q15*Q15>>15 = Q15 |
| 83 *ptr1 = tmp32a + tmp32b; // Q15 + Q15 = Q15 | 83 *ptr1 = tmp32a + tmp32b; // Q15 + Q15 = Q15 |
| 84 } | 84 } |
| 85 } | 85 } |
| 86 | 86 |
| 87 /* filter the signal using normalized lattice filter */ | 87 /* filter the signal using normalized lattice filter */ |
| 88 /* MA filter */ | 88 /* MA filter */ |
| 89 void WebRtcIsacfix_NormLatticeFilterMa(int16_t orderCoef, | 89 void WebRtcIsacfix_NormLatticeFilterMa(size_t orderCoef, |
| 90 int32_t *stateGQ15, | 90 int32_t *stateGQ15, |
| 91 int16_t *lat_inQ0, | 91 int16_t *lat_inQ0, |
| 92 int16_t *filt_coefQ15, | 92 int16_t *filt_coefQ15, |
| 93 int32_t *gain_lo_hiQ17, | 93 int32_t *gain_lo_hiQ17, |
| 94 int16_t lo_hi, | 94 int16_t lo_hi, |
| 95 int16_t *lat_outQ9) | 95 int16_t *lat_outQ9) |
| 96 { | 96 { |
| 97 int16_t sthQ15[MAX_AR_MODEL_ORDER]; | 97 int16_t sthQ15[MAX_AR_MODEL_ORDER]; |
| 98 int16_t cthQ15[MAX_AR_MODEL_ORDER]; | 98 int16_t cthQ15[MAX_AR_MODEL_ORDER]; |
| 99 | 99 |
| 100 int u, i, k, n; | 100 int u, n; |
| 101 size_t i, k; |
| 101 int16_t temp2,temp3; | 102 int16_t temp2,temp3; |
| 102 int16_t ord_1 = orderCoef+1; | 103 size_t ord_1 = orderCoef+1; |
| 103 int32_t inv_cthQ16[MAX_AR_MODEL_ORDER]; | 104 int32_t inv_cthQ16[MAX_AR_MODEL_ORDER]; |
| 104 | 105 |
| 105 int32_t gain32, fQtmp; | 106 int32_t gain32, fQtmp; |
| 106 int16_t gain16; | 107 int16_t gain16; |
| 107 int16_t gain_sh; | 108 int16_t gain_sh; |
| 108 | 109 |
| 109 int32_t tmp32, tmp32b; | 110 int32_t tmp32, tmp32b; |
| 110 int32_t fQ15vec[HALF_SUBFRAMELEN]; | 111 int32_t fQ15vec[HALF_SUBFRAMELEN]; |
| 111 int32_t gQ15[MAX_AR_MODEL_ORDER+1][HALF_SUBFRAMELEN]; | 112 int32_t gQ15[MAX_AR_MODEL_ORDER+1][HALF_SUBFRAMELEN]; |
| 112 int16_t sh; | 113 int16_t sh; |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 | 204 |
| 204 return; | 205 return; |
| 205 } | 206 } |
| 206 | 207 |
| 207 | 208 |
| 208 | 209 |
| 209 | 210 |
| 210 | 211 |
| 211 /* ----------------AR filter-------------------------*/ | 212 /* ----------------AR filter-------------------------*/ |
| 212 /* filter the signal using normalized lattice filter */ | 213 /* filter the signal using normalized lattice filter */ |
| 213 void WebRtcIsacfix_NormLatticeFilterAr(int16_t orderCoef, | 214 void WebRtcIsacfix_NormLatticeFilterAr(size_t orderCoef, |
| 214 int16_t *stateGQ0, | 215 int16_t *stateGQ0, |
| 215 int32_t *lat_inQ25, | 216 int32_t *lat_inQ25, |
| 216 int16_t *filt_coefQ15, | 217 int16_t *filt_coefQ15, |
| 217 int32_t *gain_lo_hiQ17, | 218 int32_t *gain_lo_hiQ17, |
| 218 int16_t lo_hi, | 219 int16_t lo_hi, |
| 219 int16_t *lat_outQ0) | 220 int16_t *lat_outQ0) |
| 220 { | 221 { |
| 221 int ii, n, k, i, u; | 222 size_t ii, k, i; |
| 223 int n, u; |
| 222 int16_t sthQ15[MAX_AR_MODEL_ORDER]; | 224 int16_t sthQ15[MAX_AR_MODEL_ORDER]; |
| 223 int16_t cthQ15[MAX_AR_MODEL_ORDER]; | 225 int16_t cthQ15[MAX_AR_MODEL_ORDER]; |
| 224 int32_t tmp32; | 226 int32_t tmp32; |
| 225 | 227 |
| 226 | 228 |
| 227 int16_t tmpAR; | 229 int16_t tmpAR; |
| 228 int16_t ARfQ0vec[HALF_SUBFRAMELEN]; | 230 int16_t ARfQ0vec[HALF_SUBFRAMELEN]; |
| 229 int16_t ARgQ0vec[MAX_AR_MODEL_ORDER+1]; | 231 int16_t ARgQ0vec[MAX_AR_MODEL_ORDER+1]; |
| 230 | 232 |
| 231 int32_t inv_gain32; | 233 int32_t inv_gain32; |
| 232 int16_t inv_gain16; | 234 int16_t inv_gain16; |
| 233 int16_t den16; | 235 int16_t den16; |
| 234 int16_t sh; | 236 int16_t sh; |
| 235 | 237 |
| 236 int16_t temp2,temp3; | 238 int16_t temp2,temp3; |
| 237 int16_t ord_1 = orderCoef+1; | 239 size_t ord_1 = orderCoef+1; |
| 238 | 240 |
| 239 for (u=0;u<SUBFRAMES;u++) | 241 for (u=0;u<SUBFRAMES;u++) |
| 240 { | 242 { |
| 241 int32_t temp1 = u * HALF_SUBFRAMELEN; | 243 int32_t temp1 = u * HALF_SUBFRAMELEN; |
| 242 | 244 |
| 243 //set the denominator and numerator of the Direct Form | 245 //set the denominator and numerator of the Direct Form |
| 244 temp2 = (int16_t)(u * orderCoef); | 246 temp2 = (int16_t)(u * orderCoef); |
| 245 temp3 = (int16_t)(2 * u + lo_hi); | 247 temp3 = (int16_t)(2 * u + lo_hi); |
| 246 | 248 |
| 247 for (ii=0; ii<orderCoef; ii++) { | 249 for (ii=0; ii<orderCoef; ii++) { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 /* cannot use memcpy in the following */ | 307 /* cannot use memcpy in the following */ |
| 306 | 308 |
| 307 for (i=0;i<ord_1;i++) | 309 for (i=0;i<ord_1;i++) |
| 308 { | 310 { |
| 309 stateGQ0[i] = ARgQ0vec[i]; | 311 stateGQ0[i] = ARgQ0vec[i]; |
| 310 } | 312 } |
| 311 } | 313 } |
| 312 | 314 |
| 313 return; | 315 return; |
| 314 } | 316 } |
| OLD | NEW |