| 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 #include "webrtc/common_audio/signal_processing/include/signal_processing_librar
y.h" |
| 21 | 22 |
| 22 /*----------------------------------------------------------------* | 23 /*----------------------------------------------------------------* |
| 23 * Recreate a specific codebook vector from the augmented part. | 24 * Recreate a specific codebook vector from the augmented part. |
| 24 * | 25 * |
| 25 *----------------------------------------------------------------*/ | 26 *----------------------------------------------------------------*/ |
| 26 | 27 |
| 27 void WebRtcIlbcfix_CreateAugmentedVec( | 28 void WebRtcIlbcfix_CreateAugmentedVec( |
| 28 size_t index, /* (i) Index for the augmented vector to be created */ | 29 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 | 30 int16_t *buffer, /* (i) Pointer to the end of the codebook memory that |
| 30 is used for creation of the augmented
codebook */ | 31 is used for creation of the augmented
codebook */ |
| (...skipping 15 matching lines...) Expand all Loading... |
| 46 | 47 |
| 47 /* perform cbVec[ilow+k] = ((ppi[k]*alphaTbl[k])>>15) + ((ppo[k]*alphaTbl[3-k]
)>>15); | 48 /* perform cbVec[ilow+k] = ((ppi[k]*alphaTbl[k])>>15) + ((ppo[k]*alphaTbl[3-k]
)>>15); |
| 48 for k = 0..3 | 49 for k = 0..3 |
| 49 */ | 50 */ |
| 50 WebRtcSpl_ElementwiseVectorMult(&cbVec[ilow], ppi, WebRtcIlbcfix_kAlpha, 4, 15
); | 51 WebRtcSpl_ElementwiseVectorMult(&cbVec[ilow], ppi, WebRtcIlbcfix_kAlpha, 4, 15
); |
| 51 WebRtcSpl_ReverseOrderMultArrayElements(cbVecTmp, ppo, &WebRtcIlbcfix_kAlpha[3
], 4, 15); | 52 WebRtcSpl_ReverseOrderMultArrayElements(cbVecTmp, ppo, &WebRtcIlbcfix_kAlpha[3
], 4, 15); |
| 52 WebRtcSpl_AddVectorsAndShift(&cbVec[ilow], &cbVec[ilow], cbVecTmp, 4, 0); | 53 WebRtcSpl_AddVectorsAndShift(&cbVec[ilow], &cbVec[ilow], cbVecTmp, 4, 0); |
| 53 | 54 |
| 54 /* copy the second noninterpolated part */ | 55 /* copy the second noninterpolated part */ |
| 55 ppo = buffer - index; | 56 ppo = buffer - index; |
| 56 WEBRTC_SPL_MEMCPY_W16(cbVec+index,ppo,(SUBL-index)); | 57 /* |tempbuff2| is declared in WebRtcIlbcfix_GetCbVec and is SUBL+5 elements |
| 58 long. |buffer| points one element past the end of that vector, i.e., at |
| 59 tempbuff2+SUBL+5. Since ppo=buffer-index, we cannot read any more than |
| 60 |index| elements from |ppo|. |
| 61 |
| 62 |cbVec| is declared to be SUBL elements long in WebRtcIlbcfix_CbConstruct. |
| 63 Therefore, we can only write SUBL-index elements to cbVec+index. |
| 64 |
| 65 These two conditions limit the number of elements to copy. |
| 66 */ |
| 67 WEBRTC_SPL_MEMCPY_W16(cbVec+index, ppo, WEBRTC_SPL_MIN(SUBL-index, index)); |
| 57 } | 68 } |
| OLD | NEW |