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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 /* Calculate normalized corr^2 and ener */ | 145 /* Calculate normalized corr^2 and ener */ |
146 for (i=0;i<3;i++) { | 146 for (i=0;i<3;i++) { |
147 corrSh = 15-WebRtcSpl_GetSizeInBits(corrmax[i]); | 147 corrSh = 15-WebRtcSpl_GetSizeInBits(corrmax[i]); |
148 ener = WebRtcSpl_DotProductWithScale(regressor - lagmax[i], | 148 ener = WebRtcSpl_DotProductWithScale(regressor - lagmax[i], |
149 regressor - lagmax[i], | 149 regressor - lagmax[i], |
150 ENH_BLOCKL_HALF, shifts); | 150 ENH_BLOCKL_HALF, shifts); |
151 enerSh = 15-WebRtcSpl_GetSizeInBits(ener); | 151 enerSh = 15-WebRtcSpl_GetSizeInBits(ener); |
152 corr16[i] = (int16_t)WEBRTC_SPL_SHIFT_W32(corrmax[i], corrSh); | 152 corr16[i] = (int16_t)WEBRTC_SPL_SHIFT_W32(corrmax[i], corrSh); |
153 corr16[i] = (int16_t)((corr16[i] * corr16[i]) >> 16); | 153 corr16[i] = (int16_t)((corr16[i] * corr16[i]) >> 16); |
154 en16[i] = (int16_t)WEBRTC_SPL_SHIFT_W32(ener, enerSh); | 154 en16[i] = (int16_t)WEBRTC_SPL_SHIFT_W32(ener, enerSh); |
155 totsh[i] = enerSh - (corrSh << 1); | 155 totsh[i] = enerSh - 2 * corrSh; |
156 } | 156 } |
157 | 157 |
158 /* Compare lagmax[0..3] for the (corr^2)/ener criteria */ | 158 /* Compare lagmax[0..3] for the (corr^2)/ener criteria */ |
159 ind = 0; | 159 ind = 0; |
160 for (i=1; i<3; i++) { | 160 for (i=1; i<3; i++) { |
161 if (totsh[ind] > totsh[i]) { | 161 if (totsh[ind] > totsh[i]) { |
162 sh = WEBRTC_SPL_MIN(31, totsh[ind]-totsh[i]); | 162 sh = WEBRTC_SPL_MIN(31, totsh[ind]-totsh[i]); |
163 if (corr16[ind] * en16[i] < (corr16[i] * en16[ind]) >> sh) { | 163 if (corr16[ind] * en16[i] < (corr16[i] * en16[ind]) >> sh) { |
164 ind = i; | 164 ind = i; |
165 } | 165 } |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 WebRtcIlbcfix_Enhancer(out + iblock * ENH_BLOCKL, | 368 WebRtcIlbcfix_Enhancer(out + iblock * ENH_BLOCKL, |
369 enh_buf, | 369 enh_buf, |
370 ENH_BUFL, | 370 ENH_BUFL, |
371 iblock * ENH_BLOCKL + startPos, | 371 iblock * ENH_BLOCKL + startPos, |
372 enh_period, | 372 enh_period, |
373 WebRtcIlbcfix_kEnhPlocs, ENH_NBLOCKS_TOT); | 373 WebRtcIlbcfix_kEnhPlocs, ENH_NBLOCKS_TOT); |
374 } | 374 } |
375 | 375 |
376 return (lag); | 376 return (lag); |
377 } | 377 } |
OLD | NEW |