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_CbSearchCore.c | 15 WebRtcIlbcfix_CbSearchCore.c |
16 | 16 |
17 ******************************************************************/ | 17 ******************************************************************/ |
18 | 18 |
19 #include "defines.h" | 19 #include "defines.h" |
20 #include "constants.h" | 20 #include "constants.h" |
21 | 21 |
22 void WebRtcIlbcfix_CbSearchCore( | 22 void WebRtcIlbcfix_CbSearchCore( |
23 int32_t *cDot, /* (i) Cross Correlation */ | 23 int32_t *cDot, /* (i) Cross Correlation */ |
24 int16_t range, /* (i) Search range */ | 24 size_t range, /* (i) Search range */ |
25 int16_t stage, /* (i) Stage of this search */ | 25 int16_t stage, /* (i) Stage of this search */ |
26 int16_t *inverseEnergy, /* (i) Inversed energy */ | 26 int16_t *inverseEnergy, /* (i) Inversed energy */ |
27 int16_t *inverseEnergyShift, /* (i) Shifts of inversed energy | 27 int16_t *inverseEnergyShift, /* (i) Shifts of inversed energy |
28 with the offset 2*16-29 */ | 28 with the offset 2*16-29 */ |
29 int32_t *Crit, /* (o) The criteria */ | 29 int32_t *Crit, /* (o) The criteria */ |
30 int16_t *bestIndex, /* (o) Index that corresponds to | 30 size_t *bestIndex, /* (o) Index that corresponds to |
31 maximum criteria (in this | 31 maximum criteria (in this |
32 vector) */ | 32 vector) */ |
33 int32_t *bestCrit, /* (o) Value of critera for the | 33 int32_t *bestCrit, /* (o) Value of critera for the |
34 chosen index */ | 34 chosen index */ |
35 int16_t *bestCritSh) /* (o) The domain of the chosen | 35 int16_t *bestCritSh) /* (o) The domain of the chosen |
36 criteria */ | 36 criteria */ |
37 { | 37 { |
38 int32_t maxW32, tmp32; | 38 int32_t maxW32, tmp32; |
39 int16_t max, sh, tmp16; | 39 int16_t max, sh, tmp16; |
40 int i; | 40 size_t i; |
41 int32_t *cDotPtr; | 41 int32_t *cDotPtr; |
42 int16_t cDotSqW16; | 42 int16_t cDotSqW16; |
43 int16_t *inverseEnergyPtr; | 43 int16_t *inverseEnergyPtr; |
44 int32_t *critPtr; | 44 int32_t *critPtr; |
45 int16_t *inverseEnergyShiftPtr; | 45 int16_t *inverseEnergyShiftPtr; |
46 | 46 |
47 /* Don't allow negative values for stage 0 */ | 47 /* Don't allow negative values for stage 0 */ |
48 if (stage==0) { | 48 if (stage==0) { |
49 cDotPtr=cDot; | 49 cDotPtr=cDot; |
50 for (i=0;i<range;i++) { | 50 for (i=0;i<range;i++) { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 /* Guarantee that the shift value is less than 16 | 96 /* Guarantee that the shift value is less than 16 |
97 in order to simplify for DSP's (and guard against >31) */ | 97 in order to simplify for DSP's (and guard against >31) */ |
98 tmp16 = WEBRTC_SPL_MIN(16, max-(*inverseEnergyShiftPtr)); | 98 tmp16 = WEBRTC_SPL_MIN(16, max-(*inverseEnergyShiftPtr)); |
99 | 99 |
100 (*critPtr)=WEBRTC_SPL_SHIFT_W32((*critPtr),-tmp16); | 100 (*critPtr)=WEBRTC_SPL_SHIFT_W32((*critPtr),-tmp16); |
101 critPtr++; | 101 critPtr++; |
102 inverseEnergyShiftPtr++; | 102 inverseEnergyShiftPtr++; |
103 } | 103 } |
104 | 104 |
105 /* Find the index of the best value */ | 105 /* Find the index of the best value */ |
106 *bestIndex = WebRtcSpl_MaxIndexW32(Crit, range); | 106 *bestIndex = (size_t)WebRtcSpl_MaxIndexW32(Crit, range); |
107 *bestCrit = Crit[*bestIndex]; | 107 *bestCrit = Crit[*bestIndex]; |
108 | 108 |
109 /* Calculate total shifts of this criteria */ | 109 /* Calculate total shifts of this criteria */ |
110 *bestCritSh = 32 - 2*sh + max; | 110 *bestCritSh = 32 - 2*sh + max; |
111 | 111 |
112 return; | 112 return; |
113 } | 113 } |
OLD | NEW |