| 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 |
| 11 /****************************************************************** | 11 /****************************************************************** |
| 12 | 12 |
| 13 iLBC Speech Coder ANSI-C Source Code | 13 iLBC Speech Coder ANSI-C Source Code |
| 14 | 14 |
| 15 WebRtcIlbcfix_EnergyInverse.c | 15 WebRtcIlbcfix_EnergyInverse.c |
| 16 | 16 |
| 17 ******************************************************************/ | 17 ******************************************************************/ |
| 18 | 18 |
| 19 /* Inverses the in vector in into Q29 domain */ | 19 /* Inverses the in vector in into Q29 domain */ |
| 20 | 20 |
| 21 #include "energy_inverse.h" | 21 #include "energy_inverse.h" |
| 22 | 22 |
| 23 void WebRtcIlbcfix_EnergyInverse( | 23 void WebRtcIlbcfix_EnergyInverse( |
| 24 int16_t *energy, /* (i/o) Energy and inverse | 24 int16_t *energy, /* (i/o) Energy and inverse |
| 25 energy (in Q29) */ | 25 energy (in Q29) */ |
| 26 int noOfEnergies) /* (i) The length of the energy | 26 size_t noOfEnergies) /* (i) The length of the energy |
| 27 vector */ | 27 vector */ |
| 28 { | 28 { |
| 29 int32_t Nom=(int32_t)0x1FFFFFFF; | 29 int32_t Nom=(int32_t)0x1FFFFFFF; |
| 30 int16_t *energyPtr; | 30 int16_t *energyPtr; |
| 31 int i; | 31 size_t i; |
| 32 | 32 |
| 33 /* Set the minimum energy value to 16384 to avoid overflow */ | 33 /* Set the minimum energy value to 16384 to avoid overflow */ |
| 34 energyPtr=energy; | 34 energyPtr=energy; |
| 35 for (i=0; i<noOfEnergies; i++) { | 35 for (i=0; i<noOfEnergies; i++) { |
| 36 (*energyPtr)=WEBRTC_SPL_MAX((*energyPtr),16384); | 36 (*energyPtr)=WEBRTC_SPL_MAX((*energyPtr),16384); |
| 37 energyPtr++; | 37 energyPtr++; |
| 38 } | 38 } |
| 39 | 39 |
| 40 /* Calculate inverse energy in Q29 */ | 40 /* Calculate inverse energy in Q29 */ |
| 41 energyPtr=energy; | 41 energyPtr=energy; |
| 42 for (i=0; i<noOfEnergies; i++) { | 42 for (i=0; i<noOfEnergies; i++) { |
| 43 (*energyPtr) = (int16_t)WebRtcSpl_DivW32W16(Nom, (*energyPtr)); | 43 (*energyPtr) = (int16_t)WebRtcSpl_DivW32W16(Nom, (*energyPtr)); |
| 44 energyPtr++; | 44 energyPtr++; |
| 45 } | 45 } |
| 46 } | 46 } |
| OLD | NEW |