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

Method GatherStatistics

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

Source from the content-addressed store, hash-verified

812}
813
814void NoiseReductionBase::Worker::GatherStatistics(MyTransformer& transformer)
815{
816 ++mStatistics.mTrackWindows;
817
818 {
819 // NEW statistics
820 auto pPower = transformer.NthWindow(0).mSpectrums.data();
821 auto pSum = mStatistics.mSums.data();
822 for (size_t jj = 0; jj < mSettings.SpectrumSize(); ++jj)
823 {
824 *pSum++ += *pPower++;
825 }
826 }
827
828#ifdef OLD_METHOD_AVAILABLE
829 // The noise threshold for each frequency is the maximum
830 // level achieved at that frequency for a minimum of
831 // mMinSignalBlocks blocks in a row - the max of a min.
832
833 auto finish = mHistoryLen;
834
835 {
836 // old statistics
837 auto pPower = NthWindow(0).mSpectrums.data();
838 auto pThreshold = mStatistics.mNoiseThreshold.data();
839 for (size_t jj = 0; jj < mSpectrumSize; ++jj)
840 {
841 float min = *pPower++;
842 for (unsigned ii = 1; ii < finish; ++ii)
843 min = std::min(min, NthWindow(ii).mSpectrums[jj]);
844 *pThreshold = std::max(*pThreshold, min);
845 ++pThreshold;
846 }
847 }
848#endif
849}
850
851// Return true iff the given band of the "center" window looks like noise.
852// Examine the band in a few neighboring windows to decide.

Callers 1

ProcessorMethod · 0.80

Calls 3

maxFunction · 0.85
minFunction · 0.50
dataMethod · 0.45

Tested by

no test coverage detected