gst/speexresample/: Update speex resampler to latest SVN. We're now down to only the changes noted in README again.

Original commit message from CVS:
* gst/speexresample/README:
* gst/speexresample/arch.h:
* gst/speexresample/resample.c: (resampler_basic_direct_single),
(resampler_basic_direct_double),
(resampler_basic_interpolate_single),
(resampler_basic_interpolate_double),
(speex_resampler_process_native), (speex_resampler_process_float),
(speex_resampler_process_int),
(speex_resampler_process_interleaved_float),
(speex_resampler_process_interleaved_int),
(speex_resampler_get_input_latency),
(speex_resampler_get_output_latency):
* gst/speexresample/speex_resampler.h:
Update speex resampler to latest SVN. We're now down to only the
changes noted in README again.
* gst/speexresample/speex_resampler_wrapper.h:
* gst/speexresample/gstspeexresample.c:
(gst_speex_resample_push_drain), (gst_speex_resample_query):
Adjust to API changes.
This commit is contained in:
Sebastian Dröge 2007-11-26 08:43:25 +00:00
parent 67d4bcd555
commit d222cb6c14
7 changed files with 171 additions and 268 deletions

View file

@ -1,3 +1,26 @@
2007-11-26 Sebastian Dröge <slomo@circular-chaos.org>
* gst/speexresample/README:
* gst/speexresample/arch.h:
* gst/speexresample/resample.c: (resampler_basic_direct_single),
(resampler_basic_direct_double),
(resampler_basic_interpolate_single),
(resampler_basic_interpolate_double),
(speex_resampler_process_native), (speex_resampler_process_float),
(speex_resampler_process_int),
(speex_resampler_process_interleaved_float),
(speex_resampler_process_interleaved_int),
(speex_resampler_get_input_latency),
(speex_resampler_get_output_latency):
* gst/speexresample/speex_resampler.h:
Update speex resampler to latest SVN. We're now down to only the
changes noted in README again.
* gst/speexresample/speex_resampler_wrapper.h:
* gst/speexresample/gstspeexresample.c:
(gst_speex_resample_push_drain), (gst_speex_resample_query):
Adjust to API changes.
2007-11-25 Edward Hervey <bilboed@bilboed.com> 2007-11-25 Edward Hervey <bilboed@bilboed.com>
* gst/flv/gstflvparse.c: (gst_flv_parse_tag_audio), * gst/flv/gstflvparse.c: (gst_flv_parse_tag_audio),

View file

@ -3,7 +3,7 @@ arch.h
fixed_generic.h fixed_generic.h
speex_resampler.h speex_resampler.h
are taken from http://svn.xiph.org/trunk/speex/ revision 14208. are taken from http://svn.xiph.org/trunk/speex/ revision 14232.
The only changes are: The only changes are:
@ -46,9 +46,9 @@ The only changes are:
#else /* OUTSIDE_SPEEX */ #else /* OUTSIDE_SPEEX */
--- speex/libspeex/resample.c 2007-11-21 11:07:32.000000000 +0100 --- speex/libspeex/resample.c 2007-11-25 14:15:38.000000000 +0100
+++ speexresample/resample.c 2007-11-21 11:15:09.000000000 +0100 +++ speexresample/resample.c 2007-11-25 14:15:31.000000000 +0100
@@ -62,20 +62,22 @@ @@ -62,20 +62,23 @@
#ifdef OUTSIDE_SPEEX #ifdef OUTSIDE_SPEEX
#include <stdlib.h> #include <stdlib.h>
@ -69,6 +69,7 @@ The only changes are:
+ return g_realloc (ptr, size); + return g_realloc (ptr, size);
} }
-static void -static void
+
+static inline void +static inline void
speex_free (void *ptr) speex_free (void *ptr)
{ {
@ -77,4 +78,3 @@ The only changes are:
} }
#include "speex_resampler.h" #include "speex_resampler.h"

View file

@ -40,7 +40,7 @@
#define SPEEX_MINOR_VERSION 1 /**< Minor Speex version. */ #define SPEEX_MINOR_VERSION 1 /**< Minor Speex version. */
#define SPEEX_MICRO_VERSION 15 /**< Micro Speex version. */ #define SPEEX_MICRO_VERSION 15 /**< Micro Speex version. */
#define SPEEX_EXTRA_VERSION "" /**< Extra Speex version. */ #define SPEEX_EXTRA_VERSION "" /**< Extra Speex version. */
#define SPEEX_VERSION "speex-1.2beta3" /**< Speex version string. */ #define SPEEX_VERSION "speex-1.2beta4" /**< Speex version string. */
#endif #endif
/* A couple test to catch stupid option combinations */ /* A couple test to catch stupid option combinations */
@ -127,8 +127,6 @@ typedef spx_word32_t spx_sig_t;
#include "fixed_arm5e.h" #include "fixed_arm5e.h"
#elif defined (ARM4_ASM) #elif defined (ARM4_ASM)
#include "fixed_arm4.h" #include "fixed_arm4.h"
#elif defined (ARM5E_ASM)
#include "fixed_arm5e.h"
#elif defined (BFIN_ASM) #elif defined (BFIN_ASM)
#include "fixed_bfin.h" #include "fixed_bfin.h"
#endif #endif

View file

@ -524,7 +524,7 @@ gst_speex_resample_push_drain (GstSpeexResample * resample)
resample_float_resampler_get_ratio (resample->state, &num, &den); resample_float_resampler_get_ratio (resample->state, &num, &den);
out_len = resample_float_resampler_get_latency (resample->state); out_len = resample_float_resampler_get_input_latency (resample->state);
out_len = out_processed = (out_len * den + (num >> 1)) / num; out_len = out_processed = (out_len * den + (num >> 1)) / num;
outsize = 4 * out_len * resample->channels; outsize = 4 * out_len * resample->channels;
} else { } else {
@ -532,7 +532,7 @@ gst_speex_resample_push_drain (GstSpeexResample * resample)
resample_int_resampler_get_ratio (resample->state, &num, &den); resample_int_resampler_get_ratio (resample->state, &num, &den);
out_len = resample_int_resampler_get_latency (resample->state); out_len = resample_int_resampler_get_input_latency (resample->state);
out_len = out_processed = (out_len * den + (num >> 1)) / num; out_len = out_processed = (out_len * den + (num >> 1)) / num;
outsize = 2 * out_len * resample->channels; outsize = 2 * out_len * resample->channels;
} }
@ -545,12 +545,19 @@ gst_speex_resample_push_drain (GstSpeexResample * resample)
return; return;
} }
if (resample->fp) if (resample->fp) {
err = resample_float_resampler_drain_interleaved_float (resample->state, guint len = resample_float_resampler_get_input_latency (resample->state);
(gfloat *) GST_BUFFER_DATA (buf), &out_processed);
else err =
err = resample_int_resampler_drain_interleaved_int (resample->state, resample_float_resampler_process_interleaved_float (resample->state,
(gint16 *) GST_BUFFER_DATA (buf), &out_processed); NULL, &len, (gfloat *) GST_BUFFER_DATA (buf), &out_processed);
} else {
guint len = resample_int_resampler_get_input_latency (resample->state);
err =
resample_int_resampler_process_interleaved_int (resample->state, NULL,
&len, (gint16 *) GST_BUFFER_DATA (buf), &out_processed);
}
if (err != RESAMPLER_ERR_SUCCESS) { if (err != RESAMPLER_ERR_SUCCESS) {
GST_WARNING ("Failed to process drain: %s", GST_WARNING ("Failed to process drain: %s",
@ -866,10 +873,10 @@ gst_speex_resample_query (GstPad * pad, GstQuery * query)
if (resample->state && resample->fp) if (resample->state && resample->fp)
resampler_latency = resampler_latency =
resample_float_resampler_get_latency (resample->state); resample_float_resampler_get_input_latency (resample->state);
else if (resample->state && !resample->fp) else if (resample->state && !resample->fp)
resampler_latency = resampler_latency =
resample_int_resampler_get_latency (resample->state); resample_int_resampler_get_input_latency (resample->state);
else else
resampler_latency = 0; resampler_latency = 0;

View file

@ -74,6 +74,7 @@ speex_realloc (void *ptr, int size)
{ {
return g_realloc (ptr, size); return g_realloc (ptr, size);
} }
static inline void static inline void
speex_free (void *ptr) speex_free (void *ptr)
{ {
@ -395,10 +396,13 @@ resampler_basic_direct_single (SpeexResamplerState * st,
} }
/* Do the new part */ /* Do the new part */
ptr = in + st->in_stride * (last_sample - N + 1 + j); if (in != NULL) {
for (; j < N; j++) { ptr = in + st->in_stride * (last_sample - N + 1 + j);
sum += MULT16_16 (*ptr, st->sinc_table[samp_frac_num * st->filt_len + j]); for (; j < N; j++) {
ptr += st->in_stride; sum +=
MULT16_16 (*ptr, st->sinc_table[samp_frac_num * st->filt_len + j]);
ptr += st->in_stride;
}
} }
*out = PSHR32 (sum, 15); *out = PSHR32 (sum, 15);
@ -447,12 +451,14 @@ resampler_basic_direct_double (SpeexResamplerState * st,
} }
/* Do the new part */ /* Do the new part */
ptr = in + st->in_stride * (last_sample - N + 1 + j); if (in != NULL) {
for (; j < N; j++) { ptr = in + st->in_stride * (last_sample - N + 1 + j);
sum += for (; j < N; j++) {
MULT16_16 (*ptr, sum +=
(double) st->sinc_table[samp_frac_num * st->filt_len + j]); MULT16_16 (*ptr,
ptr += st->in_stride; (double) st->sinc_table[samp_frac_num * st->filt_len + j]);
ptr += st->in_stride;
}
} }
*out = sum; *out = sum;
@ -524,24 +530,27 @@ resampler_basic_interpolate_single (SpeexResamplerState * st,
MULT16_16 (curr_mem, MULT16_16 (curr_mem,
st->sinc_table[4 + (j + 1) * st->oversample - offset + 1]); st->sinc_table[4 + (j + 1) * st->oversample - offset + 1]);
} }
ptr = in + st->in_stride * (last_sample - N + 1 + j);
/* Do the new part */
for (; j < N; j++) {
spx_word16_t curr_in = *ptr;
ptr += st->in_stride; if (in != NULL) {
accum[0] += ptr = in + st->in_stride * (last_sample - N + 1 + j);
MULT16_16 (curr_in, /* Do the new part */
st->sinc_table[4 + (j + 1) * st->oversample - offset - 2]); for (; j < N; j++) {
accum[1] += spx_word16_t curr_in = *ptr;
MULT16_16 (curr_in,
st->sinc_table[4 + (j + 1) * st->oversample - offset - 1]); ptr += st->in_stride;
accum[2] += accum[0] +=
MULT16_16 (curr_in, MULT16_16 (curr_in,
st->sinc_table[4 + (j + 1) * st->oversample - offset]); st->sinc_table[4 + (j + 1) * st->oversample - offset - 2]);
accum[3] += accum[1] +=
MULT16_16 (curr_in, MULT16_16 (curr_in,
st->sinc_table[4 + (j + 1) * st->oversample - offset + 1]); st->sinc_table[4 + (j + 1) * st->oversample - offset - 1]);
accum[2] +=
MULT16_16 (curr_in,
st->sinc_table[4 + (j + 1) * st->oversample - offset]);
accum[3] +=
MULT16_16 (curr_in,
st->sinc_table[4 + (j + 1) * st->oversample - offset + 1]);
}
} }
cubic_coef (frac, interp); cubic_coef (frac, interp);
sum = sum =
@ -611,24 +620,26 @@ resampler_basic_interpolate_double (SpeexResamplerState * st,
MULT16_16 (curr_mem, MULT16_16 (curr_mem,
st->sinc_table[4 + (j + 1) * st->oversample - offset + 1]); st->sinc_table[4 + (j + 1) * st->oversample - offset + 1]);
} }
ptr = in + st->in_stride * (last_sample - N + 1 + j); if (in != NULL) {
/* Do the new part */ ptr = in + st->in_stride * (last_sample - N + 1 + j);
for (; j < N; j++) { /* Do the new part */
double curr_in = *ptr; for (; j < N; j++) {
double curr_in = *ptr;
ptr += st->in_stride; ptr += st->in_stride;
accum[0] += accum[0] +=
MULT16_16 (curr_in, MULT16_16 (curr_in,
st->sinc_table[4 + (j + 1) * st->oversample - offset - 2]); st->sinc_table[4 + (j + 1) * st->oversample - offset - 2]);
accum[1] += accum[1] +=
MULT16_16 (curr_in, MULT16_16 (curr_in,
st->sinc_table[4 + (j + 1) * st->oversample - offset - 1]); st->sinc_table[4 + (j + 1) * st->oversample - offset - 1]);
accum[2] += accum[2] +=
MULT16_16 (curr_in, MULT16_16 (curr_in,
st->sinc_table[4 + (j + 1) * st->oversample - offset]); st->sinc_table[4 + (j + 1) * st->oversample - offset]);
accum[3] += accum[3] +=
MULT16_16 (curr_in, MULT16_16 (curr_in,
st->sinc_table[4 + (j + 1) * st->oversample - offset + 1]); st->sinc_table[4 + (j + 1) * st->oversample - offset + 1]);
}
} }
cubic_coef (frac, interp); cubic_coef (frac, interp);
sum = sum =
@ -971,9 +982,13 @@ speex_resampler_process_native (SpeexResamplerState * st,
for (j = 0; j < N - 1 - (spx_int32_t) * in_len; j++) for (j = 0; j < N - 1 - (spx_int32_t) * in_len; j++)
mem[j] = mem[j + *in_len]; mem[j] = mem[j + *in_len];
for (; j < N - 1; j++) if (in != NULL) {
mem[j] = in[st->in_stride * (j + *in_len - N + 1)]; for (; j < N - 1; j++)
mem[j] = in[st->in_stride * (j + *in_len - N + 1)];
} else {
for (; j < N - 1; j++)
mem[j] = 0;
}
return RESAMPLER_ERR_SUCCESS; return RESAMPLER_ERR_SUCCESS;
} }
@ -998,10 +1013,16 @@ speex_resampler_process_float (SpeexResamplerState * st,
ALLOC(y, *out_len, spx_word16_t); */ ALLOC(y, *out_len, spx_word16_t); */
istride_save = st->in_stride; istride_save = st->in_stride;
ostride_save = st->out_stride; ostride_save = st->out_stride;
for (i = 0; i < *in_len; i++) if (in != NULL) {
x[i] = WORD2INT (in[i * st->in_stride]); for (i = 0; i < *in_len; i++)
st->in_stride = st->out_stride = 1; x[i] = WORD2INT (in[i * st->in_stride]);
speex_resampler_process_native (st, channel_index, x, in_len, y, out_len); st->in_stride = st->out_stride = 1;
speex_resampler_process_native (st, channel_index, x, in_len, y, out_len);
} else {
st->in_stride = st->out_stride = 1;
speex_resampler_process_native (st, channel_index, NULL, in_len, y,
out_len);
}
st->in_stride = istride_save; st->in_stride = istride_save;
st->out_stride = ostride_save; st->out_stride = ostride_save;
for (i = 0; i < *out_len; i++) for (i = 0; i < *out_len; i++)
@ -1022,10 +1043,17 @@ speex_resampler_process_float (SpeexResamplerState * st,
ichunk = FIXED_STACK_ALLOC; ichunk = FIXED_STACK_ALLOC;
if (ochunk > FIXED_STACK_ALLOC) if (ochunk > FIXED_STACK_ALLOC)
ochunk = FIXED_STACK_ALLOC; ochunk = FIXED_STACK_ALLOC;
for (i = 0; i < ichunk; i++) if (in != NULL) {
x[i] = WORD2INT (in[i * st->in_stride]); for (i = 0; i < ichunk; i++)
st->in_stride = st->out_stride = 1; x[i] = WORD2INT (in[i * st->in_stride]);
speex_resampler_process_native (st, channel_index, x, &ichunk, y, &ochunk); st->in_stride = st->out_stride = 1;
speex_resampler_process_native (st, channel_index, x, &ichunk, y,
&ochunk);
} else {
st->in_stride = st->out_stride = 1;
speex_resampler_process_native (st, channel_index, NULL, &ichunk, y,
&ochunk);
}
st->in_stride = istride_save; st->in_stride = istride_save;
st->out_stride = ostride_save; st->out_stride = ostride_save;
for (i = 0; i < ochunk; i++) for (i = 0; i < ochunk; i++)
@ -1077,10 +1105,16 @@ speex_resampler_process_int (SpeexResamplerState * st,
ALLOC(y, *out_len, spx_word16_t); */ ALLOC(y, *out_len, spx_word16_t); */
istride_save = st->in_stride; istride_save = st->in_stride;
ostride_save = st->out_stride; ostride_save = st->out_stride;
for (i = 0; i < *in_len; i++) if (in != NULL) {
x[i] = in[i * st->in_stride]; for (i = 0; i < *in_len; i++)
st->in_stride = st->out_stride = 1; x[i] = in[i * st->in_stride];
speex_resampler_process_native (st, channel_index, x, in_len, y, out_len); st->in_stride = st->out_stride = 1;
speex_resampler_process_native (st, channel_index, x, in_len, y, out_len);
} else {
st->in_stride = st->out_stride = 1;
speex_resampler_process_native (st, channel_index, NULL, in_len, y,
out_len);
}
st->in_stride = istride_save; st->in_stride = istride_save;
st->out_stride = ostride_save; st->out_stride = ostride_save;
for (i = 0; i < *out_len; i++) for (i = 0; i < *out_len; i++)
@ -1101,10 +1135,17 @@ speex_resampler_process_int (SpeexResamplerState * st,
ichunk = FIXED_STACK_ALLOC; ichunk = FIXED_STACK_ALLOC;
if (ochunk > FIXED_STACK_ALLOC) if (ochunk > FIXED_STACK_ALLOC)
ochunk = FIXED_STACK_ALLOC; ochunk = FIXED_STACK_ALLOC;
for (i = 0; i < ichunk; i++) if (in != NULL) {
x[i] = in[i * st->in_stride]; for (i = 0; i < ichunk; i++)
st->in_stride = st->out_stride = 1; x[i] = in[i * st->in_stride];
speex_resampler_process_native (st, channel_index, x, &ichunk, y, &ochunk); st->in_stride = st->out_stride = 1;
speex_resampler_process_native (st, channel_index, x, &ichunk, y,
&ochunk);
} else {
st->in_stride = st->out_stride = 1;
speex_resampler_process_native (st, channel_index, NULL, &ichunk, y,
&ochunk);
}
st->in_stride = istride_save; st->in_stride = istride_save;
st->out_stride = ostride_save; st->out_stride = ostride_save;
for (i = 0; i < ochunk; i++) for (i = 0; i < ochunk; i++)
@ -1134,7 +1175,10 @@ speex_resampler_process_interleaved_float (SpeexResamplerState * st,
st->in_stride = st->out_stride = st->nb_channels; st->in_stride = st->out_stride = st->nb_channels;
for (i = 0; i < st->nb_channels; i++) { for (i = 0; i < st->nb_channels; i++) {
*out_len = bak_len; *out_len = bak_len;
speex_resampler_process_float (st, i, in + i, in_len, out + i, out_len); if (in != NULL)
speex_resampler_process_float (st, i, in + i, in_len, out + i, out_len);
else
speex_resampler_process_float (st, i, NULL, in_len, out + i, out_len);
} }
st->in_stride = istride_save; st->in_stride = istride_save;
st->out_stride = ostride_save; st->out_stride = ostride_save;
@ -1156,7 +1200,10 @@ speex_resampler_process_interleaved_int (SpeexResamplerState * st,
st->in_stride = st->out_stride = st->nb_channels; st->in_stride = st->out_stride = st->nb_channels;
for (i = 0; i < st->nb_channels; i++) { for (i = 0; i < st->nb_channels; i++) {
*out_len = bak_len; *out_len = bak_len;
speex_resampler_process_int (st, i, in + i, in_len, out + i, out_len); if (in != NULL)
speex_resampler_process_int (st, i, in + i, in_len, out + i, out_len);
else
speex_resampler_process_int (st, i, NULL, in_len, out + i, out_len);
} }
st->in_stride = istride_save; st->in_stride = istride_save;
st->out_stride = ostride_save; st->out_stride = ostride_save;
@ -1273,133 +1320,16 @@ speex_resampler_get_output_stride (SpeexResamplerState * st,
} }
int int
speex_resampler_get_latency (SpeexResamplerState * st) speex_resampler_get_input_latency (SpeexResamplerState * st)
{ {
return st->filt_len / 2; return st->filt_len / 2;
} }
int int
speex_resampler_drain_float (SpeexResamplerState * st, speex_resampler_get_output_latency (SpeexResamplerState * st)
spx_uint32_t channel_index, float *out, spx_uint32_t * out_len)
{ {
spx_uint32_t in_len; return ((st->filt_len / 2) * st->den_rate +
int ret; (st->num_rate >> 1)) / st->num_rate;
float *in;
in_len = speex_resampler_get_latency (st);
in = speex_alloc (sizeof (float) * in_len);
*out_len =
MIN (in_len * st->den_rate + (st->num_rate >> 1) / st->num_rate,
*out_len);
ret =
speex_resampler_process_float (st, channel_index, in, &in_len, out,
out_len);
speex_free (in);
speex_resampler_reset_mem (st);
return ret;
}
int
speex_resampler_drain_int (SpeexResamplerState * st,
spx_uint32_t channel_index, spx_int16_t * out, spx_uint32_t * out_len)
{
spx_uint32_t in_len;
int ret;
spx_int16_t *in;
in_len = speex_resampler_get_latency (st);
in = speex_alloc (sizeof (spx_int16_t) * in_len);
*out_len =
MIN (in_len * st->den_rate + (st->num_rate >> 1) / st->num_rate,
*out_len);
ret =
speex_resampler_process_int (st, channel_index, in, &in_len, out,
out_len);
speex_free (in);
speex_resampler_reset_mem (st);
return ret;
}
int
speex_resampler_drain_interleaved_float (SpeexResamplerState * st,
float *out, spx_uint32_t * out_len)
{
spx_uint32_t i;
int istride_save, ostride_save;
spx_uint32_t bak_len;
spx_uint32_t in_len;
float *in;
in_len = speex_resampler_get_latency (st);
in = speex_alloc (sizeof (float) * in_len);
*out_len =
MIN (in_len * st->den_rate + (st->num_rate >> 1) / st->num_rate,
*out_len);
bak_len = *out_len;
istride_save = st->in_stride;
ostride_save = st->out_stride;
st->in_stride = 1;
st->out_stride = st->nb_channels;
for (i = 0; i < st->nb_channels; i++) {
*out_len = bak_len;
speex_resampler_process_float (st, i, in, &in_len, out + i, out_len);
}
st->in_stride = istride_save;
st->out_stride = ostride_save;
speex_free (in);
speex_resampler_reset_mem (st);
return RESAMPLER_ERR_SUCCESS;
}
int
speex_resampler_drain_interleaved_int (SpeexResamplerState * st,
spx_int16_t * out, spx_uint32_t * out_len)
{
spx_uint32_t i;
int istride_save, ostride_save;
spx_uint32_t bak_len;
spx_uint32_t in_len;
spx_int16_t *in;
in_len = speex_resampler_get_latency (st);
in = speex_alloc (sizeof (spx_int16_t) * in_len);
*out_len =
MIN (in_len * st->den_rate + (st->num_rate >> 1) / st->num_rate,
*out_len);
bak_len = *out_len;
istride_save = st->in_stride;
ostride_save = st->out_stride;
st->in_stride = 1;
st->out_stride = st->nb_channels;
for (i = 0; i < st->nb_channels; i++) {
*out_len = bak_len;
speex_resampler_process_int (st, i, in, &in_len, out + i, out_len);
}
st->in_stride = istride_save;
st->out_stride = ostride_save;
speex_free (in);
speex_resampler_reset_mem (st);
return RESAMPLER_ERR_SUCCESS;
} }
int int

View file

@ -73,11 +73,8 @@
#define speex_resampler_get_input_stride CAT_PREFIX(RANDOM_PREFIX,_resampler_get_input_stride) #define speex_resampler_get_input_stride CAT_PREFIX(RANDOM_PREFIX,_resampler_get_input_stride)
#define speex_resampler_set_output_stride CAT_PREFIX(RANDOM_PREFIX,_resampler_set_output_stride) #define speex_resampler_set_output_stride CAT_PREFIX(RANDOM_PREFIX,_resampler_set_output_stride)
#define speex_resampler_get_output_stride CAT_PREFIX(RANDOM_PREFIX,_resampler_get_output_stride) #define speex_resampler_get_output_stride CAT_PREFIX(RANDOM_PREFIX,_resampler_get_output_stride)
#define speex_resampler_get_latency CAT_PREFIX(RANDOM_PREFIX,_resampler_get_latency) #define speex_resampler_get_input_latency CAT_PREFIX(RANDOM_PREFIX,_resampler_get_input_latency)
#define speex_resampler_drain_float CAT_PREFIX(RANDOM_PREFIX,_resampler_drain_float) #define speex_resampler_get_output_latency CAT_PREFIX(RANDOM_PREFIX,_resampler_get_output_latency)
#define speex_resampler_drain_int CAT_PREFIX(RANDOM_PREFIX,_resampler_drain_int)
#define speex_resampler_drain_interleaved_float CAT_PREFIX(RANDOM_PREFIX,_resampler_drain_interleaved_float)
#define speex_resampler_drain_interleaved_int CAT_PREFIX(RANDOM_PREFIX,_resampler_drain_interleaved_int)
#define speex_resampler_skip_zeros CAT_PREFIX(RANDOM_PREFIX,_resampler_skip_zeros) #define speex_resampler_skip_zeros CAT_PREFIX(RANDOM_PREFIX,_resampler_skip_zeros)
#define speex_resampler_reset_mem CAT_PREFIX(RANDOM_PREFIX,_resampler_reset_mem) #define speex_resampler_reset_mem CAT_PREFIX(RANDOM_PREFIX,_resampler_reset_mem)
#define speex_resampler_strerror CAT_PREFIX(RANDOM_PREFIX,_resampler_strerror) #define speex_resampler_strerror CAT_PREFIX(RANDOM_PREFIX,_resampler_strerror)
@ -288,7 +285,7 @@ void speex_resampler_set_input_stride(SpeexResamplerState *st,
/** Get the input stride. /** Get the input stride.
* @param st Resampler state * @param st Resampler state
* @param stride Input stride * @param stride Input stride copied
*/ */
void speex_resampler_get_input_stride(SpeexResamplerState *st, void speex_resampler_get_input_stride(SpeexResamplerState *st,
spx_uint32_t *stride); spx_uint32_t *stride);
@ -301,7 +298,7 @@ void speex_resampler_set_output_stride(SpeexResamplerState *st,
spx_uint32_t stride); spx_uint32_t stride);
/** Get the output stride. /** Get the output stride.
* @param st Resampler state * @param st Resampler state copied
* @param stride Output stride * @param stride Output stride
*/ */
void speex_resampler_get_output_stride(SpeexResamplerState *st, void speex_resampler_get_output_stride(SpeexResamplerState *st,
@ -310,58 +307,12 @@ void speex_resampler_get_output_stride(SpeexResamplerState *st,
/** Get the latency in input samples introduced by the resampler. /** Get the latency in input samples introduced by the resampler.
* @param st Resampler state * @param st Resampler state
*/ */
int speex_resampler_get_latency(SpeexResamplerState *st); int speex_resampler_get_input_latency(SpeexResamplerState *st);
/** /** Get the latency in output samples introduced by the resampler.
* Outputs the remaining samples into a float array.
* @param st Resampler state * @param st Resampler state
* @param channel_index Index of the channel to process for the multi-channel
* base (0 otherwise)
* of samples processed
* @param out Output buffer
* @param out_len Size of the output buffer. Returns the number of samples written
*/ */
int speex_resampler_drain_float(SpeexResamplerState *st, int speex_resampler_get_output_latency(SpeexResamplerState *st);
spx_uint32_t channel_index,
float *out,
spx_uint32_t *out_len);
/**
* Outputs the remaining samples into an int array.
* @param st Resampler state
* @param channel_index Index of the channel to process for the multi-channel
* base (0 otherwise)
* of samples processed
* @param out Output buffer
* @param out_len Size of the output buffer. Returns the number of samples written
*/
int speex_resampler_drain_int(SpeexResamplerState *st,
spx_uint32_t channel_index,
spx_int16_t *out,
spx_uint32_t *out_len);
/**
* Outputs the remaining samples into a float array.
* @param st Resampler state
* @param channel_index Index of the channel to process for the multi-channel
* base (0 otherwise)
* of samples processed
* @param out Output buffer
* @param out_len Size of the output buffer. Returns the number of samples written
*/
int speex_resampler_drain_interleaved_float(SpeexResamplerState *st,
float *out,
spx_uint32_t *out_len);
/**
* Outputs the remaining samples into an int array.
* @param st Resampler state
* @param channel_index Index of the channel to process for the multi-channel
* base (0 otherwise)
* of samples processed
* @param out Output buffer
* @param out_len Size of the output buffer. Returns the number of samples written
*/
int speex_resampler_drain_interleaved_int(SpeexResamplerState *st,
spx_int16_t *out,
spx_uint32_t *out_len);
/** Make sure that the first samples to go out of the resamplers don't have /** Make sure that the first samples to go out of the resamplers don't have
* leading zeros. This is only useful before starting to use a newly created * leading zeros. This is only useful before starting to use a newly created

View file

@ -67,8 +67,8 @@ void resample_float_resampler_get_ratio (SpeexResamplerState * st,
void resample_int_resampler_get_ratio (SpeexResamplerState * st, void resample_int_resampler_get_ratio (SpeexResamplerState * st,
guint32 * ratio_num, guint32 * ratio_den); guint32 * ratio_num, guint32 * ratio_den);
int resample_float_resampler_get_latency (SpeexResamplerState * st); int resample_float_resampler_get_input_latency (SpeexResamplerState * st);
int resample_int_resampler_get_latency (SpeexResamplerState * st); int resample_int_resampler_get_input_latency (SpeexResamplerState * st);
int resample_float_resampler_set_quality (SpeexResamplerState * st, int resample_float_resampler_set_quality (SpeexResamplerState * st,
gint quality); gint quality);
@ -77,12 +77,6 @@ int resample_int_resampler_set_quality (SpeexResamplerState * st, gint quality);
int resample_float_resampler_reset_mem (SpeexResamplerState * st); int resample_float_resampler_reset_mem (SpeexResamplerState * st);
int resample_int_resampler_reset_mem (SpeexResamplerState * st); int resample_int_resampler_reset_mem (SpeexResamplerState * st);
int
resample_float_resampler_drain_interleaved_float (SpeexResamplerState
* st, gfloat * out, guint32 * out_len);
int resample_int_resampler_drain_interleaved_int (SpeexResamplerState
* st, gint16 * out, guint32 * out_len);
int resample_float_resampler_skip_zeros (SpeexResamplerState * st); int resample_float_resampler_skip_zeros (SpeexResamplerState * st);
int resample_int_resampler_skip_zeros (SpeexResamplerState * st); int resample_int_resampler_skip_zeros (SpeexResamplerState * st);