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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
91 startPos=440; /* Start position for enhancement | 91 startPos=440; /* Start position for enhancement |
92 (640-new_blocks*ENH_BLOCKL-40) */ | 92 (640-new_blocks*ENH_BLOCKL-40) */ |
93 } | 93 } |
94 | 94 |
95 /* Update the pitch prediction for each enhancer block, move the old ones */ | 95 /* Update the pitch prediction for each enhancer block, move the old ones */ |
96 memmove(enh_period, &enh_period[new_blocks], | 96 memmove(enh_period, &enh_period[new_blocks], |
97 (ENH_NBLOCKS_TOT - new_blocks) * sizeof(*enh_period)); | 97 (ENH_NBLOCKS_TOT - new_blocks) * sizeof(*enh_period)); |
98 | 98 |
99 k=WebRtcSpl_DownsampleFast( | 99 k=WebRtcSpl_DownsampleFast( |
100 enh_buf+ENH_BUFL-inLen, /* Input samples */ | 100 enh_buf+ENH_BUFL-inLen, /* Input samples */ |
101 (int16_t)(inLen+ENH_BUFL_FILTEROVERHEAD), | 101 inLen + ENH_BUFL_FILTEROVERHEAD, |
102 downsampled, | 102 downsampled, |
103 (int16_t)(inLen / 2), | 103 inLen / 2, |
104 (int16_t*)WebRtcIlbcfix_kLpFiltCoefs, /* Coefficients in Q12 */ | 104 (int16_t*)WebRtcIlbcfix_kLpFiltCoefs, /* Coefficients in Q12 */ |
105 FILTERORDER_DS_PLUS1, /* Length of filter (order-1) */ | 105 FILTERORDER_DS_PLUS1, /* Length of filter (order-1) */ |
106 FACTOR_DS, | 106 FACTOR_DS, |
107 DELAY_DS); | 107 DELAY_DS); |
108 | 108 |
109 /* Estimate the pitch in the down sampled domain. */ | 109 /* Estimate the pitch in the down sampled domain. */ |
110 for(iblock = 0; iblock<new_blocks; iblock++){ | 110 for(iblock = 0; iblock<new_blocks; iblock++){ |
111 | 111 |
112 /* references */ | 112 /* references */ |
113 i = 60 + iblock * ENH_BLOCKL_HALF; | 113 i = 60 + iblock * ENH_BLOCKL_HALF; |
114 target=downsampled+i; | 114 target=downsampled+i; |
115 regressor=downsampled+i-10; | 115 regressor=downsampled+i-10; |
116 | 116 |
117 /* scaling */ | 117 /* scaling */ |
118 max16=WebRtcSpl_MaxAbsValueW16(®ressor[-50], | 118 max16=WebRtcSpl_MaxAbsValueW16(®ressor[-50], ENH_BLOCKL_HALF + 50 - 1); |
kwiberg-webrtc
2015/06/08 13:09:38
Optional: fix formatting on the whole line while y
Peter Kasting
2015/06/08 20:44:29
I can do that for all three places in this file.
Peter Kasting
2015/06/10 01:09:54
Done.
| |
119 (int16_t)(ENH_BLOCKL_HALF+50-1)); | |
120 shifts = WebRtcSpl_GetSizeInBits((uint32_t)(max16 * max16)) - 25; | 119 shifts = WebRtcSpl_GetSizeInBits((uint32_t)(max16 * max16)) - 25; |
121 shifts = WEBRTC_SPL_MAX(0, shifts); | 120 shifts = WEBRTC_SPL_MAX(0, shifts); |
122 | 121 |
123 /* compute cross correlation */ | 122 /* compute cross correlation */ |
124 WebRtcSpl_CrossCorrelation(corr32, target, regressor, | 123 WebRtcSpl_CrossCorrelation(corr32, target, regressor, |
125 ENH_BLOCKL_HALF, 50, (int16_t)shifts, -1); | 124 ENH_BLOCKL_HALF, 50, (int16_t)shifts, -1); |
126 | 125 |
127 /* Find 3 highest correlations that should be compared for the | 126 /* Find 3 highest correlations that should be compared for the |
128 highest (corr*corr)/ener */ | 127 highest (corr*corr)/ener */ |
129 | 128 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
193 | 192 |
194 /* Calculate the best lag of the new frame | 193 /* Calculate the best lag of the new frame |
195 This is used to interpolate backwards and mix with the PLC'd data | 194 This is used to interpolate backwards and mix with the PLC'd data |
196 */ | 195 */ |
197 | 196 |
198 /* references */ | 197 /* references */ |
199 target=in; | 198 target=in; |
200 regressor=in+tlag-1; | 199 regressor=in+tlag-1; |
201 | 200 |
202 /* scaling */ | 201 /* scaling */ |
203 max16=WebRtcSpl_MaxAbsValueW16(regressor, (int16_t)(plc_blockl+3-1)); | 202 max16=WebRtcSpl_MaxAbsValueW16(regressor, plc_blockl + 3 - 1); |
204 if (max16>5000) | 203 if (max16>5000) |
205 shifts=2; | 204 shifts=2; |
206 else | 205 else |
207 shifts=0; | 206 shifts=0; |
208 | 207 |
209 /* compute cross correlation */ | 208 /* compute cross correlation */ |
210 WebRtcSpl_CrossCorrelation(corr32, target, regressor, | 209 WebRtcSpl_CrossCorrelation(corr32, target, regressor, |
211 plc_blockl, 3, (int16_t)shifts, 1); | 210 plc_blockl, 3, (int16_t)shifts, 1); |
212 | 211 |
213 /* find lag */ | 212 /* find lag */ |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
332 WebRtcSpl_MemSetW16(iLBCdec_inst->hpimemx, 0, 2); | 331 WebRtcSpl_MemSetW16(iLBCdec_inst->hpimemx, 0, 2); |
333 | 332 |
334 /* Initialize filter memory by filtering through 2 lags */ | 333 /* Initialize filter memory by filtering through 2 lags */ |
335 WEBRTC_SPL_MEMCPY_W16(&synt[-LPC_FILTERORDER], iLBCdec_inst->syntMem, | 334 WEBRTC_SPL_MEMCPY_W16(&synt[-LPC_FILTERORDER], iLBCdec_inst->syntMem, |
336 LPC_FILTERORDER); | 335 LPC_FILTERORDER); |
337 WebRtcSpl_FilterARFastQ12( | 336 WebRtcSpl_FilterARFastQ12( |
338 enh_bufPtr1, | 337 enh_bufPtr1, |
339 synt, | 338 synt, |
340 &iLBCdec_inst->old_syntdenum[ | 339 &iLBCdec_inst->old_syntdenum[ |
341 (iLBCdec_inst->nsub-1)*(LPC_FILTERORDER+1 )], | 340 (iLBCdec_inst->nsub-1)*(LPC_FILTERORDER+1 )], |
342 LPC_FILTERORDER+1, (int16_t)lag); | 341 LPC_FILTERORDER+1, lag); |
343 | 342 |
344 WEBRTC_SPL_MEMCPY_W16(&synt[-LPC_FILTERORDER], &synt[lag-LPC_FILTERORDER], | 343 WEBRTC_SPL_MEMCPY_W16(&synt[-LPC_FILTERORDER], &synt[lag-LPC_FILTERORDER], |
345 LPC_FILTERORDER); | 344 LPC_FILTERORDER); |
346 WebRtcIlbcfix_HpOutput(synt, (int16_t*)WebRtcIlbcfix_kHpOutCoefs, | 345 WebRtcIlbcfix_HpOutput(synt, (int16_t*)WebRtcIlbcfix_kHpOutCoefs, |
347 iLBCdec_inst->hpimemy, iLBCdec_inst->hpimemx, | 346 iLBCdec_inst->hpimemy, iLBCdec_inst->hpimemx, |
348 (int16_t)lag); | 347 (int16_t)lag); |
349 WebRtcSpl_FilterARFastQ12( | 348 WebRtcSpl_FilterARFastQ12( |
350 enh_bufPtr1, synt, | 349 enh_bufPtr1, synt, |
351 &iLBCdec_inst->old_syntdenum[ | 350 &iLBCdec_inst->old_syntdenum[ |
352 (iLBCdec_inst->nsub-1)*(LPC_FILTERORDER+1 )], | 351 (iLBCdec_inst->nsub-1)*(LPC_FILTERORDER+1 )], |
353 LPC_FILTERORDER+1, (int16_t)lag); | 352 LPC_FILTERORDER+1, lag); |
354 | 353 |
355 WEBRTC_SPL_MEMCPY_W16(iLBCdec_inst->syntMem, &synt[lag-LPC_FILTERORDER], | 354 WEBRTC_SPL_MEMCPY_W16(iLBCdec_inst->syntMem, &synt[lag-LPC_FILTERORDER], |
356 LPC_FILTERORDER); | 355 LPC_FILTERORDER); |
357 WebRtcIlbcfix_HpOutput(synt, (int16_t*)WebRtcIlbcfix_kHpOutCoefs, | 356 WebRtcIlbcfix_HpOutput(synt, (int16_t*)WebRtcIlbcfix_kHpOutCoefs, |
358 iLBCdec_inst->hpimemy, iLBCdec_inst->hpimemx, | 357 iLBCdec_inst->hpimemy, iLBCdec_inst->hpimemx, |
359 (int16_t)lag); | 358 (int16_t)lag); |
360 } | 359 } |
361 } | 360 } |
362 | 361 |
363 | 362 |
364 /* Perform enhancement block by block */ | 363 /* Perform enhancement block by block */ |
365 | 364 |
366 for (iblock = 0; iblock<new_blocks; iblock++) { | 365 for (iblock = 0; iblock<new_blocks; iblock++) { |
367 WebRtcIlbcfix_Enhancer(out + iblock * ENH_BLOCKL, | 366 WebRtcIlbcfix_Enhancer(out + iblock * ENH_BLOCKL, |
368 enh_buf, | 367 enh_buf, |
369 ENH_BUFL, | 368 ENH_BUFL, |
370 (int16_t)(iblock * ENH_BLOCKL + startPos), | 369 (int16_t)(iblock * ENH_BLOCKL + startPos), |
371 enh_period, | 370 enh_period, |
372 (int16_t*)WebRtcIlbcfix_kEnhPlocs, ENH_NBLOCKS_TOT); | 371 (int16_t*)WebRtcIlbcfix_kEnhPlocs, ENH_NBLOCKS_TOT); |
373 } | 372 } |
374 | 373 |
375 return (lag); | 374 return (lag); |
376 } | 375 } |
OLD | NEW |