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 10 matching lines...) Expand all Loading... |
21 #include "augmented_cb_corr.h" | 21 #include "augmented_cb_corr.h" |
22 | 22 |
23 void WebRtcIlbcfix_AugmentedCbCorr( | 23 void WebRtcIlbcfix_AugmentedCbCorr( |
24 int16_t *target, /* (i) Target vector */ | 24 int16_t *target, /* (i) Target vector */ |
25 int16_t *buffer, /* (i) Memory buffer */ | 25 int16_t *buffer, /* (i) Memory buffer */ |
26 int16_t *interpSamples, /* (i) buffer with | 26 int16_t *interpSamples, /* (i) buffer with |
27 interpolated samples */ | 27 interpolated samples */ |
28 int32_t *crossDot, /* (o) The cross correlation between | 28 int32_t *crossDot, /* (o) The cross correlation between |
29 the target and the Augmented | 29 the target and the Augmented |
30 vector */ | 30 vector */ |
31 int16_t low, /* (i) Lag to start from (typically | 31 size_t low, /* (i) Lag to start from (typically |
32 20) */ | 32 20) */ |
33 int16_t high, /* (i) Lag to end at (typically 39) */ | 33 size_t high, /* (i) Lag to end at (typically 39) */ |
34 int scale) /* (i) Scale factor to use for | 34 int scale) /* (i) Scale factor to use for |
35 the crossDot */ | 35 the crossDot */ |
36 { | 36 { |
37 int lagcount; | 37 size_t lagcount; |
38 int16_t ilow; | 38 size_t ilow; |
39 int16_t *targetPtr; | 39 int16_t *targetPtr; |
40 int32_t *crossDotPtr; | 40 int32_t *crossDotPtr; |
41 int16_t *iSPtr=interpSamples; | 41 int16_t *iSPtr=interpSamples; |
42 | 42 |
43 /* Calculate the correlation between the target and the | 43 /* Calculate the correlation between the target and the |
44 interpolated codebook. The correlation is calculated in | 44 interpolated codebook. The correlation is calculated in |
45 3 sections with the interpolated part in the middle */ | 45 3 sections with the interpolated part in the middle */ |
46 crossDotPtr=crossDot; | 46 crossDotPtr=crossDot; |
47 for (lagcount=low; lagcount<=high; lagcount++) { | 47 for (lagcount=low; lagcount<=high; lagcount++) { |
48 | 48 |
49 ilow = (int16_t) (lagcount-4); | 49 ilow = lagcount - 4; |
50 | 50 |
51 /* Compute dot product for the first (lagcount-4) samples */ | 51 /* Compute dot product for the first (lagcount-4) samples */ |
52 (*crossDotPtr) = WebRtcSpl_DotProductWithScale(target, buffer-lagcount, ilow
, scale); | 52 (*crossDotPtr) = WebRtcSpl_DotProductWithScale(target, buffer-lagcount, ilow
, scale); |
53 | 53 |
54 /* Compute dot product on the interpolated samples */ | 54 /* Compute dot product on the interpolated samples */ |
55 (*crossDotPtr) += WebRtcSpl_DotProductWithScale(target+ilow, iSPtr, 4, scale
); | 55 (*crossDotPtr) += WebRtcSpl_DotProductWithScale(target+ilow, iSPtr, 4, scale
); |
56 targetPtr = target + lagcount; | 56 targetPtr = target + lagcount; |
57 iSPtr += lagcount-ilow; | 57 iSPtr += lagcount-ilow; |
58 | 58 |
59 /* Compute dot product for the remaining samples */ | 59 /* Compute dot product for the remaining samples */ |
60 (*crossDotPtr) += WebRtcSpl_DotProductWithScale(targetPtr, buffer-lagcount,
SUBL-lagcount, scale); | 60 (*crossDotPtr) += WebRtcSpl_DotProductWithScale(targetPtr, buffer-lagcount,
SUBL-lagcount, scale); |
61 crossDotPtr++; | 61 crossDotPtr++; |
62 } | 62 } |
63 } | 63 } |
OLD | NEW |