OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 static void UpdateNoiseEstimate(NoiseSuppressionFixedC* inst, int offset) { | 303 static void UpdateNoiseEstimate(NoiseSuppressionFixedC* inst, int offset) { |
304 int32_t tmp32no1 = 0; | 304 int32_t tmp32no1 = 0; |
305 int32_t tmp32no2 = 0; | 305 int32_t tmp32no2 = 0; |
306 int16_t tmp16 = 0; | 306 int16_t tmp16 = 0; |
307 const int16_t kExp2Const = 11819; // Q13 | 307 const int16_t kExp2Const = 11819; // Q13 |
308 | 308 |
309 size_t i = 0; | 309 size_t i = 0; |
310 | 310 |
311 tmp16 = WebRtcSpl_MaxValueW16(inst->noiseEstLogQuantile + offset, | 311 tmp16 = WebRtcSpl_MaxValueW16(inst->noiseEstLogQuantile + offset, |
312 inst->magnLen); | 312 inst->magnLen); |
313 // Guarantee a Q-domain as high as possible and still fit in int16 | 313 // Guarantee a Q-domain as high as possible and still fit in int16_t |
314 inst->qNoise = 14 - (int) WEBRTC_SPL_MUL_16_16_RSFT_WITH_ROUND( | 314 inst->qNoise = 14 - (int) WEBRTC_SPL_MUL_16_16_RSFT_WITH_ROUND( |
315 kExp2Const, tmp16, 21); | 315 kExp2Const, tmp16, 21); |
316 for (i = 0; i < inst->magnLen; i++) { | 316 for (i = 0; i < inst->magnLen; i++) { |
317 // inst->quantile[i]=exp(inst->lquantile[offset+i]); | 317 // inst->quantile[i]=exp(inst->lquantile[offset+i]); |
318 // in Q21 | 318 // in Q21 |
319 tmp32no2 = kExp2Const * inst->noiseEstLogQuantile[offset + i]; | 319 tmp32no2 = kExp2Const * inst->noiseEstLogQuantile[offset + i]; |
320 tmp32no1 = (0x00200000 | (tmp32no2 & 0x001FFFFF)); // 2^21 + frac | 320 tmp32no1 = (0x00200000 | (tmp32no2 & 0x001FFFFF)); // 2^21 + frac |
321 tmp16 = (int16_t)(tmp32no2 >> 21); | 321 tmp16 = (int16_t)(tmp32no2 >> 21); |
322 tmp16 -= 21;// shift 21 to get result in Q0 | 322 tmp16 -= 21;// shift 21 to get result in Q0 |
323 tmp16 += (int16_t) inst->qNoise; //shift to get result in Q(qNoise) | 323 tmp16 += (int16_t) inst->qNoise; //shift to get result in Q(qNoise) |
(...skipping 1779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2103 | 2103 |
2104 //apply gain | 2104 //apply gain |
2105 for (i = 0; i < num_high_bands; ++i) { | 2105 for (i = 0; i < num_high_bands; ++i) { |
2106 for (j = 0; j < inst->blockLen10ms; j++) { | 2106 for (j = 0; j < inst->blockLen10ms; j++) { |
2107 outFrameHB[i][j] = (int16_t)((gainTimeDomainHB * | 2107 outFrameHB[i][j] = (int16_t)((gainTimeDomainHB * |
2108 inst->dataBufHBFX[i][j]) >> 14); // Q0 | 2108 inst->dataBufHBFX[i][j]) >> 14); // Q0 |
2109 } | 2109 } |
2110 } | 2110 } |
2111 } // end of H band gain computation | 2111 } // end of H band gain computation |
2112 } | 2112 } |
OLD | NEW |