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_CbConstruct.c | 15 WebRtcIlbcfix_CbConstruct.c |
16 | 16 |
17 ******************************************************************/ | 17 ******************************************************************/ |
18 | 18 |
19 #include "cb_construct.h" | 19 #include "cb_construct.h" |
20 | 20 |
21 #include "defines.h" | 21 #include "defines.h" |
22 #include "gain_dequant.h" | 22 #include "gain_dequant.h" |
23 #include "get_cd_vec.h" | 23 #include "get_cd_vec.h" |
24 | 24 |
25 /*----------------------------------------------------------------* | 25 /*----------------------------------------------------------------* |
26 * Construct decoded vector from codebook and gains. | 26 * Construct decoded vector from codebook and gains. |
27 *---------------------------------------------------------------*/ | 27 *---------------------------------------------------------------*/ |
28 | 28 |
29 bool WebRtcIlbcfix_CbConstruct( | 29 bool WebRtcIlbcfix_CbConstruct( |
30 int16_t *decvector, /* (o) Decoded vector */ | 30 int16_t* decvector, /* (o) Decoded vector */ |
31 int16_t *index, /* (i) Codebook indices */ | 31 const int16_t* index, /* (i) Codebook indices */ |
32 int16_t *gain_index, /* (i) Gain quantization indices */ | 32 const int16_t* gain_index, /* (i) Gain quantization indices */ |
33 int16_t *mem, /* (i) Buffer for codevector construction */ | 33 int16_t* mem, /* (i) Buffer for codevector construction */ |
34 size_t lMem, /* (i) Length of buffer */ | 34 size_t lMem, /* (i) Length of buffer */ |
35 size_t veclen /* (i) Length of vector */ | 35 size_t veclen) { /* (i) Length of vector */ |
36 ){ | |
37 size_t j; | 36 size_t j; |
38 int16_t gain[CB_NSTAGES]; | 37 int16_t gain[CB_NSTAGES]; |
39 /* Stack based */ | 38 /* Stack based */ |
40 int16_t cbvec0[SUBL]; | 39 int16_t cbvec0[SUBL]; |
41 int16_t cbvec1[SUBL]; | 40 int16_t cbvec1[SUBL]; |
42 int16_t cbvec2[SUBL]; | 41 int16_t cbvec2[SUBL]; |
43 int32_t a32; | 42 int32_t a32; |
44 int16_t *gainPtr; | 43 int16_t *gainPtr; |
45 | 44 |
46 /* gain de-quantization */ | 45 /* gain de-quantization */ |
(...skipping 16 matching lines...) Expand all Loading... |
63 for (j=0;j<veclen;j++) { | 62 for (j=0;j<veclen;j++) { |
64 a32 = (*gainPtr++) * cbvec0[j]; | 63 a32 = (*gainPtr++) * cbvec0[j]; |
65 a32 += (*gainPtr++) * cbvec1[j]; | 64 a32 += (*gainPtr++) * cbvec1[j]; |
66 a32 += (*gainPtr) * cbvec2[j]; | 65 a32 += (*gainPtr) * cbvec2[j]; |
67 gainPtr -= 2; | 66 gainPtr -= 2; |
68 decvector[j] = (int16_t)((a32 + 8192) >> 14); | 67 decvector[j] = (int16_t)((a32 + 8192) >> 14); |
69 } | 68 } |
70 | 69 |
71 return true; // Success. | 70 return true; // Success. |
72 } | 71 } |
OLD | NEW |