diff options
author | Max Kellermann <max@musicpd.org> | 2020-01-14 22:47:30 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2020-01-14 22:51:20 +0100 |
commit | 3565f0c8ce7c50076da94b0839ec0ecd41709d76 (patch) | |
tree | c83807c298ea5f33807d44df53bfdfc3164b2b8b /src/pcm | |
parent | 9647b2cb0123f0e41163ac237b469926824951db (diff) |
pcm/Dsd2Pcm: move code to TranslateSample()
10% speedup. Strange, huh?
Diffstat (limited to 'src/pcm')
-rw-r--r-- | src/pcm/Dsd2Pcm.cxx | 10 | ||||
-rw-r--r-- | src/pcm/Dsd2Pcm.hxx | 1 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/pcm/Dsd2Pcm.cxx b/src/pcm/Dsd2Pcm.cxx index 8bf4cc1d4..69f0cc764 100644 --- a/src/pcm/Dsd2Pcm.cxx +++ b/src/pcm/Dsd2Pcm.cxx @@ -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; } diff --git a/src/pcm/Dsd2Pcm.hxx b/src/pcm/Dsd2Pcm.hxx index c274fdf97..3a35cc8d3 100644 --- a/src/pcm/Dsd2Pcm.hxx +++ b/src/pcm/Dsd2Pcm.hxx @@ -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 */ |