Home | History | Annotate | Download | only in aec

Lines Matching refs:aec

12  * The core AEC algorithm, neon version of speed-critical functions.
22 #include "webrtc/modules/audio_processing/aec/aec_common.h"
23 #include "webrtc/modules/audio_processing/aec/aec_core_internal.h"
24 #include "webrtc/modules/audio_processing/aec/aec_rdft.h"
37 static void FilterFarNEON(AecCore* aec, float yf[2][PART_LEN1]) {
39 const int num_partitions = aec->num_partitions;
42 int xPos = (i + aec->xfBufBlockPos) * PART_LEN1;
45 if (i + aec->xfBufBlockPos >= num_partitions) {
51 const float32x4_t xfBuf_re = vld1q_f32(&aec->xfBuf[0][xPos + j]);
52 const float32x4_t xfBuf_im = vld1q_f32(&aec->xfBuf[1][xPos + j]);
53 const float32x4_t wfBuf_re = vld1q_f32(&aec->wfBuf[0][pos + j]);
54 const float32x4_t wfBuf_im = vld1q_f32(&aec->wfBuf[1][pos + j]);
68 yf[0][j] += MulRe(aec->xfBuf[0][xPos + j],
69 aec->xfBuf[1][xPos + j],
70 aec->wfBuf[0][pos + j],
71 aec->wfBuf[1][pos + j]);
72 yf[1][j] += MulIm(aec->xfBuf[0][xPos + j],
73 aec->xfBuf[1][xPos + j],
74 aec->wfBuf[0][pos + j],
75 aec->wfBuf[1][pos + j]);
122 static void ScaleErrorSignalNEON(AecCore* aec, float ef[2][PART_LEN1]) {
123 const float mu = aec->extended_filter_enabled ? kExtendedMu : aec->normal_mu;
124 const float error_threshold = aec->extended_filter_enabled ?
125 kExtendedErrorThreshold : aec->normal_error_threshold;
132 const float32x4_t xPow = vld1q_f32(&aec->xPow[i]);
162 ef[0][i] /= (aec->xPow[i] + 1e-10f);
163 ef[1][i] /= (aec->xPow[i] + 1e-10f);
178 static void FilterAdaptationNEON(AecCore* aec,
182 const int num_partitions = aec->num_partitions;
184 int xPos = (i + aec->xfBufBlockPos) * PART_LEN1;
188 if (i + aec->xfBufBlockPos >= num_partitions) {
195 const float32x4_t xfBuf_re = vld1q_f32(&aec->xfBuf[0][xPos + j]);
196 const float32x4_t xfBuf_im = vld1q_f32(&aec->xfBuf[1][xPos + j]);
213 fft[1] = MulRe(aec->xfBuf[0][xPos + PART_LEN],
214 -aec->xfBuf[1][xPos + PART_LEN],
234 const float wt1 = aec->wfBuf[1][pos];
235 aec->wfBuf[0][pos + PART_LEN] += fft[1];
237 float32x4_t wtBuf_re = vld1q_f32(&aec->wfBuf[0][pos + j]);
238 float32x4_t wtBuf_im = vld1q_f32(&aec->wfBuf[1][pos + j]);
245 vst1q_f32(&aec->wfBuf[0][pos + j], wtBuf_re);
246 vst1q_f32(&aec->wfBuf[1][pos + j], wtBuf_im);
248 aec->wfBuf[1][pos] = wt1;
368 static void OverdriveAndSuppressNEON(AecCore* aec,
376 const float32x4_t vec_overDriveSm = vmovq_n_f32(aec->overDriveSm);
430 hNl[i] = powf(hNl[i], aec->overDriveSm * WebRtcAec_overDriveCurve[i]);
442 static int PartitionDelay(const AecCore* aec) {
451 for (i = 0; i < aec->num_partitions; i++) {
458 const float32x4_t vec_wfBuf0 = vld1q_f32(&aec->wfBuf[0][pos + j]);
459 const float32x4_t vec_wfBuf1 = vld1q_f32(&aec->wfBuf[1][pos + j]);
475 wfEn += aec->wfBuf[0][pos + j] * aec->wfBuf[0][pos + j] +
476 aec->wfBuf[1][pos + j] * aec->wfBuf[1][pos + j];
496 static void SmoothedPSD(AecCore* aec,
501 const float* ptrGCoh = aec->extended_filter_enabled
502 ? WebRtcAec_kExtendedSmoothingCoefficients[aec->mult - 1]
503 : WebRtcAec_kNormalSmoothingCoefficients[aec->mult - 1];
517 float32x4_t vec_sd = vmulq_n_f32(vld1q_f32(&aec->sd[i]), ptrGCoh[0]);
518 float32x4_t vec_se = vmulq_n_f32(vld1q_f32(&aec->se[i]), ptrGCoh[0]);
519 float32x4_t vec_sx = vmulq_n_f32(vld1q_f32(&aec->sx[i]), ptrGCoh[0]);
532 vst1q_f32(&aec->sd[i], vec_sd);
533 vst1q_f32(&aec->se[i], vec_se);
534 vst1q_f32(&aec->sx[i], vec_sx);
537 float32x4x2_t vec_sde = vld2q_f32(&aec->sde[i][0]);
546 vst2q_f32(&aec->sde[i][0], vec_sde);
550 float32x4x2_t vec_sxd = vld2q_f32(&aec->sxd[i][0]);
559 vst2q_f32(&aec->sxd[i][0], vec_sxd);
583 aec->sd[i] = ptrGCoh[0] * aec->sd[i] +
585 aec->se[i] = ptrGCoh[0] * aec->se[i] +
591 aec->sx[i] =
592 ptrGCoh[0] * aec->sx[i] +
597 aec->sde[i][0] =
598 ptrGCoh[0] * aec->sde[i][0] +
600 aec->sde[i][1] =
601 ptrGCoh[0] * aec->sde[i][1] +
604 aec->sxd[i][0] =
605 ptrGCoh[0] * aec->sxd[i][0] +
607 aec->sxd[i][1] =
608 ptrGCoh[0] * aec->sxd[i][1] +
611 sdSum += aec->sd[i];
612 seSum += aec->se[i];
616 aec->divergeState = (aec->divergeState ? 1.05f : 1.0f) * seSum > sdSum;
618 if (aec->divergeState)
622 if (!aec->extended_filter_enabled && seSum > (19.95f * sdSum))
623 memset(aec->wfBuf, 0, sizeof(aec->wfBuf));
663 static void SubbandCoherenceNEON(AecCore* aec,
672 if (aec->delayEstCtr == 0)
673 aec->delayIdx = PartitionDelay(aec);
677 aec->xfwBuf + aec->delayIdx * PART_LEN1,
681 WindowData(fft, aec->dBuf);
686 WindowData(fft, aec->eBuf);
690 SmoothedPSD(aec, efw, dfw, xfw);
697 const float32x4_t vec_sd = vld1q_f32(&aec->sd[i]);
698 const float32x4_t vec_se = vld1q_f32(&aec->se[i]);
699 const float32x4_t vec_sx = vld1q_f32(&aec->sx[i]);
702 float32x4x2_t vec_sde = vld2q_f32(&aec->sde[i][0]);
703 float32x4x2_t vec_sxd = vld2q_f32(&aec->sxd[i][0]);
718 (aec->sde[i][0] * aec->sde[i][0] + aec->sde[i][1] * aec->sde[i][1]) /
719 (aec->sd[i] * aec->se[i] + 1e-10f);
721 (aec->sxd[i][0] * aec->sxd[i][0] + aec->sxd[i][1] * aec->sxd[i][1]) /
722 (aec->sx[i] * aec->sd[i] + 1e-10f);