| 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 |
| 11 /****************************************************************** | 11 /****************************************************************** |
| 12 | 12 |
| 13 iLBC Speech Coder ANSI-C Source Code | 13 iLBC Speech Coder ANSI-C Source Code |
| 14 | 14 |
| 15 WebRtcIlbcfix_XcorrCoef.c | 15 WebRtcIlbcfix_XcorrCoef.c |
| 16 | 16 |
| 17 ******************************************************************/ | 17 ******************************************************************/ |
| 18 | 18 |
| 19 #include "defines.h" | 19 #include "defines.h" |
| 20 | 20 |
| 21 /*----------------------------------------------------------------* | 21 /*----------------------------------------------------------------* |
| 22 * cross correlation which finds the optimal lag for the | 22 * cross correlation which finds the optimal lag for the |
| 23 * crossCorr*crossCorr/(energy) criteria | 23 * crossCorr*crossCorr/(energy) criteria |
| 24 *---------------------------------------------------------------*/ | 24 *---------------------------------------------------------------*/ |
| 25 | 25 |
| 26 int WebRtcIlbcfix_XcorrCoef( | 26 size_t WebRtcIlbcfix_XcorrCoef( |
| 27 int16_t *target, /* (i) first array */ | 27 int16_t *target, /* (i) first array */ |
| 28 int16_t *regressor, /* (i) second array */ | 28 int16_t *regressor, /* (i) second array */ |
| 29 int16_t subl, /* (i) dimension arrays */ | 29 size_t subl, /* (i) dimension arrays */ |
| 30 int16_t searchLen, /* (i) the search lenght */ | 30 size_t searchLen, /* (i) the search lenght */ |
| 31 int16_t offset, /* (i) samples offset between arrays */ | 31 size_t offset, /* (i) samples offset between arrays */ |
| 32 int16_t step /* (i) +1 or -1 */ | 32 int16_t step /* (i) +1 or -1 */ |
| 33 ){ | 33 ){ |
| 34 int k; | 34 size_t k; |
| 35 int16_t maxlag; | 35 size_t maxlag; |
| 36 int16_t pos; | 36 int16_t pos; |
| 37 int16_t max; | 37 int16_t max; |
| 38 int16_t crossCorrScale, Energyscale; | 38 int16_t crossCorrScale, Energyscale; |
| 39 int16_t crossCorrSqMod, crossCorrSqMod_Max; | 39 int16_t crossCorrSqMod, crossCorrSqMod_Max; |
| 40 int32_t crossCorr, Energy; | 40 int32_t crossCorr, Energy; |
| 41 int16_t crossCorrmod, EnergyMod, EnergyMod_Max; | 41 int16_t crossCorrmod, EnergyMod, EnergyMod_Max; |
| 42 int16_t *tp, *rp; | 42 int16_t *tp, *rp; |
| 43 int16_t *rp_beg, *rp_end; | 43 int16_t *rp_beg, *rp_end; |
| 44 int16_t totscale, totscale_max; | 44 int16_t totscale, totscale_max; |
| 45 int16_t scalediff; | 45 int16_t scalediff; |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 pos+=step; | 131 pos+=step; |
| 132 | 132 |
| 133 /* Do a +/- to get the next energy */ | 133 /* Do a +/- to get the next energy */ |
| 134 Energy += step * ((*rp_end * *rp_end - *rp_beg * *rp_beg) >> shifts); | 134 Energy += step * ((*rp_end * *rp_end - *rp_beg * *rp_beg) >> shifts); |
| 135 rp_beg+=step; | 135 rp_beg+=step; |
| 136 rp_end+=step; | 136 rp_end+=step; |
| 137 } | 137 } |
| 138 | 138 |
| 139 return(maxlag+offset); | 139 return(maxlag+offset); |
| 140 } | 140 } |
| OLD | NEW |