Example #1
0
void aec_rdft_init(void) {
  rftfsub_128 = rftfsub_128_C;
  rftbsub_128 = rftbsub_128_C;
  if (WebRtc_GetCPUInfo(kSSE2)) {
#if defined(__SSE2__)
    aec_rdft_init_sse2();
#endif
  }
  // init library constants.
  makewt_32();
  makect_32();
}
Example #2
0
void aec_rdft_init(void) {
  cft1st_128 = cft1st_128_C;
  cftmdl_128 = cftmdl_128_C;
  rftfsub_128 = rftfsub_128_C;
  rftbsub_128 = rftbsub_128_C;
#if defined(WEBRTC_ARCH_X86_FAMILY)
  if (WebRtc_GetCPUInfo(kSSE2)) {
    aec_rdft_init_sse2();
  }
#endif
  // init library constants.
  makewt_32();
  makect_32();
}
Example #3
0
void aec_rdft_init(void) {
  cft1st_128 = cft1st_128_C;
  cftmdl_128 = cftmdl_128_C;
  rftfsub_128 = rftfsub_128_C;
  rftbsub_128 = rftbsub_128_C;
  if (WebRtc_GetCPUInfo(kSSE2)) {
#if defined(WEBRTC_USE_SSE2)
    aec_rdft_init_sse2();
#endif
  }
  // init library constants.
  makewt_32();
  makect_32();
}
Example #4
0
void aec_rdft_init(void) {
  cft1st_128 = cft1st_128_C;
  cftmdl_128 = cftmdl_128_C;
  rftfsub_128 = rftfsub_128_C;
  rftbsub_128 = rftbsub_128_C;
  cftfsub_128 = cftfsub_128_C;
  cftbsub_128 = cftbsub_128_C;
  bitrv2_128 = bitrv2_128_C;
#if defined(WEBRTC_ARCH_X86_FAMILY)
  if (WebRtc_GetCPUInfo(kSSE2)) {
    aec_rdft_init_sse2();
  }
#endif
#if defined(MIPS_FPU_LE)
  aec_rdft_init_mips();
#endif
#if defined(WEBRTC_DETECT_ARM_NEON) || defined(WEBRTC_ARCH_ARM_NEON)
  aec_rdft_init_neon();
#endif
}
Example #5
0
int WebRtcAec_InitAec(aec_t *aec, int sampFreq)
{
    int i;

    aec->sampFreq = sampFreq;

    if (sampFreq == 8000) {
        aec->mu = 0.6f;
        aec->errThresh = 2e-6f;
    }
    else {
        aec->mu = 0.5f;
        aec->errThresh = 1.5e-6f;
    }

    if (WebRtcApm_InitBuffer(aec->farFrBuf) == -1) {
        return -1;
    }

    if (WebRtcApm_InitBuffer(aec->nearFrBuf) == -1) {
        return -1;
    }

    if (WebRtcApm_InitBuffer(aec->outFrBuf) == -1) {
        return -1;
    }

    if (WebRtcApm_InitBuffer(aec->nearFrBufH) == -1) {
        return -1;
    }

    if (WebRtcApm_InitBuffer(aec->outFrBufH) == -1) {
        return -1;
    }

    // Default target suppression level
    aec->targetSupp = -11.5;
    aec->minOverDrive = 2.0;

    // Sampling frequency multiplier
    // SWB is processed as 160 frame size
    if (aec->sampFreq == 32000) {
      aec->mult = (short)aec->sampFreq / 16000;
    }
    else {
        aec->mult = (short)aec->sampFreq / 8000;
    }

    aec->farBufWritePos = 0;
    aec->farBufReadPos = 0;

    aec->inSamples = 0;
    aec->outSamples = 0;
    aec->knownDelay = 0;

    // Initialize buffers
    memset(aec->farBuf, 0, sizeof(aec->farBuf));
    memset(aec->xBuf, 0, sizeof(aec->xBuf));
    memset(aec->dBuf, 0, sizeof(aec->dBuf));
    memset(aec->eBuf, 0, sizeof(aec->eBuf));
    // For H band
    memset(aec->dBufH, 0, sizeof(aec->dBufH));

    memset(aec->xPow, 0, sizeof(aec->xPow));
    memset(aec->dPow, 0, sizeof(aec->dPow));
    memset(aec->dInitMinPow, 0, sizeof(aec->dInitMinPow));
    aec->noisePow = aec->dInitMinPow;
    aec->noiseEstCtr = 0;

    // Initial comfort noise power
    for (i = 0; i < PART_LEN1; i++) {
        aec->dMinPow[i] = 1.0e6f;
    }

    // Holds the last block written to
    aec->xfBufBlockPos = 0;
    // TODO: Investigate need for these initializations. Deleting them doesn't
    //       change the output at all and yields 0.4% overall speedup.
    memset(aec->xfBuf, 0, sizeof(complex_t) * NR_PART * PART_LEN1);
    memset(aec->wfBuf, 0, sizeof(complex_t) * NR_PART * PART_LEN1);
    memset(aec->sde, 0, sizeof(complex_t) * PART_LEN1);
    memset(aec->sxd, 0, sizeof(complex_t) * PART_LEN1);
    memset(aec->xfwBuf, 0, sizeof(complex_t) * NR_PART * PART_LEN1);
    memset(aec->se, 0, sizeof(float) * PART_LEN1);

    // To prevent numerical instability in the first block.
    for (i = 0; i < PART_LEN1; i++) {
        aec->sd[i] = 1;
    }
    for (i = 0; i < PART_LEN1; i++) {
        aec->sx[i] = 1;
    }

    memset(aec->hNs, 0, sizeof(aec->hNs));
    memset(aec->outBuf, 0, sizeof(float) * PART_LEN);

    aec->hNlFbMin = 1;
    aec->hNlFbLocalMin = 1;
    aec->hNlXdAvgMin = 1;
    aec->hNlNewMin = 0;
    aec->hNlMinCtr = 0;
    aec->overDrive = 2;
    aec->overDriveSm = 2;
    aec->delayIdx = 0;
    aec->stNearState = 0;
    aec->echoState = 0;
    aec->divergeState = 0;

    aec->seed = 777;
    aec->delayEstCtr = 0;

    // Features on by default (G.167)
#ifdef G167
    aec->adaptToggle = 1;
    aec->nlpToggle = 1;
    aec->cnToggle = 1;
#endif

    // Metrics disabled by default
    aec->metricsMode = 0;
    WebRtcAec_InitMetrics(aec);

    // Assembly optimization
    WebRtcAec_FilterFar = FilterFar;
    WebRtcAec_ScaleErrorSignal = ScaleErrorSignal;
    WebRtcAec_FilterAdaptation = FilterAdaptation;
    WebRtcAec_OverdriveAndSuppress = OverdriveAndSuppress;
    if (WebRtc_GetCPUInfo(kSSE2)) {
#if defined(__SSE2__)
      WebRtcAec_InitAec_SSE2();
#endif
    }
    aec_rdft_init();

    return 0;
}