From 69476b4f2193546cb72c3def9679136a182adfe3 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 22 Jun 2015 14:45:59 +0200 Subject: pcm/Interleave: add optimization for 32 bit samples Move code from the "vorbis" decoder. --- src/pcm/Interleave.hxx | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/pcm/Interleave.hxx') diff --git a/src/pcm/Interleave.hxx b/src/pcm/Interleave.hxx index 76f1a6216..3cb117d80 100644 --- a/src/pcm/Interleave.hxx +++ b/src/pcm/Interleave.hxx @@ -24,6 +24,8 @@ #include "Compiler.h" #include "util/ConstBuffer.hxx" +#include + /** * Interleave planar PCM samples from #src to #dest. */ @@ -31,4 +33,22 @@ void PcmInterleave(void *gcc_restrict dest, ConstBuffer src, size_t n_frames, size_t sample_size); +/** + * A variant of PcmInterleave() that assumes 32 bit samples (4 bytes + * per sample). + */ +void +PcmInterleave32(int32_t *gcc_restrict dest, ConstBuffer src, + size_t n_frames); + +static inline void +PcmInterleaveFloat(float *gcc_restrict dest, ConstBuffer src, + size_t n_frames) +{ + PcmInterleave32((int32_t *)dest, + ConstBuffer((const int32_t *const*)src.data, + src.size), + n_frames); +} + #endif -- cgit v1.2.3