aboutsummaryrefslogtreecommitdiffstats
path: root/src/pcm_resample.h
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-03-02 16:37:00 +0100
committerMax Kellermann <max@duempel.org>2009-03-02 16:37:00 +0100
commitd9c143429822e00da3aa8139f7cbd02807d7a645 (patch)
tree0a1e385b253df582b8334b4ff75da0f653643286 /src/pcm_resample.h
parent1b31f5228582980a5435f1cfac942d1292c089a2 (diff)
downloadmpd-d9c143429822e00da3aa8139f7cbd02807d7a645.tar.gz
mpd-d9c143429822e00da3aa8139f7cbd02807d7a645.tar.xz
mpd-d9c143429822e00da3aa8139f7cbd02807d7a645.zip
pcm_resample: use 24 bit resampling code for 32 bit samples
Resampling 32 bit samples is the same as resampling 24 bit samples - both are stored in the int32_t type.
Diffstat (limited to '')
-rw-r--r--src/pcm_resample.h31
1 files changed, 29 insertions, 2 deletions
diff --git a/src/pcm_resample.h b/src/pcm_resample.h
index 5042f4c99..05950338f 100644
--- a/src/pcm_resample.h
+++ b/src/pcm_resample.h
@@ -86,7 +86,7 @@ pcm_resample_16(struct pcm_resample_state *state,
size_t *dest_size_r);
/**
- * Resamples 24 bit PCM data.
+ * Resamples 32 bit PCM data.
*
* @param state an initialized pcm_resample_state object
* @param channels the number of channels
@@ -98,11 +98,38 @@ pcm_resample_16(struct pcm_resample_state *state,
* @return the destination buffer
*/
const int32_t *
-pcm_resample_24(struct pcm_resample_state *state,
+pcm_resample_32(struct pcm_resample_state *state,
uint8_t channels,
unsigned src_rate,
const int32_t *src_buffer, size_t src_size,
unsigned dest_rate,
size_t *dest_size_r);
+/**
+ * Resamples 24 bit PCM data.
+ *
+ * @param state an initialized pcm_resample_state object
+ * @param channels the number of channels
+ * @param src_rate the source sample rate
+ * @param src the source PCM buffer
+ * @param src_size the size of #src in bytes
+ * @param dest_rate the requested destination sample rate
+ * @param dest_size_r returns the number of bytes of the destination buffer
+ * @return the destination buffer
+ */
+static inline const int32_t *
+pcm_resample_24(struct pcm_resample_state *state,
+ uint8_t channels,
+ unsigned src_rate,
+ const int32_t *src_buffer, size_t src_size,
+ unsigned dest_rate,
+ size_t *dest_size_r)
+{
+ /* reuse the 32 bit code - the resampler code doesn't care if
+ the upper 8 bits are actually used */
+ return pcm_resample_32(state, channels,
+ src_rate, src_buffer, src_size,
+ dest_rate, dest_size_r);
+}
+
#endif