| 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 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 /*----------------------------------------------------------------* | 23 /*----------------------------------------------------------------* |
| 24 * Construct decoded vector from codebook and gains. | 24 * Construct decoded vector from codebook and gains. |
| 25 *---------------------------------------------------------------*/ | 25 *---------------------------------------------------------------*/ |
| 26 | 26 |
| 27 void WebRtcIlbcfix_CbConstruct( | 27 void WebRtcIlbcfix_CbConstruct( |
| 28 int16_t *decvector, /* (o) Decoded vector */ | 28 int16_t *decvector, /* (o) Decoded vector */ |
| 29 int16_t *index, /* (i) Codebook indices */ | 29 int16_t *index, /* (i) Codebook indices */ |
| 30 int16_t *gain_index, /* (i) Gain quantization indices */ | 30 int16_t *gain_index, /* (i) Gain quantization indices */ |
| 31 int16_t *mem, /* (i) Buffer for codevector construction */ | 31 int16_t *mem, /* (i) Buffer for codevector construction */ |
| 32 int16_t lMem, /* (i) Length of buffer */ | 32 size_t lMem, /* (i) Length of buffer */ |
| 33 int16_t veclen /* (i) Length of vector */ | 33 size_t veclen /* (i) Length of vector */ |
| 34 ){ | 34 ){ |
| 35 int j; | 35 size_t j; |
| 36 int16_t gain[CB_NSTAGES]; | 36 int16_t gain[CB_NSTAGES]; |
| 37 /* Stack based */ | 37 /* Stack based */ |
| 38 int16_t cbvec0[SUBL]; | 38 int16_t cbvec0[SUBL]; |
| 39 int16_t cbvec1[SUBL]; | 39 int16_t cbvec1[SUBL]; |
| 40 int16_t cbvec2[SUBL]; | 40 int16_t cbvec2[SUBL]; |
| 41 int32_t a32; | 41 int32_t a32; |
| 42 int16_t *gainPtr; | 42 int16_t *gainPtr; |
| 43 | 43 |
| 44 /* gain de-quantization */ | 44 /* gain de-quantization */ |
| 45 | 45 |
| 46 gain[0] = WebRtcIlbcfix_GainDequant(gain_index[0], 16384, 0); | 46 gain[0] = WebRtcIlbcfix_GainDequant(gain_index[0], 16384, 0); |
| 47 gain[1] = WebRtcIlbcfix_GainDequant(gain_index[1], gain[0], 1); | 47 gain[1] = WebRtcIlbcfix_GainDequant(gain_index[1], gain[0], 1); |
| 48 gain[2] = WebRtcIlbcfix_GainDequant(gain_index[2], gain[1], 2); | 48 gain[2] = WebRtcIlbcfix_GainDequant(gain_index[2], gain[1], 2); |
| 49 | 49 |
| 50 /* codebook vector construction and construction of total vector */ | 50 /* codebook vector construction and construction of total vector */ |
| 51 | 51 |
| 52 /* Stack based */ | 52 /* Stack based */ |
| 53 WebRtcIlbcfix_GetCbVec(cbvec0, mem, index[0], lMem, veclen); | 53 WebRtcIlbcfix_GetCbVec(cbvec0, mem, (size_t)index[0], lMem, veclen); |
| 54 WebRtcIlbcfix_GetCbVec(cbvec1, mem, index[1], lMem, veclen); | 54 WebRtcIlbcfix_GetCbVec(cbvec1, mem, (size_t)index[1], lMem, veclen); |
| 55 WebRtcIlbcfix_GetCbVec(cbvec2, mem, index[2], lMem, veclen); | 55 WebRtcIlbcfix_GetCbVec(cbvec2, mem, (size_t)index[2], lMem, veclen); |
| 56 | 56 |
| 57 gainPtr = &gain[0]; | 57 gainPtr = &gain[0]; |
| 58 for (j=0;j<veclen;j++) { | 58 for (j=0;j<veclen;j++) { |
| 59 a32 = (*gainPtr++) * cbvec0[j]; | 59 a32 = (*gainPtr++) * cbvec0[j]; |
| 60 a32 += (*gainPtr++) * cbvec1[j]; | 60 a32 += (*gainPtr++) * cbvec1[j]; |
| 61 a32 += (*gainPtr) * cbvec2[j]; | 61 a32 += (*gainPtr) * cbvec2[j]; |
| 62 gainPtr -= 2; | 62 gainPtr -= 2; |
| 63 decvector[j] = (int16_t)((a32 + 8192) >> 14); | 63 decvector[j] = (int16_t)((a32 + 8192) >> 14); |
| 64 } | 64 } |
| 65 | 65 |
| 66 return; | 66 return; |
| 67 } | 67 } |
| OLD | NEW |