| 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_CbMemEnergy.c | 15 WebRtcIlbcfix_CbMemEnergy.c |
| 16 | 16 |
| 17 ******************************************************************/ | 17 ******************************************************************/ |
| 18 | 18 |
| 19 #include "defines.h" | 19 #include "defines.h" |
| 20 #include "constants.h" | 20 #include "constants.h" |
| 21 #include "cb_mem_energy_calc.h" | 21 #include "cb_mem_energy_calc.h" |
| 22 | 22 |
| 23 /*----------------------------------------------------------------* | 23 /*----------------------------------------------------------------* |
| 24 * Function WebRtcIlbcfix_CbMemEnergy computes the energy of all | 24 * Function WebRtcIlbcfix_CbMemEnergy computes the energy of all |
| 25 * the vectors in the codebook memory that will be used in the | 25 * the vectors in the codebook memory that will be used in the |
| 26 * following search for the best match. | 26 * following search for the best match. |
| 27 *----------------------------------------------------------------*/ | 27 *----------------------------------------------------------------*/ |
| 28 | 28 |
| 29 void WebRtcIlbcfix_CbMemEnergy( | 29 void WebRtcIlbcfix_CbMemEnergy( |
| 30 int16_t range, | 30 size_t range, |
| 31 int16_t *CB, /* (i) The CB memory (1:st section) */ | 31 int16_t *CB, /* (i) The CB memory (1:st section) */ |
| 32 int16_t *filteredCB, /* (i) The filtered CB memory (2:nd section) */ | 32 int16_t *filteredCB, /* (i) The filtered CB memory (2:nd section) */ |
| 33 int16_t lMem, /* (i) Length of the CB memory */ | 33 size_t lMem, /* (i) Length of the CB memory */ |
| 34 int16_t lTarget, /* (i) Length of the target vector */ | 34 size_t lTarget, /* (i) Length of the target vector */ |
| 35 int16_t *energyW16, /* (o) Energy in the CB vectors */ | 35 int16_t *energyW16, /* (o) Energy in the CB vectors */ |
| 36 int16_t *energyShifts, /* (o) Shift value of the energy */ | 36 int16_t *energyShifts, /* (o) Shift value of the energy */ |
| 37 int scale, /* (i) The scaling of all energy values */ | 37 int scale, /* (i) The scaling of all energy values */ |
| 38 int16_t base_size /* (i) Index to where energy values should be stored */ | 38 size_t base_size /* (i) Index to where energy values should be stored */ |
| 39 ) { | 39 ) { |
| 40 int16_t *ppi, *ppo, *pp; | 40 int16_t *ppi, *ppo, *pp; |
| 41 int32_t energy, tmp32; | 41 int32_t energy, tmp32; |
| 42 | 42 |
| 43 /* Compute the energy and store it in a vector. Also the | 43 /* Compute the energy and store it in a vector. Also the |
| 44 * corresponding shift values are stored. The energy values | 44 * corresponding shift values are stored. The energy values |
| 45 * are reused in all three stages. */ | 45 * are reused in all three stages. */ |
| 46 | 46 |
| 47 /* Calculate the energy in the first block of 'lTarget' sampels. */ | 47 /* Calculate the energy in the first block of 'lTarget' sampels. */ |
| 48 ppi = CB+lMem-lTarget-1; | 48 ppi = CB+lMem-lTarget-1; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 70 /* Normalize the energy and store the number of shifts */ | 70 /* Normalize the energy and store the number of shifts */ |
| 71 energyShifts[base_size] = (int16_t)WebRtcSpl_NormW32(energy); | 71 energyShifts[base_size] = (int16_t)WebRtcSpl_NormW32(energy); |
| 72 tmp32 = energy << energyShifts[base_size]; | 72 tmp32 = energy << energyShifts[base_size]; |
| 73 energyW16[base_size] = (int16_t)(tmp32 >> 16); | 73 energyW16[base_size] = (int16_t)(tmp32 >> 16); |
| 74 | 74 |
| 75 ppi = filteredCB + lMem - 1 - lTarget; | 75 ppi = filteredCB + lMem - 1 - lTarget; |
| 76 ppo = filteredCB + lMem - 1; | 76 ppo = filteredCB + lMem - 1; |
| 77 | 77 |
| 78 WebRtcIlbcfix_CbMemEnergyCalc(energy, range, ppi, ppo, energyW16, energyShifts
, scale, base_size); | 78 WebRtcIlbcfix_CbMemEnergyCalc(energy, range, ppi, ppo, energyW16, energyShifts
, scale, base_size); |
| 79 } | 79 } |
| OLD | NEW |