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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 WebRtcIlbcfix_CreateAugmentedVec((int16_t)(index[stage]-2*base_size+40
), | 326 WebRtcIlbcfix_CreateAugmentedVec((int16_t)(index[stage]-2*base_size+40
), |
327 cbvectors+lMem, aug_vec); | 327 cbvectors+lMem, aug_vec); |
328 pp = aug_vec; | 328 pp = aug_vec; |
329 } | 329 } |
330 } | 330 } |
331 } | 331 } |
332 | 332 |
333 /* Subtract the best codebook vector, according | 333 /* Subtract the best codebook vector, according |
334 to measure, from the target vector */ | 334 to measure, from the target vector */ |
335 | 335 |
336 WebRtcSpl_AddAffineVectorToVector(target, pp, (int16_t)(-bestGain), (int32_t
)8192, (int16_t)14, (int)lTarget); | 336 WebRtcSpl_AddAffineVectorToVector(target, pp, (int16_t)(-bestGain), |
| 337 (int32_t)8192, (int16_t)14, lTarget); |
337 | 338 |
338 /* record quantized gain */ | 339 /* record quantized gain */ |
339 gains[stage+1] = bestGain; | 340 gains[stage+1] = bestGain; |
340 | 341 |
341 } /* end of Main Loop. for (stage=0;... */ | 342 } /* end of Main Loop. for (stage=0;... */ |
342 | 343 |
343 /* Calculte the coded vector (original target - what's left) */ | 344 /* Calculte the coded vector (original target - what's left) */ |
344 for (i=0;i<lTarget;i++) { | 345 for (i=0;i<lTarget;i++) { |
345 codedVec[i]-=target[i]; | 346 codedVec[i]-=target[i]; |
346 } | 347 } |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 j=i; | 388 j=i; |
388 WebRtcIlbcfix_kGainSq5_ptr = (int16_t*)&WebRtcIlbcfix_kGainSq5[i]; | 389 WebRtcIlbcfix_kGainSq5_ptr = (int16_t*)&WebRtcIlbcfix_kGainSq5[i]; |
389 } | 390 } |
390 } | 391 } |
391 gainPtr++; | 392 gainPtr++; |
392 } | 393 } |
393 gain_index[0]=j; | 394 gain_index[0]=j; |
394 | 395 |
395 return; | 396 return; |
396 } | 397 } |
OLD | NEW |