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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 | 142 |
143 /* Second section, filtered half of the cb */ | 143 /* Second section, filtered half of the cb */ |
144 WebRtcIlbcfix_InterpolateSamples(interpSamplesFilt, cbvectors, lMem); | 144 WebRtcIlbcfix_InterpolateSamples(interpSamplesFilt, cbvectors, lMem); |
145 | 145 |
146 /* Compute the CB vectors' energies for the first cb section (non-filtered)
*/ | 146 /* Compute the CB vectors' energies for the first cb section (non-filtered)
*/ |
147 WebRtcIlbcfix_CbMemEnergyAugmentation(interpSamples, buf, | 147 WebRtcIlbcfix_CbMemEnergyAugmentation(interpSamples, buf, |
148 scale, 20, energyW16, energyShifts); | 148 scale, 20, energyW16, energyShifts); |
149 | 149 |
150 /* Compute the CB vectors' energies for the second cb section (filtered cb)
*/ | 150 /* Compute the CB vectors' energies for the second cb section (filtered cb)
*/ |
151 WebRtcIlbcfix_CbMemEnergyAugmentation(interpSamplesFilt, cbvectors, | 151 WebRtcIlbcfix_CbMemEnergyAugmentation(interpSamplesFilt, cbvectors, |
152 scale, (int16_t)(base_size+20), energy
W16, energyShifts); | 152 scale, (int16_t)(base_size + 20), |
| 153 energyW16, energyShifts); |
153 | 154 |
154 /* Compute the CB vectors' energies and store them in the vector | 155 /* Compute the CB vectors' energies and store them in the vector |
155 * energyW16. Also the corresponding shift values are stored. The | 156 * energyW16. Also the corresponding shift values are stored. The |
156 * energy values are used in all three stages. */ | 157 * energy values are used in all three stages. */ |
157 WebRtcIlbcfix_CbMemEnergy(range, buf, cbvectors, lMem, | 158 WebRtcIlbcfix_CbMemEnergy(range, buf, cbvectors, lMem, |
158 lTarget, energyW16+20, energyShifts+20, scale, bas
e_size); | 159 lTarget, energyW16+20, energyShifts+20, scale, bas
e_size); |
159 | 160 |
160 } else { | 161 } else { |
161 /* Compute the CB vectors' energies and store them in the vector | 162 /* Compute the CB vectors' energies and store them in the vector |
162 * energyW16. Also the corresponding shift values are stored. The | 163 * energyW16. Also the corresponding shift values are stored. The |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 if (eInd>=range) { | 237 if (eInd>=range) { |
237 eInd=range-1; | 238 eInd=range-1; |
238 sInd=eInd-CB_RESRANGE; | 239 sInd=eInd-CB_RESRANGE; |
239 } | 240 } |
240 | 241 |
241 range = WebRtcIlbcfix_kSearchRange[block][stage]; | 242 range = WebRtcIlbcfix_kSearchRange[block][stage]; |
242 | 243 |
243 if (lTarget==SUBL) { | 244 if (lTarget==SUBL) { |
244 i=sInd; | 245 i=sInd; |
245 if (sInd<20) { | 246 if (sInd<20) { |
246 WebRtcIlbcfix_AugmentedCbCorr(target, cbvectors+lMem, | 247 WebRtcIlbcfix_AugmentedCbCorr(target, cbvectors + lMem, |
247 interpSamplesFilt, cDot, | 248 interpSamplesFilt, cDot, |
248 (int16_t)(sInd+20), (int16_t)(WEBRTC_SPL_M
IN(39, (eInd+20))), scale); | 249 (int16_t)(sInd + 20), |
| 250 (int16_t)(WEBRTC_SPL_MIN(39, |
| 251 (eInd + 20))), |
| 252 scale); |
249 i=20; | 253 i=20; |
250 } | 254 } |
251 | 255 |
252 cDotPtr=&cDot[WEBRTC_SPL_MAX(0,(20-sInd))]; | 256 cDotPtr=&cDot[WEBRTC_SPL_MAX(0,(20-sInd))]; |
253 cb_vecPtr = cbvectors+lMem-20-i; | 257 cb_vecPtr = cbvectors+lMem-20-i; |
254 | 258 |
255 /* Calculate the cross correlations (main part of the filtered CB) */ | 259 /* Calculate the cross correlations (main part of the filtered CB) */ |
256 WebRtcSpl_CrossCorrelation(cDotPtr, target, cb_vecPtr, lTarget, (int16_t)(
eInd-i+1), scale, -1); | 260 WebRtcSpl_CrossCorrelation(cDotPtr, target, cb_vecPtr, lTarget, |
| 261 (int16_t)(eInd - i + 1), scale, -1); |
257 | 262 |
258 } else { | 263 } else { |
259 cDotPtr = cDot; | 264 cDotPtr = cDot; |
260 cb_vecPtr = cbvectors+lMem-lTarget-sInd; | 265 cb_vecPtr = cbvectors+lMem-lTarget-sInd; |
261 | 266 |
262 /* Calculate the cross correlations (main part of the filtered CB) */ | 267 /* Calculate the cross correlations (main part of the filtered CB) */ |
263 WebRtcSpl_CrossCorrelation(cDotPtr, target, cb_vecPtr, lTarget, (int16_t)(
eInd-sInd+1), scale, -1); | 268 WebRtcSpl_CrossCorrelation(cDotPtr, target, cb_vecPtr, lTarget, |
| 269 (int16_t)(eInd - sInd + 1), scale, -1); |
264 | 270 |
265 } | 271 } |
266 | 272 |
267 /* Adjust the search range for the augmented vectors */ | 273 /* Adjust the search range for the augmented vectors */ |
268 indexOffset=base_size+sInd; | 274 indexOffset=base_size+sInd; |
269 | 275 |
270 /* Search for best index in this part of the vector */ | 276 /* Search for best index in this part of the vector */ |
271 WebRtcIlbcfix_CbSearchCore( | 277 WebRtcIlbcfix_CbSearchCore( |
272 cDot, (int16_t)(eInd-sInd+1), stage, inverseEnergy+indexOffset, | 278 cDot, (int16_t)(eInd-sInd+1), stage, inverseEnergy+indexOffset, |
273 inverseEnergyShifts+indexOffset, Crit, | 279 inverseEnergyShifts+indexOffset, Crit, |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 WebRtcIlbcfix_CreateAugmentedVec((int16_t)(index[stage]-2*base_size+40
), | 334 WebRtcIlbcfix_CreateAugmentedVec((int16_t)(index[stage]-2*base_size+40
), |
329 cbvectors+lMem, aug_vec); | 335 cbvectors+lMem, aug_vec); |
330 pp = aug_vec; | 336 pp = aug_vec; |
331 } | 337 } |
332 } | 338 } |
333 } | 339 } |
334 | 340 |
335 /* Subtract the best codebook vector, according | 341 /* Subtract the best codebook vector, according |
336 to measure, from the target vector */ | 342 to measure, from the target vector */ |
337 | 343 |
338 WebRtcSpl_AddAffineVectorToVector(target, pp, (int16_t)(-bestGain), (int32_t
)8192, (int16_t)14, (int)lTarget); | 344 WebRtcSpl_AddAffineVectorToVector(target, pp, (int16_t)(-bestGain), |
| 345 (int32_t)8192, (int16_t)14, (int)lTarget); |
339 | 346 |
340 /* record quantized gain */ | 347 /* record quantized gain */ |
341 gains[stage+1] = bestGain; | 348 gains[stage+1] = bestGain; |
342 | 349 |
343 } /* end of Main Loop. for (stage=0;... */ | 350 } /* end of Main Loop. for (stage=0;... */ |
344 | 351 |
345 /* Calculte the coded vector (original target - what's left) */ | 352 /* Calculte the coded vector (original target - what's left) */ |
346 for (i=0;i<lTarget;i++) { | 353 for (i=0;i<lTarget;i++) { |
347 codedVec[i]-=target[i]; | 354 codedVec[i]-=target[i]; |
348 } | 355 } |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 j=i; | 396 j=i; |
390 WebRtcIlbcfix_kGainSq5_ptr = (int16_t*)&WebRtcIlbcfix_kGainSq5[i]; | 397 WebRtcIlbcfix_kGainSq5_ptr = (int16_t*)&WebRtcIlbcfix_kGainSq5[i]; |
391 } | 398 } |
392 } | 399 } |
393 gainPtr++; | 400 gainPtr++; |
394 } | 401 } |
395 gain_index[0]=j; | 402 gain_index[0]=j; |
396 | 403 |
397 return; | 404 return; |
398 } | 405 } |
OLD | NEW |