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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 } | 175 } |
176 | 176 |
177 | 177 |
178 /* reduce gain to compensate for pitch enhancer */ | 178 /* reduce gain to compensate for pitch enhancer */ |
179 /* gain = 1.0f - 0.45f * AvgPitchGain; */ | 179 /* gain = 1.0f - 0.45f * AvgPitchGain; */ |
180 tmp32a = AvgPitchGain_Q12 * 29; // Q18 | 180 tmp32a = AvgPitchGain_Q12 * 29; // Q18 |
181 gainQ13 = (int16_t)((262144 - tmp32a) >> 5); // Q18 -> Q13. | 181 gainQ13 = (int16_t)((262144 - tmp32a) >> 5); // Q18 -> Q13. |
182 | 182 |
183 for (k = 0; k < FRAMESAMPLES/2; k++) | 183 for (k = 0; k < FRAMESAMPLES/2; k++) |
184 { | 184 { |
185 Vector_Word32_1[k] = (Vector_Word16_2[k] * gainQ13) << 3; // Q25 | 185 Vector_Word32_1[k] = (Vector_Word16_2[k] * gainQ13) * (1 << 3); // Q25 |
186 } | 186 } |
187 | 187 |
188 | 188 |
189 /* perceptual post-filtering (using normalized lattice filter) */ | 189 /* perceptual post-filtering (using normalized lattice filter) */ |
190 WebRtcIsacfix_NormLatticeFilterAr(ORDERLO, (ISACdec_obj->maskfiltstr_obj).Po
stStateLoGQ0, | 190 WebRtcIsacfix_NormLatticeFilterAr(ORDERLO, (ISACdec_obj->maskfiltstr_obj).Po
stStateLoGQ0, |
191 Vector_Word32_1, lofilt_coefQ15, gain_lo_h
iQ17, 0, Vector_Word16_1); | 191 Vector_Word32_1, lofilt_coefQ15, gain_lo_h
iQ17, 0, Vector_Word16_1); |
192 | 192 |
193 /* --- Store Highpass Residual --- */ | 193 /* --- Store Highpass Residual --- */ |
194 for (k = 0; k < FRAMESAMPLES/2; k++) | 194 for (k = 0; k < FRAMESAMPLES/2; k++) |
195 Vector_Word32_1[k] = Vector_Word32_2[k] << 9; // Q16 -> Q25 | 195 Vector_Word32_1[k] = Vector_Word32_2[k] * (1 << 9); // Q16 -> Q25 |
196 | 196 |
197 for( k = 0; k < PITCH_MAX_LAG + 10; k++ ) | 197 for( k = 0; k < PITCH_MAX_LAG + 10; k++ ) |
198 (ISACdec_obj->plcstr_obj).prevHP[k] = Vector_Word32_1[FRAMESAMPLES/2 - (PI
TCH_MAX_LAG + 10) + k]; | 198 (ISACdec_obj->plcstr_obj).prevHP[k] = Vector_Word32_1[FRAMESAMPLES/2 - (PI
TCH_MAX_LAG + 10) + k]; |
199 | 199 |
200 | 200 |
201 WebRtcIsacfix_NormLatticeFilterAr(ORDERHI, (ISACdec_obj->maskfiltstr_obj).Po
stStateHiGQ0, | 201 WebRtcIsacfix_NormLatticeFilterAr(ORDERHI, (ISACdec_obj->maskfiltstr_obj).Po
stStateHiGQ0, |
202 Vector_Word32_1, hifilt_coefQ15, gain_lo_h
iQ17, 1, Vector_Word16_2); | 202 Vector_Word32_1, hifilt_coefQ15, gain_lo_h
iQ17, 1, Vector_Word16_2); |
203 | 203 |
204 /* recombine the 2 bands */ | 204 /* recombine the 2 bands */ |
205 | 205 |
206 /* Form the polyphase signals, and compensate for DC offset */ | 206 /* Form the polyphase signals, and compensate for DC offset */ |
207 for (k=0;k<FRAMESAMPLES/2;k++) { | 207 for (k=0;k<FRAMESAMPLES/2;k++) { |
208 tmp_1 = (int16_t)WebRtcSpl_SatW32ToW16(((int32_t)Vector_Word16_1[k]+Vector
_Word16_2[k] + 1)); /* Construct a new upper channel signal*/ | 208 tmp_1 = (int16_t)WebRtcSpl_SatW32ToW16(((int32_t)Vector_Word16_1[k]+Vector
_Word16_2[k] + 1)); /* Construct a new upper channel signal*/ |
209 tmp_2 = (int16_t)WebRtcSpl_SatW32ToW16(((int32_t)Vector_Word16_1[k]-Vector
_Word16_2[k])); /* Construct a new lower channel signal*/ | 209 tmp_2 = (int16_t)WebRtcSpl_SatW32ToW16(((int32_t)Vector_Word16_1[k]-Vector
_Word16_2[k])); /* Construct a new lower channel signal*/ |
210 Vector_Word16_1[k] = tmp_1; | 210 Vector_Word16_1[k] = tmp_1; |
211 Vector_Word16_2[k] = tmp_2; | 211 Vector_Word16_2[k] = tmp_2; |
212 } | 212 } |
213 | 213 |
214 WebRtcIsacfix_FilterAndCombine1(Vector_Word16_1, | 214 WebRtcIsacfix_FilterAndCombine1(Vector_Word16_1, |
215 Vector_Word16_2, | 215 Vector_Word16_2, |
216 signal_out16 + frame_nb * kProcessedSamples, | 216 signal_out16 + frame_nb * kProcessedSamples, |
217 &ISACdec_obj->postfiltbankstr_obj); | 217 &ISACdec_obj->postfiltbankstr_obj); |
218 | 218 |
219 } | 219 } |
220 return len; | 220 return len; |
221 } | 221 } |
OLD | NEW |