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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 target = downsampled + 60 + iblock * ENH_BLOCKL_HALF; | 113 target = downsampled + 60 + iblock * ENH_BLOCKL_HALF; |
114 regressor = target - 10; | 114 regressor = target - 10; |
115 | 115 |
116 /* scaling */ | 116 /* scaling */ |
117 max16=WebRtcSpl_MaxAbsValueW16(®ressor[-50], | 117 max16=WebRtcSpl_MaxAbsValueW16(®ressor[-50], |
118 (int16_t)(ENH_BLOCKL_HALF+50-1)); | 118 (int16_t)(ENH_BLOCKL_HALF+50-1)); |
119 shifts = WebRtcSpl_GetSizeInBits((uint32_t)(max16 * max16)) - 25; | 119 shifts = WebRtcSpl_GetSizeInBits((uint32_t)(max16 * max16)) - 25; |
120 shifts = WEBRTC_SPL_MAX(0, shifts); | 120 shifts = WEBRTC_SPL_MAX(0, shifts); |
121 | 121 |
122 /* compute cross correlation */ | 122 /* compute cross correlation */ |
123 WebRtcSpl_CrossCorrelation(corr32, target, regressor, ENH_BLOCKL_HALF, 50, | 123 WebRtcSpl_CrossCorrelation(corr32, target, regressor, |
124 shifts, -1); | 124 ENH_BLOCKL_HALF, 50, (int16_t)shifts, -1); |
125 | 125 |
126 /* Find 3 highest correlations that should be compared for the | 126 /* Find 3 highest correlations that should be compared for the |
127 highest (corr*corr)/ener */ | 127 highest (corr*corr)/ener */ |
128 | 128 |
129 for (i=0;i<2;i++) { | 129 for (i=0;i<2;i++) { |
130 lagmax[i] = WebRtcSpl_MaxIndexW32(corr32, 50); | 130 lagmax[i] = WebRtcSpl_MaxIndexW32(corr32, 50); |
131 corrmax[i] = corr32[lagmax[i]]; | 131 corrmax[i] = corr32[lagmax[i]]; |
132 start = lagmax[i] - 2; | 132 start = lagmax[i] - 2; |
133 stop = lagmax[i] + 2; | 133 stop = lagmax[i] + 2; |
134 start = WEBRTC_SPL_MAX(0, start); | 134 start = WEBRTC_SPL_MAX(0, start); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 regressor=in+tlag-1; | 199 regressor=in+tlag-1; |
200 | 200 |
201 /* scaling */ | 201 /* scaling */ |
202 max16=WebRtcSpl_MaxAbsValueW16(regressor, (int16_t)(plc_blockl+3-1)); | 202 max16=WebRtcSpl_MaxAbsValueW16(regressor, (int16_t)(plc_blockl+3-1)); |
203 if (max16>5000) | 203 if (max16>5000) |
204 shifts=2; | 204 shifts=2; |
205 else | 205 else |
206 shifts=0; | 206 shifts=0; |
207 | 207 |
208 /* compute cross correlation */ | 208 /* compute cross correlation */ |
209 WebRtcSpl_CrossCorrelation(corr32, target, regressor, plc_blockl, 3, shifts, | 209 WebRtcSpl_CrossCorrelation(corr32, target, regressor, |
210 1); | 210 plc_blockl, 3, (int16_t)shifts, 1); |
211 | 211 |
212 /* find lag */ | 212 /* find lag */ |
213 lag=WebRtcSpl_MaxIndexW32(corr32, 3); | 213 lag=WebRtcSpl_MaxIndexW32(corr32, 3); |
214 lag+=tlag-1; | 214 lag+=tlag-1; |
215 | 215 |
216 /* Copy the backward PLC to plc_pred */ | 216 /* Copy the backward PLC to plc_pred */ |
217 | 217 |
218 if (iLBCdec_inst->prev_enh_pl==1) { | 218 if (iLBCdec_inst->prev_enh_pl==1) { |
219 if (lag>plc_blockl) { | 219 if (lag>plc_blockl) { |
220 WEBRTC_SPL_MEMCPY_W16(plc_pred, &in[lag-plc_blockl], plc_blockl); | 220 WEBRTC_SPL_MEMCPY_W16(plc_pred, &in[lag-plc_blockl], plc_blockl); |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 WebRtcIlbcfix_Enhancer(out + iblock * ENH_BLOCKL, | 366 WebRtcIlbcfix_Enhancer(out + iblock * ENH_BLOCKL, |
367 enh_buf, | 367 enh_buf, |
368 ENH_BUFL, | 368 ENH_BUFL, |
369 (int16_t)(iblock * ENH_BLOCKL + startPos), | 369 (int16_t)(iblock * ENH_BLOCKL + startPos), |
370 enh_period, | 370 enh_period, |
371 (int16_t*)WebRtcIlbcfix_kEnhPlocs, ENH_NBLOCKS_TOT); | 371 (int16_t*)WebRtcIlbcfix_kEnhPlocs, ENH_NBLOCKS_TOT); |
372 } | 372 } |
373 | 373 |
374 return (lag); | 374 return (lag); |
375 } | 375 } |
OLD | NEW |