| 755 | } |
| 756 | |
| 757 | bool 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 | |
| 791 | void NoiseReductionBase::Worker::FinishTrackStatistics() |
| 792 | { |
nothing calls this directly
no test coverage detected