| 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_StateConstruct.c | 15 WebRtcIlbcfix_StateConstruct.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 * decoding of the start state | 23 * decoding of the start state |
| 24 *---------------------------------------------------------------*/ | 24 *---------------------------------------------------------------*/ |
| 25 | 25 |
| 26 void WebRtcIlbcfix_StateConstruct( | 26 void WebRtcIlbcfix_StateConstruct( |
| 27 int16_t idxForMax, /* (i) 6-bit index for the quantization of | 27 size_t idxForMax, /* (i) 6-bit index for the quantization of |
| 28 max amplitude */ | 28 max amplitude */ |
| 29 int16_t *idxVec, /* (i) vector of quantization indexes */ | 29 int16_t *idxVec, /* (i) vector of quantization indexes */ |
| 30 int16_t *syntDenum, /* (i) synthesis filter denumerator */ | 30 int16_t *syntDenum, /* (i) synthesis filter denumerator */ |
| 31 int16_t *Out_fix, /* (o) the decoded state vector */ | 31 int16_t *Out_fix, /* (o) the decoded state vector */ |
| 32 int16_t len /* (i) length of a state vector */ | 32 size_t len /* (i) length of a state vector */ |
| 33 ) { | 33 ) { |
| 34 int k; | 34 size_t k; |
| 35 int16_t maxVal; | 35 int16_t maxVal; |
| 36 int16_t *tmp1, *tmp2, *tmp3; | 36 int16_t *tmp1, *tmp2, *tmp3; |
| 37 /* Stack based */ | 37 /* Stack based */ |
| 38 int16_t numerator[1+LPC_FILTERORDER]; | 38 int16_t numerator[1+LPC_FILTERORDER]; |
| 39 int16_t sampleValVec[2*STATE_SHORT_LEN_30MS+LPC_FILTERORDER]; | 39 int16_t sampleValVec[2*STATE_SHORT_LEN_30MS+LPC_FILTERORDER]; |
| 40 int16_t sampleMaVec[2*STATE_SHORT_LEN_30MS+LPC_FILTERORDER]; | 40 int16_t sampleMaVec[2*STATE_SHORT_LEN_30MS+LPC_FILTERORDER]; |
| 41 int16_t *sampleVal = &sampleValVec[LPC_FILTERORDER]; | 41 int16_t *sampleVal = &sampleValVec[LPC_FILTERORDER]; |
| 42 int16_t *sampleMa = &sampleMaVec[LPC_FILTERORDER]; | 42 int16_t *sampleMa = &sampleMaVec[LPC_FILTERORDER]; |
| 43 int16_t *sampleAr = &sampleValVec[LPC_FILTERORDER]; | 43 int16_t *sampleAr = &sampleValVec[LPC_FILTERORDER]; |
| 44 | 44 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 WebRtcSpl_MemSetW16(&sampleVal[len], 0, len); | 89 WebRtcSpl_MemSetW16(&sampleVal[len], 0, len); |
| 90 | 90 |
| 91 /* circular convolution with all-pass filter */ | 91 /* circular convolution with all-pass filter */ |
| 92 | 92 |
| 93 /* Set the state to zero */ | 93 /* Set the state to zero */ |
| 94 WebRtcSpl_MemSetW16(sampleValVec, 0, (LPC_FILTERORDER)); | 94 WebRtcSpl_MemSetW16(sampleValVec, 0, (LPC_FILTERORDER)); |
| 95 | 95 |
| 96 /* Run MA filter + AR filter */ | 96 /* Run MA filter + AR filter */ |
| 97 WebRtcSpl_FilterMAFastQ12( | 97 WebRtcSpl_FilterMAFastQ12( |
| 98 sampleVal, sampleMa, | 98 sampleVal, sampleMa, |
| 99 numerator, LPC_FILTERORDER+1, (int16_t)(len + LPC_FILTERORDER)); | 99 numerator, LPC_FILTERORDER+1, len + LPC_FILTERORDER); |
| 100 WebRtcSpl_MemSetW16(&sampleMa[len + LPC_FILTERORDER], 0, (len - LPC_FILTERORDE
R)); | 100 WebRtcSpl_MemSetW16(&sampleMa[len + LPC_FILTERORDER], 0, (len - LPC_FILTERORDE
R)); |
| 101 WebRtcSpl_FilterARFastQ12( | 101 WebRtcSpl_FilterARFastQ12( |
| 102 sampleMa, sampleAr, | 102 sampleMa, sampleAr, |
| 103 syntDenum, LPC_FILTERORDER+1, 2 * len); | 103 syntDenum, LPC_FILTERORDER+1, 2 * len); |
| 104 | 104 |
| 105 tmp1 = &sampleAr[len-1]; | 105 tmp1 = &sampleAr[len-1]; |
| 106 tmp2 = &sampleAr[2*len-1]; | 106 tmp2 = &sampleAr[2*len-1]; |
| 107 tmp3 = Out_fix; | 107 tmp3 = Out_fix; |
| 108 for(k=0;k<len;k++){ | 108 for(k=0;k<len;k++){ |
| 109 (*tmp3) = (*tmp1) + (*tmp2); | 109 (*tmp3) = (*tmp1) + (*tmp2); |
| 110 tmp1--; | 110 tmp1--; |
| 111 tmp2--; | 111 tmp2--; |
| 112 tmp3++; | 112 tmp3++; |
| 113 } | 113 } |
| 114 } | 114 } |
| OLD | NEW |