Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0f8a1cdd authored by Ricardo Garcia's avatar Ricardo Garcia
Browse files

Splitting analysis window in frequency implementation. Other fixes.

Split the analysis/resynthesis window into using sqrt() of Hanning.
Removed unnecessary zero padding of initial circular buffer input.

Bug: 133453863
Test: manual and listening tests
Change-Id: I05a7204d055a8de93bb9183c32709d3464877065
parent 5592ee26
Loading
Loading
Loading
Loading
+10 −5
Original line number Diff line number Diff line
@@ -62,11 +62,6 @@ void ChannelBuffer::initBuffers(unsigned int blockSize, unsigned int overlapSize
    cBInput.resize(mBlockSize * CIRCULAR_BUFFER_UPSAMPLE);
    cBOutput.resize(mBlockSize * CIRCULAR_BUFFER_UPSAMPLE);

    //fill input with half block size...
    for (unsigned int k = 0; k < mBlockSize/2; k++) {
        cBInput.write(0);
    }

    //temp vectors
    input.resize(mBlockSize);
    output.resize(mBlockSize);
@@ -170,6 +165,11 @@ void DPFrequency::configure(size_t blockSize, size_t overlapSize,

    fill_window(mVWindow, RDSP_WINDOW_HANNING_FLAT_TOP, mBlockSize, mOverlapSize);

    //split window into analysis and synthesis. Both are the sqrt() of original
    //window
    Eigen::Map<Eigen::VectorXf> eWindow(&mVWindow[0], mVWindow.size());
    eWindow = eWindow.array().sqrt();

    //compute window rms for energy compensation
    mWindowRms = 0;
    for (size_t i = 0; i < mVWindow.size(); i++) {
@@ -666,6 +666,11 @@ size_t DPFrequency::processLastStages(ChannelBuffer &cb) {
    //##ifft directly to output.
    Eigen::Map<Eigen::VectorXf> eOutput(&cb.output[0], cb.output.size());
    mFftServer.inv(eOutput, cb.complexTemp);

    //apply rest of window for resynthesis
    Eigen::Map<Eigen::VectorXf> eWindow(&mVWindow[0], mVWindow.size());
    eOutput = eOutput.cwiseProduct(eWindow);

    return mBlockSize;
}