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_CreateAugmentedVec.c | 15 WebRtcIlbcfix_CreateAugmentedVec.c |
16 | 16 |
17 ******************************************************************/ | 17 ******************************************************************/ |
18 | 18 |
19 #include "defines.h" | 19 #include "defines.h" |
20 #include "constants.h" | 20 #include "constants.h" |
21 | 21 |
22 /*----------------------------------------------------------------* | 22 /*----------------------------------------------------------------* |
23 * Recreate a specific codebook vector from the augmented part. | 23 * Recreate a specific codebook vector from the augmented part. |
24 * | 24 * |
25 *----------------------------------------------------------------*/ | 25 *----------------------------------------------------------------*/ |
26 | 26 |
27 void WebRtcIlbcfix_CreateAugmentedVec( | 27 void WebRtcIlbcfix_CreateAugmentedVec( |
28 int16_t index, /* (i) Index for the augmented vector to be created */ | 28 size_t index, /* (i) Index for the augmented vector to be created */ |
29 int16_t *buffer, /* (i) Pointer to the end of the codebook memory that | 29 int16_t *buffer, /* (i) Pointer to the end of the codebook memory that |
30 is used for creation of the augmented
codebook */ | 30 is used for creation of the augmented
codebook */ |
31 int16_t *cbVec /* (o) The construced codebook vector */ | 31 int16_t *cbVec /* (o) The construced codebook vector */ |
32 ) { | 32 ) { |
33 int16_t ilow; | 33 size_t ilow; |
34 int16_t *ppo, *ppi; | 34 int16_t *ppo, *ppi; |
35 int16_t cbVecTmp[4]; | 35 int16_t cbVecTmp[4]; |
36 | 36 |
37 ilow = index-4; | 37 ilow = index-4; |
38 | 38 |
39 /* copy the first noninterpolated part */ | 39 /* copy the first noninterpolated part */ |
40 ppo = buffer-index; | 40 ppo = buffer-index; |
41 WEBRTC_SPL_MEMCPY_W16(cbVec, ppo, index); | 41 WEBRTC_SPL_MEMCPY_W16(cbVec, ppo, index); |
42 | 42 |
43 /* interpolation */ | 43 /* interpolation */ |
44 ppo = buffer - 4; | 44 ppo = buffer - 4; |
45 ppi = buffer - index - 4; | 45 ppi = buffer - index - 4; |
46 | 46 |
47 /* perform cbVec[ilow+k] = ((ppi[k]*alphaTbl[k])>>15) + ((ppo[k]*alphaTbl[3-k]
)>>15); | 47 /* perform cbVec[ilow+k] = ((ppi[k]*alphaTbl[k])>>15) + ((ppo[k]*alphaTbl[3-k]
)>>15); |
48 for k = 0..3 | 48 for k = 0..3 |
49 */ | 49 */ |
50 WebRtcSpl_ElementwiseVectorMult(&cbVec[ilow], ppi, WebRtcIlbcfix_kAlpha, 4, 15
); | 50 WebRtcSpl_ElementwiseVectorMult(&cbVec[ilow], ppi, WebRtcIlbcfix_kAlpha, 4, 15
); |
51 WebRtcSpl_ReverseOrderMultArrayElements(cbVecTmp, ppo, &WebRtcIlbcfix_kAlpha[3
], 4, 15); | 51 WebRtcSpl_ReverseOrderMultArrayElements(cbVecTmp, ppo, &WebRtcIlbcfix_kAlpha[3
], 4, 15); |
52 WebRtcSpl_AddVectorsAndShift(&cbVec[ilow], &cbVec[ilow], cbVecTmp, 4, 0); | 52 WebRtcSpl_AddVectorsAndShift(&cbVec[ilow], &cbVec[ilow], cbVecTmp, 4, 0); |
53 | 53 |
54 /* copy the second noninterpolated part */ | 54 /* copy the second noninterpolated part */ |
55 ppo = buffer - index; | 55 ppo = buffer - index; |
56 WEBRTC_SPL_MEMCPY_W16(cbVec+index,ppo,(SUBL-index)); | 56 WEBRTC_SPL_MEMCPY_W16(cbVec+index,ppo,(SUBL-index)); |
57 } | 57 } |
OLD | NEW |