| 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 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 | 490 |
| 491 // Updates the following smoothed Power Spectral Densities (PSD): | 491 // Updates the following smoothed Power Spectral Densities (PSD): |
| 492 // - sd : near-end | 492 // - sd : near-end |
| 493 // - se : residual echo | 493 // - se : residual echo |
| 494 // - sx : far-end | 494 // - sx : far-end |
| 495 // - sde : cross-PSD of near-end and residual echo | 495 // - sde : cross-PSD of near-end and residual echo |
| 496 // - sxd : cross-PSD of near-end and far-end | 496 // - sxd : cross-PSD of near-end and far-end |
| 497 // | 497 // |
| 498 // In addition to updating the PSDs, also the filter diverge state is determined | 498 // In addition to updating the PSDs, also the filter diverge state is determined |
| 499 // upon actions are taken. | 499 // upon actions are taken. |
| 500 static void SmoothedPSD(int mult, | 500 static void UpdateCoherenceSpectraSSE2(int mult, |
| 501 bool extended_filter_enabled, | 501 bool extended_filter_enabled, |
| 502 float efw[2][PART_LEN1], | 502 float efw[2][PART_LEN1], |
| 503 float dfw[2][PART_LEN1], | 503 float dfw[2][PART_LEN1], |
| 504 float xfw[2][PART_LEN1], | 504 float xfw[2][PART_LEN1], |
| 505 CoherenceState* coherence_state, | 505 CoherenceState* coherence_state, |
| 506 short* filter_divergence_state, | 506 short* filter_divergence_state, |
| 507 int* extreme_filter_divergence) { | 507 int* extreme_filter_divergence) { |
| 508 // Power estimate smoothing coefficients. | 508 // Power estimate smoothing coefficients. |
| 509 const float* ptrGCoh = | 509 const float* ptrGCoh = |
| 510 extended_filter_enabled | 510 extended_filter_enabled |
| 511 ? WebRtcAec_kExtendedSmoothingCoefficients[mult - 1] | 511 ? WebRtcAec_kExtendedSmoothingCoefficients[mult - 1] |
| 512 : WebRtcAec_kNormalSmoothingCoefficients[mult - 1]; | 512 : WebRtcAec_kNormalSmoothingCoefficients[mult - 1]; |
| 513 int i; | 513 int i; |
| 514 float sdSum = 0, seSum = 0; | 514 float sdSum = 0, seSum = 0; |
| 515 const __m128 vec_15 = _mm_set1_ps(WebRtcAec_kMinFarendPSD); | 515 const __m128 vec_15 = _mm_set1_ps(WebRtcAec_kMinFarendPSD); |
| 516 const __m128 vec_GCoh0 = _mm_set1_ps(ptrGCoh[0]); | 516 const __m128 vec_GCoh0 = _mm_set1_ps(ptrGCoh[0]); |
| 517 const __m128 vec_GCoh1 = _mm_set1_ps(ptrGCoh[1]); | 517 const __m128 vec_GCoh1 = _mm_set1_ps(ptrGCoh[1]); |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 673 _mm_storeu_ps(&data_complex[0][i], vec_a); | 673 _mm_storeu_ps(&data_complex[0][i], vec_a); |
| 674 _mm_storeu_ps(&data_complex[1][i], vec_b); | 674 _mm_storeu_ps(&data_complex[1][i], vec_b); |
| 675 } | 675 } |
| 676 // fix beginning/end values | 676 // fix beginning/end values |
| 677 data_complex[1][0] = 0; | 677 data_complex[1][0] = 0; |
| 678 data_complex[1][PART_LEN] = 0; | 678 data_complex[1][PART_LEN] = 0; |
| 679 data_complex[0][0] = data[0]; | 679 data_complex[0][0] = data[0]; |
| 680 data_complex[0][PART_LEN] = data[1]; | 680 data_complex[0][PART_LEN] = data[1]; |
| 681 } | 681 } |
| 682 | 682 |
| 683 static void SubbandCoherenceSSE2(int mult, | 683 static void ComputeCoherenceSSE2(const CoherenceState* coherence_state, |
| 684 bool extended_filter_enabled, | |
| 685 float efw[2][PART_LEN1], | |
| 686 float dfw[2][PART_LEN1], | |
| 687 float xfw[2][PART_LEN1], | |
| 688 float* fft, | |
| 689 float* cohde, | 684 float* cohde, |
| 690 float* cohxd, | 685 float* cohxd) { |
| 691 CoherenceState* coherence_state, | |
| 692 short* filter_divergence_state, | |
| 693 int* extreme_filter_divergence) { | |
| 694 int i; | 686 int i; |
| 695 | 687 |
| 696 SmoothedPSD(mult, extended_filter_enabled, efw, dfw, xfw, coherence_state, | |
| 697 filter_divergence_state, extreme_filter_divergence); | |
| 698 | |
| 699 { | 688 { |
| 700 const __m128 vec_1eminus10 = _mm_set1_ps(1e-10f); | 689 const __m128 vec_1eminus10 = _mm_set1_ps(1e-10f); |
| 701 | 690 |
| 702 // Subband coherence | 691 // Subband coherence |
| 703 for (i = 0; i + 3 < PART_LEN1; i += 4) { | 692 for (i = 0; i + 3 < PART_LEN1; i += 4) { |
| 704 const __m128 vec_sd = _mm_loadu_ps(&coherence_state->sd[i]); | 693 const __m128 vec_sd = _mm_loadu_ps(&coherence_state->sd[i]); |
| 705 const __m128 vec_se = _mm_loadu_ps(&coherence_state->se[i]); | 694 const __m128 vec_se = _mm_loadu_ps(&coherence_state->se[i]); |
| 706 const __m128 vec_sx = _mm_loadu_ps(&coherence_state->sx[i]); | 695 const __m128 vec_sx = _mm_loadu_ps(&coherence_state->sx[i]); |
| 707 const __m128 vec_sdse = | 696 const __m128 vec_sdse = |
| 708 _mm_add_ps(vec_1eminus10, _mm_mul_ps(vec_sd, vec_se)); | 697 _mm_add_ps(vec_1eminus10, _mm_mul_ps(vec_sd, vec_se)); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 740 (coherence_state->sx[i] * coherence_state->sd[i] + 1e-10f); | 729 (coherence_state->sx[i] * coherence_state->sd[i] + 1e-10f); |
| 741 } | 730 } |
| 742 } | 731 } |
| 743 } | 732 } |
| 744 | 733 |
| 745 void WebRtcAec_InitAec_SSE2(void) { | 734 void WebRtcAec_InitAec_SSE2(void) { |
| 746 WebRtcAec_FilterFar = FilterFarSSE2; | 735 WebRtcAec_FilterFar = FilterFarSSE2; |
| 747 WebRtcAec_ScaleErrorSignal = ScaleErrorSignalSSE2; | 736 WebRtcAec_ScaleErrorSignal = ScaleErrorSignalSSE2; |
| 748 WebRtcAec_FilterAdaptation = FilterAdaptationSSE2; | 737 WebRtcAec_FilterAdaptation = FilterAdaptationSSE2; |
| 749 WebRtcAec_OverdriveAndSuppress = OverdriveAndSuppressSSE2; | 738 WebRtcAec_OverdriveAndSuppress = OverdriveAndSuppressSSE2; |
| 750 WebRtcAec_SubbandCoherence = SubbandCoherenceSSE2; | 739 WebRtcAec_ComputeCoherence = ComputeCoherenceSSE2; |
| 740 WebRtcAec_UpdateCoherenceSpectra = UpdateCoherenceSpectraSSE2; |
| 751 WebRtcAec_StoreAsComplex = StoreAsComplexSSE2; | 741 WebRtcAec_StoreAsComplex = StoreAsComplexSSE2; |
| 752 WebRtcAec_PartitionDelay = PartitionDelaySSE2; | 742 WebRtcAec_PartitionDelay = PartitionDelaySSE2; |
| 753 WebRtcAec_WindowData = WindowDataSSE2; | 743 WebRtcAec_WindowData = WindowDataSSE2; |
| 754 } | 744 } |
| 755 } // namespace webrtc | 745 } // namespace webrtc |
| OLD | NEW |