OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 | 497 |
498 // Updates the following smoothed Power Spectral Densities (PSD): | 498 // Updates the following smoothed Power Spectral Densities (PSD): |
499 // - sd : near-end | 499 // - sd : near-end |
500 // - se : residual echo | 500 // - se : residual echo |
501 // - sx : far-end | 501 // - sx : far-end |
502 // - sde : cross-PSD of near-end and residual echo | 502 // - sde : cross-PSD of near-end and residual echo |
503 // - sxd : cross-PSD of near-end and far-end | 503 // - sxd : cross-PSD of near-end and far-end |
504 // | 504 // |
505 // In addition to updating the PSDs, also the filter diverge state is determined | 505 // In addition to updating the PSDs, also the filter diverge state is determined |
506 // upon actions are taken. | 506 // upon actions are taken. |
507 static void SmoothedPSD(int mult, | 507 static void UpdateCoherenceSpectraNEON(int mult, |
508 bool extended_filter_enabled, | 508 bool extended_filter_enabled, |
509 float efw[2][PART_LEN1], | 509 float efw[2][PART_LEN1], |
510 float dfw[2][PART_LEN1], | 510 float dfw[2][PART_LEN1], |
511 float xfw[2][PART_LEN1], | 511 float xfw[2][PART_LEN1], |
512 CoherenceState* coherence_state, | 512 CoherenceState* coherence_state, |
513 short* filter_divergence_state, | 513 short* filter_divergence_state, |
514 int* extreme_filter_divergence) { | 514 int* extreme_filter_divergence) { |
515 // Power estimate smoothing coefficients. | 515 // Power estimate smoothing coefficients. |
516 const float* ptrGCoh = | 516 const float* ptrGCoh = |
517 extended_filter_enabled | 517 extended_filter_enabled |
518 ? WebRtcAec_kExtendedSmoothingCoefficients[mult - 1] | 518 ? WebRtcAec_kExtendedSmoothingCoefficients[mult - 1] |
519 : WebRtcAec_kNormalSmoothingCoefficients[mult - 1]; | 519 : WebRtcAec_kNormalSmoothingCoefficients[mult - 1]; |
520 int i; | 520 int i; |
521 float sdSum = 0, seSum = 0; | 521 float sdSum = 0, seSum = 0; |
522 const float32x4_t vec_15 = vdupq_n_f32(WebRtcAec_kMinFarendPSD); | 522 const float32x4_t vec_15 = vdupq_n_f32(WebRtcAec_kMinFarendPSD); |
523 float32x4_t vec_sdSum = vdupq_n_f32(0.0f); | 523 float32x4_t vec_sdSum = vdupq_n_f32(0.0f); |
524 float32x4_t vec_seSum = vdupq_n_f32(0.0f); | 524 float32x4_t vec_seSum = vdupq_n_f32(0.0f); |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
672 vst1q_f32(&data_complex[0][i], vec_data.val[0]); | 672 vst1q_f32(&data_complex[0][i], vec_data.val[0]); |
673 vst1q_f32(&data_complex[1][i], vec_data.val[1]); | 673 vst1q_f32(&data_complex[1][i], vec_data.val[1]); |
674 } | 674 } |
675 // fix beginning/end values | 675 // fix beginning/end values |
676 data_complex[1][0] = 0; | 676 data_complex[1][0] = 0; |
677 data_complex[1][PART_LEN] = 0; | 677 data_complex[1][PART_LEN] = 0; |
678 data_complex[0][0] = data[0]; | 678 data_complex[0][0] = data[0]; |
679 data_complex[0][PART_LEN] = data[1]; | 679 data_complex[0][PART_LEN] = data[1]; |
680 } | 680 } |
681 | 681 |
682 static void SubbandCoherenceNEON(int mult, | 682 static void ComputeCoherenceNEON(const CoherenceState* coherence_state, |
683 bool extended_filter_enabled, | |
684 float efw[2][PART_LEN1], | |
685 float dfw[2][PART_LEN1], | |
686 float xfw[2][PART_LEN1], | |
687 float* fft, | |
688 float* cohde, | 683 float* cohde, |
689 float* cohxd, | 684 float* cohxd) { |
690 CoherenceState* coherence_state, | |
691 short* filter_divergence_state, | |
692 int* extreme_filter_divergence) { | |
693 int i; | 685 int i; |
694 | 686 |
695 SmoothedPSD(mult, extended_filter_enabled, efw, dfw, xfw, coherence_state, | |
696 filter_divergence_state, extreme_filter_divergence); | |
697 | |
698 { | 687 { |
699 const float32x4_t vec_1eminus10 = vdupq_n_f32(1e-10f); | 688 const float32x4_t vec_1eminus10 = vdupq_n_f32(1e-10f); |
700 | 689 |
701 // Subband coherence | 690 // Subband coherence |
702 for (i = 0; i + 3 < PART_LEN1; i += 4) { | 691 for (i = 0; i + 3 < PART_LEN1; i += 4) { |
703 const float32x4_t vec_sd = vld1q_f32(&coherence_state->sd[i]); | 692 const float32x4_t vec_sd = vld1q_f32(&coherence_state->sd[i]); |
704 const float32x4_t vec_se = vld1q_f32(&coherence_state->se[i]); | 693 const float32x4_t vec_se = vld1q_f32(&coherence_state->se[i]); |
705 const float32x4_t vec_sx = vld1q_f32(&coherence_state->sx[i]); | 694 const float32x4_t vec_sx = vld1q_f32(&coherence_state->sx[i]); |
706 const float32x4_t vec_sdse = vmlaq_f32(vec_1eminus10, vec_sd, vec_se); | 695 const float32x4_t vec_sdse = vmlaq_f32(vec_1eminus10, vec_sd, vec_se); |
707 const float32x4_t vec_sdsx = vmlaq_f32(vec_1eminus10, vec_sd, vec_sx); | 696 const float32x4_t vec_sdsx = vmlaq_f32(vec_1eminus10, vec_sd, vec_sx); |
(...skipping 19 matching lines...) Expand all Loading... |
727 coherence_state->sxd[i][1] * coherence_state->sxd[i][1]) / | 716 coherence_state->sxd[i][1] * coherence_state->sxd[i][1]) / |
728 (coherence_state->sx[i] * coherence_state->sd[i] + 1e-10f); | 717 (coherence_state->sx[i] * coherence_state->sd[i] + 1e-10f); |
729 } | 718 } |
730 } | 719 } |
731 | 720 |
732 void WebRtcAec_InitAec_neon(void) { | 721 void WebRtcAec_InitAec_neon(void) { |
733 WebRtcAec_FilterFar = FilterFarNEON; | 722 WebRtcAec_FilterFar = FilterFarNEON; |
734 WebRtcAec_ScaleErrorSignal = ScaleErrorSignalNEON; | 723 WebRtcAec_ScaleErrorSignal = ScaleErrorSignalNEON; |
735 WebRtcAec_FilterAdaptation = FilterAdaptationNEON; | 724 WebRtcAec_FilterAdaptation = FilterAdaptationNEON; |
736 WebRtcAec_OverdriveAndSuppress = OverdriveAndSuppressNEON; | 725 WebRtcAec_OverdriveAndSuppress = OverdriveAndSuppressNEON; |
737 WebRtcAec_SubbandCoherence = SubbandCoherenceNEON; | 726 WebRtcAec_ComputeCoherence = ComputeCoherenceNEON; |
| 727 WebRtcAec_UpdateCoherenceSpectra = UpdateCoherenceSpectraNEON; |
738 WebRtcAec_StoreAsComplex = StoreAsComplexNEON; | 728 WebRtcAec_StoreAsComplex = StoreAsComplexNEON; |
739 WebRtcAec_PartitionDelay = PartitionDelayNEON; | 729 WebRtcAec_PartitionDelay = PartitionDelayNEON; |
740 WebRtcAec_WindowData = WindowDataNEON; | 730 WebRtcAec_WindowData = WindowDataNEON; |
741 } | 731 } |
742 } // namespace webrtc | 732 } // namespace webrtc |
OLD | NEW |