| 801 | } |
| 802 | |
| 803 | bool EffectEqualization48x::ProcessOne4x(int count, WaveTrack * t, |
| 804 | sampleCount start, sampleCount len) |
| 805 | { |
| 806 | int subBufferSize=mBufferCount==8?(mSubBufferSize>>1):mSubBufferSize; // half the buffers if avx is active |
| 807 | |
| 808 | if(len<subBufferSize) // it's not worth 4x processing do a regular process |
| 809 | return ProcessOne1x(count, t, start, len); |
| 810 | |
| 811 | auto trackBlockSize = t->GetMaxBlockSize(); |
| 812 | |
| 813 | auto output = t->EmptyCopy(); |
| 814 | t->ConvertToSampleFormat( floatSample ); |
| 815 | |
| 816 | mEffectEqualization->TrackProgress(count, 0.0); |
| 817 | auto bigRuns = len/(subBufferSize-mBlockSize); |
| 818 | int trackBlocksPerBig=subBufferSize/trackBlockSize; |
| 819 | int trackLeftovers=subBufferSize-trackBlocksPerBig*trackBlockSize; |
| 820 | size_t singleProcessLength = |
| 821 | ((mFilterSize>>1)*bigRuns + len%(bigRuns*(subBufferSize-mBlockSize))) |
| 822 | .as_size_t(); |
| 823 | auto currentSample=start; |
| 824 | |
| 825 | bool bBreakLoop = false; |
| 826 | for(int bigRun=0;bigRun<bigRuns;bigRun++) |
| 827 | { |
| 828 | // fill the buffer |
| 829 | for(int i=0;i<trackBlocksPerBig;i++) { |
| 830 | t->Get((samplePtr)&mBigBuffer[i*trackBlockSize], floatSample, currentSample, trackBlockSize); |
| 831 | currentSample+=trackBlockSize; |
| 832 | } |
| 833 | if(trackLeftovers) { |
| 834 | t->Get((samplePtr)&mBigBuffer[trackBlocksPerBig*trackBlockSize], floatSample, currentSample, trackLeftovers); |
| 835 | currentSample+=trackLeftovers; |
| 836 | } |
| 837 | currentSample-=mBlockSize+(mFilterSize>>1); |
| 838 | |
| 839 | ProcessBuffer4x(mBufferInfo.get()); |
| 840 | bBreakLoop=mEffectEqualization->TrackProgress(count, (double)(bigRun)/bigRuns.as_double()); |
| 841 | if( bBreakLoop ) |
| 842 | break; |
| 843 | output->Append((samplePtr)&mBigBuffer[(bigRun?mBlockSize:0)+(mFilterSize>>1)], floatSample, subBufferSize-((bigRun?mBlockSize:0)+(mFilterSize>>1))); |
| 844 | } |
| 845 | if(singleProcessLength && !bBreakLoop) { |
| 846 | t->Get((samplePtr)mBigBuffer.get(), floatSample, currentSample, singleProcessLength+mBlockSize+(mFilterSize>>1)); |
| 847 | ProcessBuffer(mBigBuffer.get(), mBigBuffer.get(), singleProcessLength+mBlockSize+(mFilterSize>>1)); |
| 848 | output->Append((samplePtr)&mBigBuffer[bigRuns > 0 ? mBlockSize : 0], floatSample, singleProcessLength+mBlockSize+(mFilterSize>>1)); |
| 849 | // output->Append((samplePtr)&mBigBuffer[bigRuns?mBlockSize:0], floatSample, singleProcessLength); |
| 850 | } |
| 851 | output->Flush(); |
| 852 | if(!bBreakLoop) |
| 853 | ProcessTail(t, output.get(), start, len); |
| 854 | return bBreakLoop; |
| 855 | } |
| 856 | |
| 857 | #include <wx/thread.h> |
| 858 |
nothing calls this directly
no test coverage detected