Small simplification
This commit is contained in:
@@ -746,11 +746,12 @@ R3StretcherImpl::analyseChannel(int c, int inhop, int prevInhop, int prevOuthop)
|
|||||||
ToPolarSpec spec;
|
ToPolarSpec spec;
|
||||||
|
|
||||||
// For the classify scale we always want the full
|
// For the classify scale we always want the full
|
||||||
// range, as all the magnitudes (though not phases)
|
// range, as all the magnitudes (though not
|
||||||
// are potentially relevant to classification and
|
// necessarily all phases) are potentially relevant to
|
||||||
// formant analysis. But this case here only happens
|
// classification and formant analysis. But this case
|
||||||
// if we don't haveValidReadahead - the normal case is
|
// here only happens if we don't haveValidReadahead -
|
||||||
// above and just copies from the previous readahead.
|
// the normal case is above and just copies from the
|
||||||
|
// previous readahead.
|
||||||
if (fftSize == classify) {
|
if (fftSize == classify) {
|
||||||
spec.magFromBin = 0;
|
spec.magFromBin = 0;
|
||||||
spec.magBinCount = classify/2 + 1;
|
spec.magBinCount = classify/2 + 1;
|
||||||
@@ -955,23 +956,17 @@ R3StretcherImpl::synthesiseChannel(int c, int outhop)
|
|||||||
int longest = m_guideConfiguration.longestFftSize;
|
int longest = m_guideConfiguration.longestFftSize;
|
||||||
|
|
||||||
auto &cd = m_channelData.at(c);
|
auto &cd = m_channelData.at(c);
|
||||||
|
|
||||||
for (auto &it : cd->scales) {
|
|
||||||
|
|
||||||
auto &scale = it.second;
|
|
||||||
int bufSize = scale->bufSize;
|
|
||||||
|
|
||||||
// copy to prevMag before filtering
|
|
||||||
v_copy(scale->prevMag.data(),
|
|
||||||
scale->mag.data(),
|
|
||||||
bufSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const auto &band : cd->guidance.fftBands) {
|
for (const auto &band : cd->guidance.fftBands) {
|
||||||
int fftSize = band.fftSize;
|
int fftSize = band.fftSize;
|
||||||
auto &scale = cd->scales.at(fftSize);
|
auto &scale = cd->scales.at(fftSize);
|
||||||
auto &scaleData = m_scaleData.at(fftSize);
|
auto &scaleData = m_scaleData.at(fftSize);
|
||||||
|
|
||||||
|
// copy to prevMag before filtering
|
||||||
|
v_copy(scale->prevMag.data(),
|
||||||
|
scale->mag.data(),
|
||||||
|
scale->bufSize);
|
||||||
|
|
||||||
double winscale = double(outhop) / scaleData->windowScaleFactor;
|
double winscale = double(outhop) / scaleData->windowScaleFactor;
|
||||||
|
|
||||||
// The frequency filter is applied naively in the frequency
|
// The frequency filter is applied naively in the frequency
|
||||||
@@ -997,9 +992,9 @@ R3StretcherImpl::synthesiseChannel(int c, int outhop)
|
|||||||
scale->advancedPhase.data() + lowBin,
|
scale->advancedPhase.data() + lowBin,
|
||||||
highBin - lowBin);
|
highBin - lowBin);
|
||||||
|
|
||||||
if (highBin < fftSize/2 + 1) {
|
if (highBin < scale->bufSize) {
|
||||||
v_zero(scale->real.data() + highBin, fftSize/2 + 1 - highBin);
|
v_zero(scale->real.data() + highBin, scale->bufSize - highBin);
|
||||||
v_zero(scale->imag.data() + highBin, fftSize/2 + 1 - highBin);
|
v_zero(scale->imag.data() + highBin, scale->bufSize - highBin);
|
||||||
}
|
}
|
||||||
|
|
||||||
scaleData->fft.inverse(scale->real.data(),
|
scaleData->fft.inverse(scale->real.data(),
|
||||||
|
|||||||
Reference in New Issue
Block a user