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.
This commit is contained in:
Max Kellermann 2009-03-02 16:37:00 +01:00
parent 1b31f52285
commit d9c1434298
3 changed files with 31 additions and 4 deletions

View File

@ -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

View File

@ -70,7 +70,7 @@ pcm_resample_16(struct pcm_resample_state *state,
}
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, G_GNUC_UNUSED size_t src_size,

View File

@ -186,7 +186,7 @@ src_float_to_int_array (const float *in, int *out, int len)
#endif
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,