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