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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 | 48 |
49 /* Initializations, to make sure that the first one is selected */ | 49 /* Initializations, to make sure that the first one is selected */ |
50 crossCorrSqMod_Max=0; | 50 crossCorrSqMod_Max=0; |
51 EnergyMod_Max=WEBRTC_SPL_WORD16_MAX; | 51 EnergyMod_Max=WEBRTC_SPL_WORD16_MAX; |
52 totscale_max=-500; | 52 totscale_max=-500; |
53 maxlag=0; | 53 maxlag=0; |
54 pos=0; | 54 pos=0; |
55 | 55 |
56 /* Find scale value and start position */ | 56 /* Find scale value and start position */ |
57 if (step==1) { | 57 if (step==1) { |
58 max=WebRtcSpl_MaxAbsValueW16(regressor, (int16_t)(subl+searchLen-1)); | 58 max=WebRtcSpl_MaxAbsValueW16(regressor, subl + searchLen - 1); |
59 rp_beg = regressor; | 59 rp_beg = regressor; |
60 rp_end = ®ressor[subl]; | 60 rp_end = ®ressor[subl]; |
61 } else { /* step==-1 */ | 61 } else { /* step==-1 */ |
62 max=WebRtcSpl_MaxAbsValueW16(®ressor[-searchLen], (int16_t)(subl+searchLe
n-1)); | 62 max=WebRtcSpl_MaxAbsValueW16(®ressor[-searchLen], subl + searchLen - 1); |
63 rp_beg = ®ressor[-1]; | 63 rp_beg = ®ressor[-1]; |
64 rp_end = ®ressor[subl-1]; | 64 rp_end = ®ressor[subl-1]; |
65 } | 65 } |
66 | 66 |
67 /* Introduce a scale factor on the Energy in int32_t in | 67 /* Introduce a scale factor on the Energy in int32_t in |
68 order to make sure that the calculation does not | 68 order to make sure that the calculation does not |
69 overflow */ | 69 overflow */ |
70 | 70 |
71 if (max>5000) { | 71 if (max>5000) { |
72 shifts=2; | 72 shifts=2; |
(...skipping 58 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 |