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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 WebRtcSpl_FilterARFastQ12( | 103 WebRtcSpl_FilterARFastQ12( |
104 intarget, target, | 104 intarget, target, |
105 weightDenum, LPC_FILTERORDER+1, lTarget); | 105 weightDenum, LPC_FILTERORDER+1, lTarget); |
106 | 106 |
107 /* Store target, towards the end codedVec is calculated as | 107 /* Store target, towards the end codedVec is calculated as |
108 the initial target minus the remaining target */ | 108 the initial target minus the remaining target */ |
109 WEBRTC_SPL_MEMCPY_W16(codedVec, target, lTarget); | 109 WEBRTC_SPL_MEMCPY_W16(codedVec, target, lTarget); |
110 | 110 |
111 /* Find the highest absolute value to calculate proper | 111 /* Find the highest absolute value to calculate proper |
112 vector scale factor (so that it uses 12 bits) */ | 112 vector scale factor (so that it uses 12 bits) */ |
113 temp1 = WebRtcSpl_MaxAbsValueW16(buf, (int16_t)lMem); | 113 temp1 = WebRtcSpl_MaxAbsValueW16(buf, lMem); |
114 temp2 = WebRtcSpl_MaxAbsValueW16(target, (int16_t)lTarget); | 114 temp2 = WebRtcSpl_MaxAbsValueW16(target, lTarget); |
115 | 115 |
116 if ((temp1>0)&&(temp2>0)) { | 116 if ((temp1>0)&&(temp2>0)) { |
117 temp1 = WEBRTC_SPL_MAX(temp1, temp2); | 117 temp1 = WEBRTC_SPL_MAX(temp1, temp2); |
118 scale = WebRtcSpl_GetSizeInBits((uint32_t)(temp1 * temp1)); | 118 scale = WebRtcSpl_GetSizeInBits((uint32_t)(temp1 * temp1)); |
119 } else { | 119 } else { |
120 /* temp1 or temp2 is negative (maximum was -32768) */ | 120 /* temp1 or temp2 is negative (maximum was -32768) */ |
121 scale = 30; | 121 scale = 30; |
122 } | 122 } |
123 | 123 |
124 /* Scale to so that a mul-add 40 times does not overflow */ | 124 /* Scale to so that a mul-add 40 times does not overflow */ |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 WebRtcIlbcfix_CreateAugmentedVec((int16_t)(index[stage]-2*base_size+40
), | 328 WebRtcIlbcfix_CreateAugmentedVec((int16_t)(index[stage]-2*base_size+40
), |
329 cbvectors+lMem, aug_vec); | 329 cbvectors+lMem, aug_vec); |
330 pp = aug_vec; | 330 pp = aug_vec; |
331 } | 331 } |
332 } | 332 } |
333 } | 333 } |
334 | 334 |
335 /* Subtract the best codebook vector, according | 335 /* Subtract the best codebook vector, according |
336 to measure, from the target vector */ | 336 to measure, from the target vector */ |
337 | 337 |
338 WebRtcSpl_AddAffineVectorToVector(target, pp, (int16_t)(-bestGain), (int32_t
)8192, (int16_t)14, (int)lTarget); | 338 WebRtcSpl_AddAffineVectorToVector(target, pp, (int16_t)(-bestGain), |
| 339 (int32_t)8192, (int16_t)14, lTarget); |
339 | 340 |
340 /* record quantized gain */ | 341 /* record quantized gain */ |
341 gains[stage+1] = bestGain; | 342 gains[stage+1] = bestGain; |
342 | 343 |
343 } /* end of Main Loop. for (stage=0;... */ | 344 } /* end of Main Loop. for (stage=0;... */ |
344 | 345 |
345 /* Calculte the coded vector (original target - what's left) */ | 346 /* Calculte the coded vector (original target - what's left) */ |
346 for (i=0;i<lTarget;i++) { | 347 for (i=0;i<lTarget;i++) { |
347 codedVec[i]-=target[i]; | 348 codedVec[i]-=target[i]; |
348 } | 349 } |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 j=i; | 390 j=i; |
390 WebRtcIlbcfix_kGainSq5_ptr = (int16_t*)&WebRtcIlbcfix_kGainSq5[i]; | 391 WebRtcIlbcfix_kGainSq5_ptr = (int16_t*)&WebRtcIlbcfix_kGainSq5[i]; |
391 } | 392 } |
392 } | 393 } |
393 gainPtr++; | 394 gainPtr++; |
394 } | 395 } |
395 gain_index[0]=j; | 396 gain_index[0]=j; |
396 | 397 |
397 return; | 398 return; |
398 } | 399 } |
OLD | NEW |