pcm/Dsd2Pcm: move code to TranslateSample()

10% speedup.  Strange, huh?
This commit is contained in:
Max Kellermann 2020-01-14 22:47:30 +01:00
parent 9647b2cb01
commit 3565f0c8ce
2 changed files with 9 additions and 2 deletions

View File

@ -183,6 +183,13 @@ Dsd2Pcm::CalcOutputSample(size_t ffp) const noexcept
return acc;
}
inline float
Dsd2Pcm::TranslateSample(size_t ffp, uint8_t src) noexcept
{
ApplySample(ffp, src);
return CalcOutputSample(ffp);
}
void
Dsd2Pcm::Translate(size_t samples,
const uint8_t *src, ptrdiff_t src_stride,
@ -194,8 +201,7 @@ Dsd2Pcm::Translate(size_t samples,
unsigned bite1 = *src & 0xFFu;
src += src_stride;
if (lsbf) bite1 = bit_reverse(bite1);
ApplySample(ffp, bite1);
*dst = CalcOutputSample(ffp);
*dst = TranslateSample(ffp, bite1);
dst += dst_stride;
ffp = (ffp + 1) & FIFOMASK;
}

View File

@ -78,6 +78,7 @@ public:
private:
void ApplySample(size_t ffp, uint8_t src) noexcept;
float CalcOutputSample(size_t ffp) const noexcept;
float TranslateSample(size_t ffp, uint8_t src) noexcept;
};
#endif /* include guard DSD2PCM_H_INCLUDED */