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 15 matching lines...) Expand all Loading... |
26 | 26 |
27 void WebRtcIlbcfix_StateSearch( | 27 void WebRtcIlbcfix_StateSearch( |
28 IlbcEncoder *iLBCenc_inst, | 28 IlbcEncoder *iLBCenc_inst, |
29 /* (i) Encoder instance */ | 29 /* (i) Encoder instance */ |
30 iLBC_bits *iLBC_encbits,/* (i/o) Encoded bits (output idxForMax | 30 iLBC_bits *iLBC_encbits,/* (i/o) Encoded bits (output idxForMax |
31 and idxVec, input state_first) */ | 31 and idxVec, input state_first) */ |
32 int16_t *residual, /* (i) target residual vector */ | 32 int16_t *residual, /* (i) target residual vector */ |
33 int16_t *syntDenum, /* (i) lpc synthesis filter */ | 33 int16_t *syntDenum, /* (i) lpc synthesis filter */ |
34 int16_t *weightDenum /* (i) weighting filter denuminator */ | 34 int16_t *weightDenum /* (i) weighting filter denuminator */ |
35 ) { | 35 ) { |
36 int16_t k, index; | 36 size_t k, index; |
37 int16_t maxVal; | 37 int16_t maxVal; |
38 int16_t scale, shift; | 38 int16_t scale, shift; |
39 int32_t maxValsq; | 39 int32_t maxValsq; |
40 int16_t scaleRes; | 40 int16_t scaleRes; |
41 int16_t max; | 41 int16_t max; |
42 int i; | 42 int i; |
43 /* Stack based */ | 43 /* Stack based */ |
44 int16_t numerator[1+LPC_FILTERORDER]; | 44 int16_t numerator[1+LPC_FILTERORDER]; |
45 int16_t residualLongVec[2*STATE_SHORT_LEN_30MS+LPC_FILTERORDER]; | 45 int16_t residualLongVec[2*STATE_SHORT_LEN_30MS+LPC_FILTERORDER]; |
46 int16_t sampleMa[2*STATE_SHORT_LEN_30MS]; | 46 int16_t sampleMa[2*STATE_SHORT_LEN_30MS]; |
(...skipping 10 matching lines...) Expand all Loading... |
57 } | 57 } |
58 | 58 |
59 /* Copy the residual to a temporary buffer that we can filter | 59 /* Copy the residual to a temporary buffer that we can filter |
60 * and set the remaining samples to zero. | 60 * and set the remaining samples to zero. |
61 */ | 61 */ |
62 WEBRTC_SPL_MEMCPY_W16(residualLong, residual, iLBCenc_inst->state_short_len); | 62 WEBRTC_SPL_MEMCPY_W16(residualLong, residual, iLBCenc_inst->state_short_len); |
63 WebRtcSpl_MemSetW16(residualLong + iLBCenc_inst->state_short_len, 0, iLBCenc_i
nst->state_short_len); | 63 WebRtcSpl_MemSetW16(residualLong + iLBCenc_inst->state_short_len, 0, iLBCenc_i
nst->state_short_len); |
64 | 64 |
65 /* Run the Zero-Pole filter (Ciurcular convolution) */ | 65 /* Run the Zero-Pole filter (Ciurcular convolution) */ |
66 WebRtcSpl_MemSetW16(residualLongVec, 0, LPC_FILTERORDER); | 66 WebRtcSpl_MemSetW16(residualLongVec, 0, LPC_FILTERORDER); |
67 WebRtcSpl_FilterMAFastQ12( | 67 WebRtcSpl_FilterMAFastQ12(residualLong, sampleMa, numerator, |
68 residualLong, sampleMa, | 68 LPC_FILTERORDER + 1, |
69 numerator, LPC_FILTERORDER+1, (int16_t)(iLBCenc_inst->state_short_len + LP
C_FILTERORDER)); | 69 iLBCenc_inst->state_short_len + LPC_FILTERORDER); |
70 WebRtcSpl_MemSetW16(&sampleMa[iLBCenc_inst->state_short_len + LPC_FILTERORDER]
, 0, iLBCenc_inst->state_short_len - LPC_FILTERORDER); | 70 WebRtcSpl_MemSetW16(&sampleMa[iLBCenc_inst->state_short_len + LPC_FILTERORDER]
, 0, iLBCenc_inst->state_short_len - LPC_FILTERORDER); |
71 | 71 |
72 WebRtcSpl_FilterARFastQ12( | 72 WebRtcSpl_FilterARFastQ12( |
73 sampleMa, sampleAr, | 73 sampleMa, sampleAr, |
74 syntDenum, LPC_FILTERORDER+1, 2 * iLBCenc_inst->state_short_len); | 74 syntDenum, LPC_FILTERORDER+1, 2 * iLBCenc_inst->state_short_len); |
75 | 75 |
76 for(k=0;k<iLBCenc_inst->state_short_len;k++){ | 76 for(k=0;k<iLBCenc_inst->state_short_len;k++){ |
77 sampleAr[k] += sampleAr[k+iLBCenc_inst->state_short_len]; | 77 sampleAr[k] += sampleAr[k+iLBCenc_inst->state_short_len]; |
78 } | 78 } |
79 | 79 |
(...skipping 30 matching lines...) Expand all Loading... |
110 | 110 |
111 /* Set up vectors for AbsQuant and rescale it with the scale factor */ | 111 /* Set up vectors for AbsQuant and rescale it with the scale factor */ |
112 WebRtcSpl_ScaleVectorWithSat(sampleAr, sampleAr, scale, | 112 WebRtcSpl_ScaleVectorWithSat(sampleAr, sampleAr, scale, |
113 iLBCenc_inst->state_short_len, (int16_t)(shift-sca
leRes)); | 113 iLBCenc_inst->state_short_len, (int16_t)(shift-sca
leRes)); |
114 | 114 |
115 /* Quantize the values in fout[] */ | 115 /* Quantize the values in fout[] */ |
116 WebRtcIlbcfix_AbsQuant(iLBCenc_inst, iLBC_encbits, sampleAr, weightDenum); | 116 WebRtcIlbcfix_AbsQuant(iLBCenc_inst, iLBC_encbits, sampleAr, weightDenum); |
117 | 117 |
118 return; | 118 return; |
119 } | 119 } |
OLD | NEW |