diff options
author | Daniil Cherednik <dan.cherednik@gmail.com> | 2016-03-07 22:21:23 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2016-03-07 22:28:04 +0300 |
commit | 925e9e45cd6640ffb71ed1ba31e9289ed06eebde (patch) | |
tree | e5e3ac6d140251218731dfc65525f7a62ba95896 /src/atracdenc.cpp | |
parent | f7dbae4af76e76cb53ab34a7e9a16d78b83c6841 (diff) | |
download | atracdenc-925e9e45cd6640ffb71ed1ba31e9289ed06eebde.tar.gz |
remove suboptimal multiply readf (writef) libsndfile calls during reading or writing wav file
Diffstat (limited to 'src/atracdenc.cpp')
-rw-r--r-- | src/atracdenc.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/atracdenc.cpp b/src/atracdenc.cpp index 092059c..1982ba6 100644 --- a/src/atracdenc.cpp +++ b/src/atracdenc.cpp @@ -140,7 +140,7 @@ void TAtrac1MDCT::IMdct(double Specs[512], const TBlockSize& mode, double* low, } TPCMEngine<double>::TProcessLambda TAtrac1Processor::GetDecodeLambda() { - return [this](vector<double>* data) { + return [this](double* data) { double sum[512]; const uint32_t srcChannels = Aea->GetChannelNum(); for (uint32_t channel = 0; channel < srcChannels; channel++) { @@ -162,7 +162,7 @@ TPCMEngine<double>::TProcessLambda TAtrac1Processor::GetDecodeLambda() { if (sum[i] < PcmValueMin) sum[i] = PcmValueMin; - data[i][channel] = sum[i]; + data[i * srcChannels + channel] = sum[i]; } } @@ -180,12 +180,12 @@ TPCMEngine<double>::TProcessLambda TAtrac1Processor::GetEncodeLambda() { bitAlloc.push_back(new TAtrac1SimpleBitAlloc(atrac1container, Settings.GetBfuIdxConst(), Settings.GetFastBfuNumSearch())); } - return [this, srcChannels, bitAlloc](vector<double>* data) { + return [this, srcChannels, bitAlloc](double* data) { for (uint32_t channel = 0; channel < srcChannels; channel++) { double src[NumSamples]; vector<double> specs(512); for (int i = 0; i < NumSamples; ++i) { - src[i] = data[i][channel]; + src[i] = data[i * srcChannels + channel]; } SplitFilterBank[channel].Split(&src[0], &PcmBufLow[channel][0], &PcmBufMid[channel][0], &PcmBufHi[channel][0]); |