MCPcopy Create free account
hub / github.com/audacity/audacity / Processor

Method Processor

libraries/lib-builtin-effects/NoiseReductionBase.cpp:757–789  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

755}
756
757bool NoiseReductionBase::Worker::Processor(SpectrumTransformer& trans)
758{
759 auto& transformer = static_cast<MyTransformer&>(trans);
760 auto& worker = transformer.mWorker;
761 // Compute power spectrum in the newest window
762 {
763 auto& record = transformer.NthWindow(0);
764 float* pSpectrum = &record.mSpectrums[0];
765 const double dc = record.mRealFFTs[0];
766 *pSpectrum++ = dc * dc;
767 float *pReal = &record.mRealFFTs[1], *pImag = &record.mImagFFTs[1];
768 for (size_t nn = worker.mSettings.SpectrumSize() - 2; nn--;)
769 {
770 const double re = *pReal++, im = *pImag++;
771 *pSpectrum++ = re * re + im * im;
772 }
773 const double nyquist = record.mImagFFTs[0];
774 *pSpectrum = nyquist * nyquist;
775 }
776
777 if (worker.mDoProfile)
778 worker.GatherStatistics(transformer);
779 else
780 worker.ReduceNoise(transformer);
781
782 // Update the Progress meter, let user cancel
783 return !worker.mEffect.TrackProgress(
784 worker.mProgressTrackCount,
785 std::min(
786 1.0, ((++worker.mProgressWindowCount).as_double() *
787 worker.mSettings.StepSize()) /
788 worker.mLen.as_double()));
789}
790
791void NoiseReductionBase::Worker::FinishTrackStatistics()
792{

Callers

nothing calls this directly

Calls 4

GatherStatisticsMethod · 0.80
ReduceNoiseMethod · 0.80
TrackProgressMethod · 0.80
minFunction · 0.50

Tested by

no test coverage detected