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

Commit f72b112b authored by Ricardo Garcia's avatar Ricardo Garcia Committed by Android (Google) Code Review
Browse files

Merge "Splitting analysis window in frequency implementation. Other fixes." into qt-dev

parents b1292d82 0f8a1cdd
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;
}