[pulseaudio-commits] r1712 - in /branches/lennart/src/pulsecore: resampler.c resampler.h sconv-s16be.c sconv-s16be.h sconv-s16le.c sconv-s16le.h sconv.c sconv.h
svnmailer-noreply at 0pointer.de
svnmailer-noreply at 0pointer.de
Thu Aug 23 15:35:41 PDT 2007
Author: lennart
Date: Fri Aug 24 00:35:40 2007
New Revision: 1712
URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=3D1712&root=3Dpulseaudio&vi=
ew=3Drev
Log:
big resampler rework: support integer-only resampling, support speex resamp=
ler
Modified:
branches/lennart/src/pulsecore/resampler.c
branches/lennart/src/pulsecore/resampler.h
branches/lennart/src/pulsecore/sconv-s16be.c
branches/lennart/src/pulsecore/sconv-s16be.h
branches/lennart/src/pulsecore/sconv-s16le.c
branches/lennart/src/pulsecore/sconv-s16le.h
branches/lennart/src/pulsecore/sconv.c
branches/lennart/src/pulsecore/sconv.h
Modified: branches/lennart/src/pulsecore/resampler.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/=
resampler.c?rev=3D1712&root=3Dpulseaudio&r1=3D1711&r2=3D1712&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/pulsecore/resampler.c (original)
+++ branches/lennart/src/pulsecore/resampler.c Fri Aug 24 00:35:40 2007
@@ -28,6 +28,7 @@
#include <string.h>
=
#include <samplerate.h>
+
#include <liboil/liboilfuncs.h>
#include <liboil/liboil.h>
=
@@ -36,41 +37,93 @@
#include <pulsecore/log.h>
#include <pulsecore/macro.h>
=
+#include "speexwrap.h"
+
#include "resampler.h"
=
struct pa_resampler {
pa_resample_method_t resample_method;
pa_sample_spec i_ss, o_ss;
pa_channel_map i_cm, o_cm;
- size_t i_fz, o_fz;
+ size_t i_fz, o_fz, w_sz;
pa_mempool *mempool;
=
- void (*impl_free)(pa_resampler *r);
- void (*impl_update_input_rate)(pa_resampler *r, uint32_t rate);
- void (*impl_update_output_rate)(pa_resampler *r, uint32_t rate);
- void (*impl_run)(pa_resampler *r, const pa_memchunk *in, pa_memchunk *=
out);
- void *impl_data;
-};
-
-struct impl_libsamplerate {
pa_memchunk buf1, buf2, buf3, buf4;
unsigned buf1_samples, buf2_samples, buf3_samples, buf4_samples;
=
- pa_convert_to_float32ne_func_t to_float32ne_func;
- pa_convert_from_float32ne_func_t from_float32ne_func;
- SRC_STATE *src_state;
+ pa_sample_format_t work_format;
+ =
+ pa_convert_func_t to_work_format_func;
+ pa_convert_func_t from_work_format_func;
=
int map_table[PA_CHANNELS_MAX][PA_CHANNELS_MAX];
int map_required;
-};
-
-struct impl_trivial {
- unsigned o_counter;
- unsigned i_counter;
+
+ void (*impl_free)(pa_resampler *r);
+ void (*impl_update_rates)(pa_resampler *r);
+ void (*impl_resample)(pa_resampler *r, const pa_memchunk *in, unsigned=
in_samples, pa_memchunk *out, unsigned *out_samples);
+ =
+ struct { /* data specific to the trivial resampler */
+ unsigned o_counter;
+ unsigned i_counter;
+ } trivial;
+
+ struct { /* data specific to libsamplerate */
+ SRC_STATE *state;
+ } src;
+
+ struct { /* data specific to speex */
+ SpeexResamplerState* state;
+ } speex;
};
=
static int libsamplerate_init(pa_resampler*r);
static int trivial_init(pa_resampler*r);
+static int speex_init(pa_resampler*r);
+
+static void calc_map_table(pa_resampler *r);
+
+static int (* const init_table[])(pa_resampler*r) =3D {
+ [PA_RESAMPLER_SRC_SINC_BEST_QUALITY] =3D libsamplerate_init,
+ [PA_RESAMPLER_SRC_SINC_MEDIUM_QUALITY] =3D libsamplerate_init,
+ [PA_RESAMPLER_SRC_SINC_FASTEST] =3D libsamplerate_init,
+ [PA_RESAMPLER_SRC_ZERO_ORDER_HOLD] =3D libsamplerate_init,
+ [PA_RESAMPLER_SRC_LINEAR] =3D libsamplerate_init,
+ [PA_RESAMPLER_TRIVIAL] =3D trivial_init,
+ [PA_RESAMPLER_SPEEX_FLOAT_BASE+0] =3D speex_init,
+ [PA_RESAMPLER_SPEEX_FLOAT_BASE+1] =3D speex_init,
+ [PA_RESAMPLER_SPEEX_FLOAT_BASE+2] =3D speex_init,
+ [PA_RESAMPLER_SPEEX_FLOAT_BASE+3] =3D speex_init,
+ [PA_RESAMPLER_SPEEX_FLOAT_BASE+4] =3D speex_init,
+ [PA_RESAMPLER_SPEEX_FLOAT_BASE+5] =3D speex_init,
+ [PA_RESAMPLER_SPEEX_FLOAT_BASE+6] =3D speex_init,
+ [PA_RESAMPLER_SPEEX_FLOAT_BASE+7] =3D speex_init,
+ [PA_RESAMPLER_SPEEX_FLOAT_BASE+8] =3D speex_init,
+ [PA_RESAMPLER_SPEEX_FLOAT_BASE+9] =3D speex_init,
+ [PA_RESAMPLER_SPEEX_FLOAT_BASE+10] =3D speex_init,
+ [PA_RESAMPLER_SPEEX_FIXED_BASE+0] =3D speex_init,
+ [PA_RESAMPLER_SPEEX_FIXED_BASE+1] =3D speex_init,
+ [PA_RESAMPLER_SPEEX_FIXED_BASE+2] =3D speex_init,
+ [PA_RESAMPLER_SPEEX_FIXED_BASE+3] =3D speex_init,
+ [PA_RESAMPLER_SPEEX_FIXED_BASE+4] =3D speex_init,
+ [PA_RESAMPLER_SPEEX_FIXED_BASE+5] =3D speex_init,
+ [PA_RESAMPLER_SPEEX_FIXED_BASE+6] =3D speex_init,
+ [PA_RESAMPLER_SPEEX_FIXED_BASE+7] =3D speex_init,
+ [PA_RESAMPLER_SPEEX_FIXED_BASE+8] =3D speex_init,
+ [PA_RESAMPLER_SPEEX_FIXED_BASE+9] =3D speex_init,
+ [PA_RESAMPLER_SPEEX_FIXED_BASE+10] =3D speex_init,
+ [PA_RESAMPLER_AUTO] =3D NULL,
+};
+
+static inline size_t sample_size(pa_sample_format_t f) {
+ pa_sample_spec ss =3D {
+ .format =3D f,
+ .rate =3D 0,
+ .channels =3D 1
+ };
+
+ return pa_sample_size(&ss);
+}
=
pa_resampler* pa_resampler_new(
pa_mempool *pool,
@@ -87,16 +140,25 @@
pa_assert(b);
pa_assert(pa_sample_spec_valid(a));
pa_assert(pa_sample_spec_valid(b));
- pa_assert(resample_method !=3D PA_RESAMPLER_INVALID);
-
+ pa_assert(resample_method >=3D 0);
+ pa_assert(resample_method < PA_RESAMPLER_MAX);
+
+ /* Fix method */
+ if (resample_method =3D=3D PA_RESAMPLER_AUTO) {
+ if (a->format =3D=3D PA_SAMPLE_FLOAT32LE || a->format =3D=3D PA_SA=
MPLE_FLOAT32BE ||
+ b->format =3D=3D PA_SAMPLE_FLOAT32LE || b->format =3D=3D PA_SA=
MPLE_FLOAT32BE)
+ resample_method =3D PA_RESAMPLER_SPEEX_FLOAT_BASE + 0;
+ else
+ resample_method =3D PA_RESAMPLER_SPEEX_FIXED_BASE + 0;
+ }
+ =
r =3D pa_xnew(pa_resampler, 1);
- r->impl_data =3D NULL;
r->mempool =3D pool;
r->resample_method =3D resample_method;
=
r->impl_free =3D NULL;
- r->impl_update_input_rate =3D NULL;
- r->impl_run =3D NULL;
+ r->impl_update_rates =3D NULL;
+ r->impl_resample =3D NULL;
=
/* Fill sample specs */
r->i_ss =3D *a;
@@ -115,24 +177,61 @@
r->i_fz =3D pa_frame_size(a);
r->o_fz =3D pa_frame_size(b);
=
- /* Choose implementation */
- if (a->channels !=3D b->channels ||
- a->format !=3D b->format ||
- !pa_channel_map_equal(&r->i_cm, &r->o_cm) ||
- resample_method !=3D PA_RESAMPLER_TRIVIAL) {
-
- /* Use the libsamplerate based resampler for the complicated cases=
*/
- if (resample_method =3D=3D PA_RESAMPLER_TRIVIAL)
- r->resample_method =3D PA_RESAMPLER_SRC_ZERO_ORDER_HOLD;
-
- if (libsamplerate_init(r) < 0)
+ pa_memchunk_reset(&r->buf1);
+ pa_memchunk_reset(&r->buf2);
+ pa_memchunk_reset(&r->buf3);
+ pa_memchunk_reset(&r->buf4);
+
+ r->buf1_samples =3D r->buf2_samples =3D r->buf3_samples =3D r->buf4_sa=
mples =3D 0;
+
+ calc_map_table(r);
+
+ pa_log_info("Using resampler '%s'", pa_resample_method_to_string(resam=
ple_method));
+ =
+ if (resample_method >=3D PA_RESAMPLER_SPEEX_FIXED_BASE && resample_met=
hod <=3D PA_RESAMPLER_SPEEX_FIXED_MAX)
+ r->work_format =3D PA_SAMPLE_S16NE;
+ else if (resample_method =3D=3D PA_RESAMPLER_TRIVIAL) {
+
+ if (r->map_required || a->format !=3D b->format) {
+
+ if (a->format =3D=3D PA_SAMPLE_FLOAT32NE || a->format =3D=3D P=
A_SAMPLE_FLOAT32RE)
+ r->work_format =3D PA_SAMPLE_FLOAT32NE;
+ else
+ r->work_format =3D PA_SAMPLE_S16NE;
+ =
+ } else
+ r->work_format =3D a->format;
+ =
+ } else
+ r->work_format =3D PA_SAMPLE_FLOAT32NE;
+
+ r->w_sz =3D sample_size(r->work_format);
+ =
+ if (r->i_ss.format =3D=3D r->work_format)
+ r->to_work_format_func =3D NULL;
+ else if (r->work_format =3D=3D PA_SAMPLE_FLOAT32NE) {
+ if (!(r->to_work_format_func =3D pa_get_convert_to_float32ne_funct=
ion(r->i_ss.format)))
goto fail;
-
} else {
- /* Use our own simple non-fp resampler for the trivial cases and w=
hen the user selects it */
- if (trivial_init(r) < 0)
+ pa_assert(r->work_format =3D=3D PA_SAMPLE_S16NE);
+ if (!(r->to_work_format_func =3D pa_get_convert_to_s16ne_function(=
r->i_ss.format)))
goto fail;
}
+
+ if (r->o_ss.format =3D=3D r->work_format)
+ r->from_work_format_func =3D NULL;
+ else if (r->work_format =3D=3D PA_SAMPLE_FLOAT32NE) {
+ if (!(r->from_work_format_func =3D pa_get_convert_from_float32ne_f=
unction(r->o_ss.format)))
+ goto fail;
+ } else {
+ pa_assert(r->work_format =3D=3D PA_SAMPLE_S16NE);
+ if (!(r->from_work_format_func =3D pa_get_convert_from_s16ne_funct=
ion(r->o_ss.format)))
+ goto fail;
+ }
+
+ /* initialize implementation */
+ if (init_table[resample_method](r) < 0)
+ goto fail;
=
return r;
=
@@ -149,6 +248,15 @@
if (r->impl_free)
r->impl_free(r);
=
+ if (r->buf1.memblock)
+ pa_memblock_unref(r->buf1.memblock);
+ if (r->buf2.memblock)
+ pa_memblock_unref(r->buf2.memblock);
+ if (r->buf3.memblock)
+ pa_memblock_unref(r->buf3.memblock);
+ if (r->buf4.memblock)
+ pa_memblock_unref(r->buf4.memblock);
+ =
pa_xfree(r);
}
=
@@ -160,9 +268,7 @@
return;
=
r->i_ss.rate =3D rate;
-
- if (r->impl_update_input_rate)
- r->impl_update_input_rate(r, rate);
+ r->impl_update_rates(r);
}
=
void pa_resampler_set_output_rate(pa_resampler *r, uint32_t rate) {
@@ -173,15 +279,7 @@
return;
=
r->o_ss.rate =3D rate;
-
- if (r->impl_update_output_rate)
- r->impl_update_output_rate(r, rate);
-}
-
-void pa_resampler_run(pa_resampler *r, const pa_memchunk *in, pa_memchunk =
*out) {
- pa_assert(r && in && out && r->impl_run);
-
- r->impl_run(r, in, out);
+ r->impl_update_rates(r);
}
=
size_t pa_resampler_request(pa_resampler *r, size_t out_length) {
@@ -192,6 +290,7 @@
=
pa_resample_method_t pa_resampler_get_method(pa_resampler *r) {
pa_assert(r);
+ =
return r->resample_method;
}
=
@@ -201,7 +300,30 @@
"src-sinc-fastest",
"src-zero-order-hold",
"src-linear",
- "trivial"
+ "trivial",
+ "speex-float-0",
+ "speex-float-1",
+ "speex-float-2",
+ "speex-float-3",
+ "speex-float-4",
+ "speex-float-5",
+ "speex-float-6",
+ "speex-float-7",
+ "speex-float-8",
+ "speex-float-9",
+ "speex-float-10",
+ "speex-fixed-0",
+ "speex-fixed-1",
+ "speex-fixed-2",
+ "speex-fixed-3",
+ "speex-fixed-4",
+ "speex-fixed-5",
+ "speex-fixed-6",
+ "speex-fixed-7",
+ "speex-fixed-8",
+ "speex-fixed-9",
+ "speex-fixed-10",
+ "auto"
};
=
const char *pa_resample_method_to_string(pa_resample_method_t m) {
@@ -221,44 +343,21 @@
if (!strcmp(string, resample_methods[m]))
return m;
=
+ if (!strcmp(string, "speex-fixed"))
+ return PA_RESAMPLER_SPEEX_FIXED_BASE + 0;
+
+ if (!strcmp(string, "speex-float"))
+ return PA_RESAMPLER_SPEEX_FLOAT_BASE + 0;
+
return PA_RESAMPLER_INVALID;
}
=
-
-/*** libsamplerate based implementation ***/
-
-static void libsamplerate_free(pa_resampler *r) {
- struct impl_libsamplerate *u;
-
- pa_assert(r);
- pa_assert(r->impl_data);
-
- u =3D r->impl_data;
-
- if (u->src_state)
- src_delete(u->src_state);
-
- if (u->buf1.memblock)
- pa_memblock_unref(u->buf1.memblock);
- if (u->buf2.memblock)
- pa_memblock_unref(u->buf2.memblock);
- if (u->buf3.memblock)
- pa_memblock_unref(u->buf3.memblock);
- if (u->buf4.memblock)
- pa_memblock_unref(u->buf4.memblock);
- pa_xfree(u);
-}
-
static void calc_map_table(pa_resampler *r) {
- struct impl_libsamplerate *u;
unsigned oc;
=
pa_assert(r);
- pa_assert(r->impl_data);
-
- u =3D r->impl_data;
-
- if (!(u->map_required =3D (r->i_ss.channels !=3D r->o_ss.channels || !=
pa_channel_map_equal(&r->i_cm, &r->o_cm))))
+
+ if (!(r->map_required =3D (r->i_ss.channels !=3D r->o_ss.channels || !=
pa_channel_map_equal(&r->i_cm, &r->o_cm))))
return;
=
for (oc =3D 0; oc < r->o_ss.channels; oc++) {
@@ -276,17 +375,16 @@
(a =3D=3D PA_CHANNEL_POSITION_LEFT && b =3D=3D PA_CHANNEL_=
POSITION_MONO) ||
(a =3D=3D PA_CHANNEL_POSITION_RIGHT && b =3D=3D PA_CHANNEL=
_POSITION_MONO))
=
- u->map_table[oc][i++] =3D ic;
+ r->map_table[oc][i++] =3D ic;
}
=
/* Add an end marker */
if (i < PA_CHANNELS_MAX)
- u->map_table[oc][i] =3D -1;
- }
-}
-
-static pa_memchunk* convert_to_float(pa_resampler *r, pa_memchunk *input) {
- struct impl_libsamplerate *u;
+ r->map_table[oc][i] =3D -1;
+ }
+}
+
+static pa_memchunk* convert_to_work_format(pa_resampler *r, pa_memchunk *i=
nput) {
unsigned n_samples;
void *src, *dst;
=
@@ -294,192 +392,193 @@
pa_assert(input);
pa_assert(input->memblock);
=
- pa_assert(r->impl_data);
- u =3D r->impl_data;
-
- /* Convert the incoming sample into floats and place them in buf1 */
-
- if (!u->to_float32ne_func || !input->length)
+ /* Convert the incoming sample into the work sample format and place t=
hem in buf1 */
+
+ if (!r->to_work_format_func || !input->length)
return input;
=
n_samples =3D (input->length / r->i_fz) * r->i_ss.channels;
=
- if (!u->buf1.memblock || u->buf1_samples < n_samples) {
- if (u->buf1.memblock)
- pa_memblock_unref(u->buf1.memblock);
-
- u->buf1_samples =3D n_samples;
- u->buf1.memblock =3D pa_memblock_new(r->mempool, u->buf1.length =
=3D sizeof(float) * n_samples);
- u->buf1.index =3D 0;
+ r->buf1.index =3D 0;
+ r->buf1.length =3D r->w_sz * n_samples;
+ =
+ if (!r->buf1.memblock || r->buf1_samples < n_samples) {
+ if (r->buf1.memblock)
+ pa_memblock_unref(r->buf1.memblock);
+
+ r->buf1_samples =3D n_samples;
+ r->buf1.memblock =3D pa_memblock_new(r->mempool, r->buf1.length);
}
=
src =3D (uint8_t*) pa_memblock_acquire(input->memblock) + input->index;
- dst =3D (uint8_t*) pa_memblock_acquire(u->buf1.memblock);
-
- u->to_float32ne_func(n_samples, src, dst);
+ dst =3D (uint8_t*) pa_memblock_acquire(r->buf1.memblock);
+
+ r->to_work_format_func(n_samples, src, dst);
=
pa_memblock_release(input->memblock);
- pa_memblock_release(u->buf1.memblock);
-
- u->buf1.length =3D sizeof(float) * n_samples;
-
- return &u->buf1;
+ pa_memblock_release(r->buf1.memblock);
+
+ return &r->buf1;
}
=
static pa_memchunk *remap_channels(pa_resampler *r, pa_memchunk *input) {
- struct impl_libsamplerate *u;
unsigned in_n_samples, out_n_samples, n_frames;
int i_skip, o_skip;
unsigned oc;
- float *src, *dst;
+ void *src, *dst;
=
pa_assert(r);
pa_assert(input);
pa_assert(input->memblock);
=
- pa_assert(r->impl_data);
- u =3D r->impl_data;
-
/* Remap channels and place the result int buf2 */
=
- if (!u->map_required || !input->length)
+ if (!r->map_required || !input->length)
return input;
=
- in_n_samples =3D input->length / sizeof(float);
+ in_n_samples =3D input->length / r->w_sz;
n_frames =3D in_n_samples / r->i_ss.channels;
out_n_samples =3D n_frames * r->o_ss.channels;
=
- if (!u->buf2.memblock || u->buf2_samples < out_n_samples) {
- if (u->buf2.memblock)
- pa_memblock_unref(u->buf2.memblock);
-
- u->buf2_samples =3D out_n_samples;
- u->buf2.memblock =3D pa_memblock_new(r->mempool, u->buf2.length =
=3D sizeof(float) * out_n_samples);
- u->buf2.index =3D 0;
- }
-
- src =3D (float*) ((uint8_t*) pa_memblock_acquire(input->memblock) + in=
put->index);
- dst =3D (float*) pa_memblock_acquire(u->buf2.memblock);
-
- memset(dst, 0, u->buf2.length);
-
- o_skip =3D sizeof(float) * r->o_ss.channels;
- i_skip =3D sizeof(float) * r->i_ss.channels;
-
- for (oc =3D 0; oc < r->o_ss.channels; oc++) {
- unsigned i;
- static const float one =3D 1.0;
-
- for (i =3D 0; i < PA_CHANNELS_MAX && u->map_table[oc][i] >=3D 0; i=
++)
- oil_vectoradd_f32(
- dst + oc, o_skip,
- dst + oc, o_skip,
- src + u->map_table[oc][i], i_skip,
- n_frames,
- &one, &one);
+ r->buf2.index =3D 0;
+ r->buf2.length =3D r->w_sz * out_n_samples;
+ =
+ if (!r->buf2.memblock || r->buf2_samples < out_n_samples) {
+ if (r->buf2.memblock)
+ pa_memblock_unref(r->buf2.memblock);
+
+ r->buf2_samples =3D out_n_samples;
+ r->buf2.memblock =3D pa_memblock_new(r->mempool, r->buf2.length);
+ }
+
+ src =3D ((uint8_t*) pa_memblock_acquire(input->memblock) + input->inde=
x);
+ dst =3D pa_memblock_acquire(r->buf2.memblock);
+
+ memset(dst, 0, r->buf2.length);
+
+ o_skip =3D r->w_sz * r->o_ss.channels;
+ i_skip =3D r->w_sz * r->i_ss.channels;
+
+ switch (r->work_format) {
+ case PA_SAMPLE_FLOAT32NE:
+ =
+ for (oc =3D 0; oc < r->o_ss.channels; oc++) {
+ unsigned i;
+ static const float one =3D 1.0;
+ =
+ for (i =3D 0; i < PA_CHANNELS_MAX && r->map_table[oc][i] >=
=3D 0; i++)
+ oil_vectoradd_f32(
+ (float*) dst + oc, o_skip,
+ (float*) dst + oc, o_skip,
+ (float*) src + r->map_table[oc][i], i_skip,
+ n_frames,
+ &one, &one);
+ }
+
+ break;
+
+ case PA_SAMPLE_S16NE:
+
+ for (oc =3D 0; oc < r->o_ss.channels; oc++) {
+ unsigned i;
+ static const int16_t one =3D 1;
+ =
+ for (i =3D 0; i < PA_CHANNELS_MAX && r->map_table[oc][i] >=
=3D 0; i++)
+ oil_vectoradd_s16(
+ (int16_t*) dst + oc, o_skip,
+ (int16_t*) dst + oc, o_skip,
+ (int16_t*) src + r->map_table[oc][i], i_skip,
+ n_frames,
+ &one, &one);
+ }
+
+ break;
+
+ default:
+ pa_assert_not_reached();
}
=
pa_memblock_release(input->memblock);
- pa_memblock_release(u->buf2.memblock);
-
- u->buf2.length =3D out_n_samples * sizeof(float);
-
- return &u->buf2;
+ pa_memblock_release(r->buf2.memblock);
+
+ r->buf2.length =3D out_n_samples * r->w_sz;
+
+ return &r->buf2;
}
=
static pa_memchunk *resample(pa_resampler *r, pa_memchunk *input) {
- struct impl_libsamplerate *u;
- SRC_DATA data;
unsigned in_n_frames, in_n_samples;
unsigned out_n_frames, out_n_samples;
- int ret;
=
pa_assert(r);
pa_assert(input);
- pa_assert(r->impl_data);
- u =3D r->impl_data;
=
/* Resample the data and place the result in buf3 */
=
- if (!u->src_state || !input->length)
+ if (!r->impl_resample || !input->length)
return input;
=
- in_n_samples =3D input->length / sizeof(float);
+ in_n_samples =3D input->length / r->w_sz;
in_n_frames =3D in_n_samples / r->o_ss.channels;
=
out_n_frames =3D ((in_n_frames*r->o_ss.rate)/r->i_ss.rate)+1024;
out_n_samples =3D out_n_frames * r->o_ss.channels;
=
- if (!u->buf3.memblock || u->buf3_samples < out_n_samples) {
- if (u->buf3.memblock)
- pa_memblock_unref(u->buf3.memblock);
-
- u->buf3_samples =3D out_n_samples;
- u->buf3.memblock =3D pa_memblock_new(r->mempool, u->buf3.length =
=3D sizeof(float) * out_n_samples);
- u->buf3.index =3D 0;
- }
-
- data.data_in =3D (float*) ((uint8_t*) pa_memblock_acquire(input->membl=
ock) + input->index);
- data.input_frames =3D in_n_frames;
-
- data.data_out =3D (float*) pa_memblock_acquire(u->buf3.memblock);
- data.output_frames =3D out_n_frames;
-
- data.src_ratio =3D (double) r->o_ss.rate / r->i_ss.rate;
- data.end_of_input =3D 0;
-
- ret =3D src_process(u->src_state, &data);
- pa_assert(ret =3D=3D 0);
- pa_assert((unsigned) data.input_frames_used =3D=3D in_n_frames);
-
- pa_memblock_release(input->memblock);
- pa_memblock_release(u->buf3.memblock);
-
- u->buf3.length =3D data.output_frames_gen * sizeof(float) * r->o_ss.ch=
annels;
-
- return &u->buf3;
-}
-
-static pa_memchunk *convert_from_float(pa_resampler *r, pa_memchunk *input=
) {
- struct impl_libsamplerate *u;
+ r->buf3.index =3D 0;
+ r->buf3.length =3D r->w_sz * out_n_samples;
+ =
+ if (!r->buf3.memblock || r->buf3_samples < out_n_samples) {
+ if (r->buf3.memblock)
+ pa_memblock_unref(r->buf3.memblock);
+
+ r->buf3_samples =3D out_n_samples;
+ r->buf3.memblock =3D pa_memblock_new(r->mempool, r->buf3.length);
+ }
+
+ r->impl_resample(r, input, in_n_frames, &r->buf3, &out_n_frames);
+ r->buf3.length =3D out_n_frames * r->w_sz * r->o_ss.channels;
+ =
+ return &r->buf3;
+}
+
+static pa_memchunk *convert_from_work_format(pa_resampler *r, pa_memchunk =
*input) {
unsigned n_samples, n_frames;
void *src, *dst;
=
pa_assert(r);
pa_assert(input);
- pa_assert(r->impl_data);
- u =3D r->impl_data;
=
/* Convert the data into the correct sample type and place the result =
in buf4 */
=
- if (!u->from_float32ne_func || !input->length)
+ if (!r->from_work_format_func || !input->length)
return input;
=
- n_frames =3D input->length / sizeof(float) / r->o_ss.channels;
- n_samples =3D n_frames * r->o_ss.channels;
-
- if (!u->buf4.memblock || u->buf4_samples < n_samples) {
- if (u->buf4.memblock)
- pa_memblock_unref(u->buf4.memblock);
-
- u->buf4_samples =3D n_samples;
- u->buf4.memblock =3D pa_memblock_new(r->mempool, u->buf4.length =
=3D r->o_fz * n_frames);
- u->buf4.index =3D 0;
+ n_samples =3D input->length / r->w_sz;
+ n_frames =3D n_samples / r->o_ss.channels;
+
+ r->buf4.index =3D 0;
+ r->buf4.length =3D r->o_fz * n_frames;
+ =
+ if (!r->buf4.memblock || r->buf4_samples < n_samples) {
+ if (r->buf4.memblock)
+ pa_memblock_unref(r->buf4.memblock);
+
+ r->buf4_samples =3D n_samples;
+ r->buf4.memblock =3D pa_memblock_new(r->mempool, r->buf4.length);
}
=
src =3D (uint8_t*) pa_memblock_acquire(input->memblock) + input->index;
- dst =3D pa_memblock_acquire(u->buf4.memblock);
- u->from_float32ne_func(n_samples, src, dst);
+ dst =3D pa_memblock_acquire(r->buf4.memblock);
+ r->from_work_format_func(n_samples, src, dst);
pa_memblock_release(input->memblock);
- pa_memblock_release(u->buf4.memblock);
-
- u->buf4.length =3D r->o_fz * n_frames;
-
- return &u->buf4;
-}
-
-static void libsamplerate_run(pa_resampler *r, const pa_memchunk *in, pa_m=
emchunk *out) {
- struct impl_libsamplerate *u;
+ pa_memblock_release(r->buf4.memblock);
+
+ r->buf4.length =3D r->o_fz * n_frames;
+
+ return &r->buf4;
+}
+
+void pa_resampler_run(pa_resampler *r, const pa_memchunk *in, pa_memchunk =
*out) {
pa_memchunk *buf;
=
pa_assert(r);
@@ -488,19 +587,16 @@
pa_assert(in->length);
pa_assert(in->memblock);
pa_assert(in->length % r->i_fz =3D=3D 0);
- pa_assert(r->impl_data);
-
- u =3D r->impl_data;
=
buf =3D (pa_memchunk*) in;
- buf =3D convert_to_float(r, buf);
+ buf =3D convert_to_work_format(r, buf);
buf =3D remap_channels(r, buf);
buf =3D resample(r, buf);
=
if (buf->length) {
- buf =3D convert_from_float(r, buf);
+ buf =3D convert_from_work_format(r, buf);
*out =3D *buf;
-
+ =
if (buf =3D=3D in)
pa_memblock_ref(buf->memblock);
else
@@ -509,188 +605,222 @@
pa_memchunk_reset(out);
}
=
-static void libsamplerate_update_input_rate(pa_resampler *r, uint32_t rate=
) {
- struct impl_libsamplerate *u;
-
- pa_assert(r);
- pa_assert(rate > 0);
- pa_assert(r->impl_data);
- u =3D r->impl_data;
-
- if (!u->src_state) {
- int err;
- u->src_state =3D src_new(r->resample_method, r->o_ss.channels, &er=
r);
- pa_assert(u->src_state);
+/*** libsamplerate based implementation ***/
+
+static void libsamplerate_resample(pa_resampler *r, const pa_memchunk *inp=
ut, unsigned in_n_frames, pa_memchunk *output, unsigned *out_n_frames) {
+ SRC_DATA data;
+ =
+ pa_assert(r);
+ pa_assert(input);
+ pa_assert(output);
+ pa_assert(out_n_frames);
+ =
+ memset(&data, 0, sizeof(data));
+ =
+ data.data_in =3D (float*) ((uint8_t*) pa_memblock_acquire(input->membl=
ock) + input->index);
+ data.input_frames =3D in_n_frames;
+
+ data.data_out =3D (float*) ((uint8_t*) pa_memblock_acquire(output->mem=
block) + output->index);
+ data.output_frames =3D *out_n_frames;
+
+ data.src_ratio =3D (double) r->o_ss.rate / r->i_ss.rate;
+ data.end_of_input =3D 0;
+
+ pa_assert_se(src_process(r->src.state, &data) =3D=3D 0);
+ pa_assert((unsigned) data.input_frames_used =3D=3D in_n_frames);
+
+ pa_memblock_release(input->memblock);
+ pa_memblock_release(output->memblock);
+
+ *out_n_frames =3D data.output_frames_gen;
+}
+
+static void libsamplerate_update_rates(pa_resampler *r) {
+ pa_assert(r);
+
+ pa_assert_se(src_set_ratio(r->src.state, (double) r->o_ss.rate / r->i_=
ss.rate) =3D=3D 0);
+}
+
+static void libsamplerate_free(pa_resampler *r) {
+ pa_assert(r);
+ =
+ if (r->src.state)
+ src_delete(r->src.state);
+}
+
+static int libsamplerate_init(pa_resampler *r) {
+ int err;
+ =
+ pa_assert(r);
+ =
+ if (!(r->src.state =3D src_new(r->resample_method, r->o_ss.channels, &=
err)))
+ return -1;
+
+ r->impl_free =3D libsamplerate_free;
+ r->impl_update_rates =3D libsamplerate_update_rates;
+ r->impl_resample =3D libsamplerate_resample;
+
+ return 0;
+}
+
+/*** speex based implementation ***/
+
+static void speex_resample_float(pa_resampler *r, const pa_memchunk *input=
, unsigned in_n_frames, pa_memchunk *output, unsigned *out_n_frames) {
+ float *in, *out;
+ uint32_t inf =3D in_n_frames, outf =3D *out_n_frames;
+
+ pa_assert(r);
+ pa_assert(input);
+ pa_assert(output);
+ pa_assert(out_n_frames);
+ =
+ in =3D (float*) ((uint8_t*) pa_memblock_acquire(input->memblock) + inp=
ut->index);
+ out =3D (float*) ((uint8_t*) pa_memblock_acquire(output->memblock) + o=
utput->index);
+
+ pa_assert_se(paspfl_resampler_process_interleaved_float(r->speex.state=
, in, &inf, out, &outf) =3D=3D 0);
+
+ pa_memblock_release(input->memblock);
+ pa_memblock_release(output->memblock);
+
+ pa_assert(inf =3D=3D in_n_frames);
+ *out_n_frames =3D outf;
+}
+
+static void speex_resample_int(pa_resampler *r, const pa_memchunk *input, =
unsigned in_n_frames, pa_memchunk *output, unsigned *out_n_frames) {
+ int16_t *in, *out;
+ uint32_t inf =3D in_n_frames, outf =3D *out_n_frames;
+
+ pa_assert(r);
+ pa_assert(input);
+ pa_assert(output);
+ pa_assert(out_n_frames);
+ =
+ in =3D (int16_t*) ((uint8_t*) pa_memblock_acquire(input->memblock) + i=
nput->index);
+ out =3D (int16_t*) ((uint8_t*) pa_memblock_acquire(output->memblock) +=
output->index);
+
+ pa_assert_se(paspfx_resampler_process_interleaved_int(r->speex.state, =
in, &inf, out, &outf) =3D=3D 0);
+
+ pa_memblock_release(input->memblock);
+ pa_memblock_release(output->memblock);
+
+ pa_assert(inf =3D=3D in_n_frames);
+ *out_n_frames =3D outf;
+}
+
+static void speex_update_rates(pa_resampler *r) {
+ pa_assert(r);
+
+ if (r->resample_method >=3D PA_RESAMPLER_SPEEX_FIXED_BASE && r->resamp=
le_method <=3D PA_RESAMPLER_SPEEX_FIXED_MAX) =
+ pa_assert_se(paspfx_resampler_set_rate(r->speex.state, r->i_ss.rat=
e, r->o_ss.rate) =3D=3D 0);
+ else {
+ pa_assert(r->resample_method >=3D PA_RESAMPLER_SPEEX_FLOAT_BASE &&=
r->resample_method <=3D PA_RESAMPLER_SPEEX_FLOAT_MAX);
+ pa_assert_se(paspfl_resampler_set_rate(r->speex.state, r->i_ss.rat=
e, r->o_ss.rate) =3D=3D 0);
+ }
+}
+
+static void speex_free(pa_resampler *r) {
+ pa_assert(r);
+ =
+ if (r->speex.state) {
+ if (r->resample_method >=3D PA_RESAMPLER_SPEEX_FIXED_BASE && r->re=
sample_method <=3D PA_RESAMPLER_SPEEX_FIXED_MAX) =
+ paspfx_resampler_destroy(r->speex.state);
+ else {
+ pa_assert(r->resample_method >=3D PA_RESAMPLER_SPEEX_FLOAT_BAS=
E && r->resample_method <=3D PA_RESAMPLER_SPEEX_FLOAT_MAX);
+ paspfl_resampler_destroy(r->speex.state);
+ }
+ }
+}
+
+static int speex_init(pa_resampler *r) {
+ int q, err;
+ =
+ pa_assert(r);
+
+ r->impl_free =3D speex_free;
+ r->impl_update_rates =3D speex_update_rates;
+ =
+ if (r->resample_method >=3D PA_RESAMPLER_SPEEX_FIXED_BASE && r->resamp=
le_method <=3D PA_RESAMPLER_SPEEX_FIXED_MAX) {
+ q =3D r->resample_method - PA_RESAMPLER_SPEEX_FIXED_BASE;
+ r->impl_resample =3D speex_resample_int;
+
+ if (!(r->speex.state =3D paspfx_resampler_init(r->o_ss.channels, r=
->i_ss.rate, r->o_ss.rate, q, &err)))
+ return -1;
+
} else {
- int ret =3D src_set_ratio(u->src_state, (double) r->o_ss.rate / ra=
te);
- pa_assert(ret =3D=3D 0);
- }
-}
-
-static void libsamplerate_update_output_rate(pa_resampler *r, uint32_t rat=
e) {
- struct impl_libsamplerate *u;
-
- pa_assert(r);
- pa_assert(rate > 0);
- pa_assert(r->impl_data);
- u =3D r->impl_data;
-
- if (!u->src_state) {
- int err;
- u->src_state =3D src_new(r->resample_method, r->o_ss.channels, &er=
r);
- pa_assert(u->src_state);
- } else {
- int ret =3D src_set_ratio(u->src_state, (double) rate / r->i_ss.ra=
te);
- pa_assert(ret =3D=3D 0);
- }
-}
-
-static int libsamplerate_init(pa_resampler *r) {
- struct impl_libsamplerate *u =3D NULL;
- int err;
-
- r->impl_data =3D u =3D pa_xnew(struct impl_libsamplerate, 1);
-
- pa_memchunk_reset(&u->buf1);
- pa_memchunk_reset(&u->buf2);
- pa_memchunk_reset(&u->buf3);
- pa_memchunk_reset(&u->buf4);
- u->buf1_samples =3D u->buf2_samples =3D u->buf3_samples =3D u->buf4_sa=
mples =3D 0;
-
- if (r->i_ss.format =3D=3D PA_SAMPLE_FLOAT32NE)
- u->to_float32ne_func =3D NULL;
- else if (!(u->to_float32ne_func =3D pa_get_convert_to_float32ne_functi=
on(r->i_ss.format)))
- goto fail;
-
- if (r->o_ss.format =3D=3D PA_SAMPLE_FLOAT32NE)
- u->from_float32ne_func =3D NULL;
- else if (!(u->from_float32ne_func =3D pa_get_convert_from_float32ne_fu=
nction(r->o_ss.format)))
- goto fail;
-
- if (r->o_ss.rate =3D=3D r->i_ss.rate)
- u->src_state =3D NULL;
- else if (!(u->src_state =3D src_new(r->resample_method, r->o_ss.channe=
ls, &err)))
- goto fail;
-
- r->impl_free =3D libsamplerate_free;
- r->impl_update_input_rate =3D libsamplerate_update_input_rate;
- r->impl_update_output_rate =3D libsamplerate_update_output_rate;
- r->impl_run =3D libsamplerate_run;
-
- calc_map_table(r);
+ pa_assert(r->resample_method >=3D PA_RESAMPLER_SPEEX_FLOAT_BASE &&=
r->resample_method <=3D PA_RESAMPLER_SPEEX_FLOAT_MAX);
+ q =3D r->resample_method - PA_RESAMPLER_SPEEX_FLOAT_BASE;
+ r->impl_resample =3D speex_resample_float;
+
+ if (!(r->speex.state =3D paspfl_resampler_init(r->o_ss.channels, r=
->i_ss.rate, r->o_ss.rate, q, &err)))
+ return -1;
+ }
+ =
=
return 0;
-
-fail:
- pa_xfree(u);
- return -1;
}
=
/* Trivial implementation */
=
-static void trivial_run(pa_resampler *r, const pa_memchunk *in, pa_memchun=
k *out) {
+static void trivial_resample(pa_resampler *r, const pa_memchunk *input, un=
signed in_n_frames, pa_memchunk *output, unsigned *out_n_frames) {
size_t fz;
- unsigned n_frames;
- struct impl_trivial *u;
-
- pa_assert(r);
- pa_assert(in);
- pa_assert(out);
- pa_assert(r->impl_data);
-
- u =3D r->impl_data;
-
- fz =3D r->i_fz;
- pa_assert(fz =3D=3D r->o_fz);
-
- n_frames =3D in->length/fz;
-
- if (r->i_ss.rate =3D=3D r->o_ss.rate) {
-
- /* In case there's no diefference in sample types, do nothing */
- *out =3D *in;
- pa_memblock_ref(out->memblock);
-
- u->o_counter +=3D n_frames;
- } else {
- /* Do real resampling */
- size_t l;
- unsigned o_index;
- void *src, *dst;
-
- /* The length of the new memory block rounded up */
- l =3D ((((n_frames+1) * r->o_ss.rate) / r->i_ss.rate) + 1) * fz;
-
- out->index =3D 0;
- out->memblock =3D pa_memblock_new(r->mempool, l);
-
- src =3D (uint8_t*) pa_memblock_acquire(in->memblock) + in->index;
- dst =3D pa_memblock_acquire(out->memblock);
-
- for (o_index =3D 0;; o_index++, u->o_counter++) {
- unsigned j;
-
- j =3D (u->o_counter * r->i_ss.rate / r->o_ss.rate);
- j =3D j > u->i_counter ? j - u->i_counter : 0;
-
- if (j >=3D n_frames)
- break;
-
- pa_assert(o_index*fz < pa_memblock_get_length(out->memblock));
-
- memcpy((uint8_t*) dst + fz*o_index,
- (uint8_t*) src + fz*j, fz);
-
- }
-
- pa_memblock_release(in->memblock);
- pa_memblock_release(out->memblock);
-
- out->length =3D o_index*fz;
- }
-
- u->i_counter +=3D n_frames;
+ unsigned o_index;
+ void *src, *dst;
+ =
+ pa_assert(r);
+ pa_assert(input);
+ pa_assert(output);
+ pa_assert(out_n_frames);
+
+ fz =3D r->w_sz * r->o_ss.channels;
+ =
+ src =3D (uint8_t*) pa_memblock_acquire(input->memblock) + input->index;
+ dst =3D (uint8_t*) pa_memblock_acquire(output->memblock) + output->ind=
ex;
+ =
+ for (o_index =3D 0;; o_index++, r->trivial.o_counter++) {
+ unsigned j;
+ =
+ j =3D ((r->trivial.o_counter * r->i_ss.rate) / r->o_ss.rate);
+ j =3D j > r->trivial.i_counter ? j - r->trivial.i_counter : 0;
+ =
+ if (j >=3D in_n_frames)
+ break;
+
+ pa_assert(o_index * fz < pa_memblock_get_length(output->memblock));
+ =
+ oil_memcpy((uint8_t*) dst + fz * o_index,
+ (uint8_t*) src + fz * j, fz); =
+ }
+ =
+ pa_memblock_release(input->memblock);
+ pa_memblock_release(output->memblock);
+ =
+ *out_n_frames =3D o_index;
+
+ r->trivial.i_counter +=3D in_n_frames;
=
/* Normalize counters */
- while (u->i_counter >=3D r->i_ss.rate) {
- u->i_counter -=3D r->i_ss.rate;
- pa_assert(u->o_counter >=3D r->o_ss.rate);
- u->o_counter -=3D r->o_ss.rate;
- }
-}
-
-static void trivial_free(pa_resampler *r) {
- pa_assert(r);
-
- pa_xfree(r->impl_data);
-}
-
-static void trivial_update_rate(pa_resampler *r, uint32_t rate) {
- struct impl_trivial *u;
-
- pa_assert(r);
- pa_assert(rate > 0);
- pa_assert(r->impl_data);
-
- u =3D r->impl_data;
- u->i_counter =3D 0;
- u->o_counter =3D 0;
+ while (r->trivial.i_counter >=3D r->i_ss.rate) {
+ pa_assert(r->trivial.o_counter >=3D r->o_ss.rate);
+
+ r->trivial.i_counter -=3D r->i_ss.rate;
+ r->trivial.o_counter -=3D r->o_ss.rate;
+ }
+}
+
+static void trivial_update_rates(pa_resampler *r) {
+ pa_assert(r);
+
+ r->trivial.i_counter =3D 0;
+ r->trivial.o_counter =3D 0;
}
=
static int trivial_init(pa_resampler*r) {
- struct impl_trivial *u;
-
- pa_assert(r);
- pa_assert(r->i_ss.format =3D=3D r->o_ss.format);
- pa_assert(r->i_ss.channels =3D=3D r->o_ss.channels);
-
- r->impl_data =3D u =3D pa_xnew(struct impl_trivial, 1);
- u->o_counter =3D u->i_counter =3D 0;
-
- r->impl_run =3D trivial_run;
- r->impl_free =3D trivial_free;
- r->impl_update_input_rate =3D trivial_update_rate;
- r->impl_update_output_rate =3D trivial_update_rate;
+ pa_assert(r);
+
+ r->trivial.o_counter =3D r->trivial.i_counter =3D 0;
+
+ r->impl_resample =3D trivial_resample;
+ r->impl_update_rates =3D trivial_update_rates;
=
return 0;
}
Modified: branches/lennart/src/pulsecore/resampler.h
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/=
resampler.h?rev=3D1712&root=3Dpulseaudio&r1=3D1711&r2=3D1712&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/pulsecore/resampler.h (original)
+++ branches/lennart/src/pulsecore/resampler.h Fri Aug 24 00:35:40 2007
@@ -41,6 +41,11 @@
PA_RESAMPLER_SRC_ZERO_ORDER_HOLD =3D SRC_ZERO_ORDER_HOLD,
PA_RESAMPLER_SRC_LINEAR =3D SRC_LINEAR,
PA_RESAMPLER_TRIVIAL,
+ PA_RESAMPLER_SPEEX_FLOAT_BASE,
+ PA_RESAMPLER_SPEEX_FLOAT_MAX =3D PA_RESAMPLER_SPEEX_FLOAT_BASE + 10,
+ PA_RESAMPLER_SPEEX_FIXED_BASE,
+ PA_RESAMPLER_SPEEX_FIXED_MAX =3D PA_RESAMPLER_SPEEX_FIXED_BASE + 10,
+ PA_RESAMPLER_AUTO, /* automatic select based on sample format */
PA_RESAMPLER_MAX
} pa_resample_method_t;
=
Modified: branches/lennart/src/pulsecore/sconv-s16be.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/=
sconv-s16be.c?rev=3D1712&root=3Dpulseaudio&r1=3D1711&r2=3D1712&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/pulsecore/sconv-s16be.c (original)
+++ branches/lennart/src/pulsecore/sconv-s16be.c Fri Aug 24 00:35:40 2007
@@ -33,6 +33,9 @@
#define pa_sconv_s16le_to_float32ne pa_sconv_s16be_to_float32ne
#define pa_sconv_s16le_from_float32ne pa_sconv_s16be_from_float32ne
=
+#define pa_sconv_s16le_to_float32re pa_sconv_s16be_to_float32re
+#define pa_sconv_s16le_from_float32re pa_sconv_s16be_from_float32re
+
#ifdef WORDS_BIGENDIAN
#define SWAP_WORDS 0
#else
Modified: branches/lennart/src/pulsecore/sconv-s16be.h
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/=
sconv-s16be.h?rev=3D1712&root=3Dpulseaudio&r1=3D1711&r2=3D1712&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/pulsecore/sconv-s16be.h (original)
+++ branches/lennart/src/pulsecore/sconv-s16be.h Fri Aug 24 00:35:40 2007
@@ -24,7 +24,18 @@
USA.
***/
=
-void pa_sconv_s16be_to_float32ne(unsigned n, const void *a, float *b);
-void pa_sconv_s16be_from_float32ne(unsigned n, const float *a, void *b);
+#include <inttypes.h>
+
+void pa_sconv_s16be_to_float32ne(unsigned n, const int16_t *a, float *b);
+void pa_sconv_s16be_from_float32ne(unsigned n, const float *a, int16_t *b);
+void pa_sconv_s16be_to_float32re(unsigned n, const int16_t *a, float *b);
+void pa_sconv_s16be_from_float32re(unsigned n, const float *a, int16_t *b);
+
+#ifdef WORDS_BIGENDIAN
+#define pa_sconv_float32be_to_s16ne pa_sconv_s16be_from_float32ne
+#define pa_sconv_float32be_from_s16ne pa_sconv_s16be_to_float32ne
+#define pa_sconv_float32le_to_s16ne pa_sconv_s16be_from_float32re
+#define pa_sconv_float32le_from_s16ne pa_sconv_s16be_to_float32re
+#endif
=
#endif
Modified: branches/lennart/src/pulsecore/sconv-s16le.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/=
sconv-s16le.c?rev=3D1712&root=3Dpulseaudio&r1=3D1711&r2=3D1712&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/pulsecore/sconv-s16le.c (original)
+++ branches/lennart/src/pulsecore/sconv-s16le.c Fri Aug 24 00:35:40 2007
@@ -25,12 +25,12 @@
#include <config.h>
#endif
=
-#include <assert.h>
#include <inttypes.h>
=
#include <liboil/liboilfuncs.h>
=
#include <pulsecore/sconv.h>
+#include <pulsecore/macro.h>
#include <pulsecore/log.h>
=
#include "endianmacros.h"
@@ -53,32 +53,28 @@
#endif
#endif
=
-void pa_sconv_s16le_to_float32ne(unsigned n, const void *a, float *b) {
- const int16_t *ca =3D a;
-
- assert(a);
- assert(b);
+void pa_sconv_s16le_to_float32ne(unsigned n, const int16_t *a, float *b) {
+ pa_assert(a);
+ pa_assert(b);
=
#if SWAP_WORDS =3D=3D 1
=
for (; n > 0; n--) {
- int16_t s =3D *(ca++);
+ int16_t s =3D *(a++);
*(b++) =3D ((float) INT16_FROM(s))/0x7FFF;
}
=
#else
{
static const double add =3D 0, factor =3D 1.0/0x7FFF;
- oil_scaleconv_f32_s16(b, ca, n, &add, &factor);
+ oil_scaleconv_f32_s16(b, a, n, &add, &factor);
}
#endif
}
=
-void pa_sconv_s16le_from_float32ne(unsigned n, const float *a, void *b) {
- int16_t *cb =3D b;
-
- assert(a);
- assert(b);
+void pa_sconv_s16le_from_float32ne(unsigned n, const float *a, int16_t *b)=
{
+ pa_assert(a);
+ pa_assert(b);
=
#if SWAP_WORDS =3D=3D 1
=
@@ -93,13 +89,55 @@
v =3D -1;
=
s =3D (int16_t) (v * 0x7FFF);
- *(cb++) =3D INT16_TO(s);
+ *(b++) =3D INT16_TO(s);
}
=
#else
{
static const double add =3D 0, factor =3D 0x7FFF;
- oil_scaleconv_s16_f32(cb, a, n, &add, &factor);
+ oil_scaleconv_s16_f32(b, a, n, &add, &factor);
}
#endif
}
+
+void pa_sconv_s16le_to_float32re(unsigned n, const int16_t *a, float *b) {
+ pa_assert(a);
+ pa_assert(b);
+
+#if SWAP_WORDS =3D=3D 1
+
+ for (; n > 0; n--) {
+ int16_t s =3D *(a++);
+ float k =3D ((float) INT16_FROM(s))/0x7FFF;
+ uint32_t *j =3D (uint32_t*) &k;
+ *j =3D UINT32_SWAP(*j);
+ *(b++) =3D k;
+ }
+
+#endif
+}
+
+void pa_sconv_s16le_from_float32re(unsigned n, const float *a, int16_t *b)=
{
+ pa_assert(a);
+ pa_assert(b);
+
+#if SWAP_WORDS =3D=3D 1
+
+ for (; n > 0; n--) {
+ int16_t s;
+ float v =3D *(a++);
+ uint32_t *j =3D (uint32_t*) &v;
+ *j =3D UINT32_SWAP(*j);
+
+ if (v > 1)
+ v =3D 1;
+
+ if (v < -1)
+ v =3D -1;
+
+ s =3D (int16_t) (v * 0x7FFF);
+ *(b++) =3D INT16_TO(s);
+ }
+
+#endif
+}
Modified: branches/lennart/src/pulsecore/sconv-s16le.h
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/=
sconv-s16le.h?rev=3D1712&root=3Dpulseaudio&r1=3D1711&r2=3D1712&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/pulsecore/sconv-s16le.h (original)
+++ branches/lennart/src/pulsecore/sconv-s16le.h Fri Aug 24 00:35:40 2007
@@ -24,7 +24,18 @@
USA.
***/
=
-void pa_sconv_s16le_to_float32ne(unsigned n, const void *a, float *b);
-void pa_sconv_s16le_from_float32ne(unsigned n, const float *a, void *b);
+#include <inttypes.h>
+
+void pa_sconv_s16le_to_float32ne(unsigned n, const int16_t *a, float *b);
+void pa_sconv_s16le_from_float32ne(unsigned n, const float *a, int16_t *b);
+void pa_sconv_s16le_to_float32re(unsigned n, const int16_t *a, float *b);
+void pa_sconv_s16le_from_float32re(unsigned n, const float *a, int16_t *b);
+
+#ifndef WORDS_BIGENDIAN
+#define pa_sconv_float32be_to_s16ne pa_sconv_s16le_from_float32re
+#define pa_sconv_float32be_from_s16ne pa_sconv_s16le_to_float32re
+#define pa_sconv_float32le_to_s16ne pa_sconv_s16le_from_float32ne
+#define pa_sconv_float32le_from_s16ne pa_sconv_s16le_to_float32ne
+#endif
=
#endif
Modified: branches/lennart/src/pulsecore/sconv.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/=
sconv.c?rev=3D1712&root=3Dpulseaudio&r1=3D1711&r2=3D1712&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/pulsecore/sconv.c (original)
+++ branches/lennart/src/pulsecore/sconv.c Fri Aug 24 00:35:40 2007
@@ -28,12 +28,12 @@
=
#include <stdio.h>
#include <stdlib.h>
-#include <assert.h>
=
#include <liboil/liboilfuncs.h>
#include <liboil/liboil.h>
=
#include <pulsecore/g711.h>
+#include <pulsecore/macro.h>
=
#include "endianmacros.h"
#include "sconv-s16le.h"
@@ -41,71 +41,92 @@
=
#include "sconv.h"
=
-static void u8_to_float32ne(unsigned n, const void *a, float *b) {
- const uint8_t *ca =3D a;
+/* u8 */
+static void u8_to_float32ne(unsigned n, const uint8_t *a, float *b) {
static const double add =3D -128.0/127.0, factor =3D 1.0/127.0;
=
- assert(a);
- assert(b);
-
- oil_scaleconv_f32_u8(b, ca, n, &add, &factor);
-}
-
-static void u8_from_float32ne(unsigned n, const float *a, void *b) {
- uint8_t *cb =3D b;
+ pa_assert(a);
+ pa_assert(b);
+
+ oil_scaleconv_f32_u8(b, a, n, &add, &factor);
+}
+
+static void u8_from_float32ne(unsigned n, const float *a, uint8_t *b) {
static const double add =3D 128.0, factor =3D 127.0;
=
- assert(a);
- assert(b);
-
- oil_scaleconv_u8_f32(cb, a, n, &add, &factor);
-}
-
-static void float32ne_to_float32ne(unsigned n, const void *a, float *b) {
- assert(a);
- assert(b);
+ pa_assert(a);
+ pa_assert(b);
+
+ oil_scaleconv_u8_f32(b, a, n, &add, &factor);
+}
+
+static void u8_to_s16ne(unsigned n, const uint8_t *a, int16_t *b) {
+ static const int16_t add =3D -128, factor =3D 0x100;
+
+ pa_assert(a);
+ pa_assert(b);
+
+ oil_conv_s16_u8(b, 2, a, 1, n);
+ oil_scalaradd_s16(b, 2, b, 2, &add, n);
+ oil_scalarmult_s16(b, 2, b, 2, &factor, n);
+}
+
+static void u8_from_s16ne(unsigned n, const int16_t *a, uint8_t *b) {
+
+ pa_assert(a);
+ pa_assert(b);
+ =
+ for (; n > 0; n--, a ++, a++)
+ *b =3D (uint8_t) (*a / 0x100 + 0x80);
+}
+
+/* float32 */
+
+static void float32ne_to_float32ne(unsigned n, const float *a, float *b) {
+ pa_assert(a);
+ pa_assert(b);
=
oil_memcpy(b, a, sizeof(float) * n);
}
=
-static void float32ne_from_float32ne(unsigned n, const float *a, void *b) {
- assert(a);
- assert(b);
-
- oil_memcpy(b, a, sizeof(float) * n);
-}
-
-static void float32re_to_float32ne(unsigned n, const void *a, float *b) {
- assert(a);
- assert(b);
-
- while (n-- > 0)
- ((uint32_t *)b)[n] =3D UINT32_SWAP (((uint32_t *)a)[n]);
-}
-
-static void float32re_from_float32ne(unsigned n, const float *a, void *b) {
- assert(a);
- assert(b);
-
- while (n-- > 0)
- ((uint32_t *)b)[n] =3D UINT32_SWAP (((uint32_t *)a)[n]);
-}
-
-static void ulaw_to_float32ne(unsigned n, const void *a, float *b) {
- const uint8_t *ca =3D a;
-
- assert(a);
- assert(b);
+static void float32re_to_float32ne(unsigned n, const float *a, float *b) {
+ pa_assert(a);
+ pa_assert(b);
+
+ for (; n > 0; n--, a++, b++)
+ *((uint32_t *) b) =3D UINT32_SWAP(*((uint32_t *) a));
+}
+
+/* s16 */
+
+static void s16ne_to_s16ne(unsigned n, const int16_t *a, int16_t *b) {
+ pa_assert(a);
+ pa_assert(b);
+
+ oil_memcpy(b, a, sizeof(int16_t) * n);
+}
+
+static void s16re_to_s16ne(unsigned n, const int16_t *a, int16_t *b) {
+ pa_assert(a);
+ pa_assert(b);
+
+ for (; n > 0; n--, a++, b++)
+ *b =3D UINT16_SWAP(*a);
+}
+
+/* ulaw */
+
+static void ulaw_to_float32ne(unsigned n, const uint8_t *a, float *b) {
+ pa_assert(a);
+ pa_assert(b);
=
for (; n > 0; n--)
- *(b++) =3D st_ulaw2linear16(*(ca++)) * 1.0F / 0x7FFF;
-}
-
-static void ulaw_from_float32ne(unsigned n, const float *a, void *b) {
- uint8_t *cb =3D b;
-
- assert(a);
- assert(b);
+ *(b++) =3D st_ulaw2linear16(*(a++)) * 1.0F / 0x7FFF;
+}
+
+static void ulaw_from_float32ne(unsigned n, const float *a, uint8_t *b) {
+ pa_assert(a);
+ pa_assert(b);
=
for (; n > 0; n--) {
float v =3D *(a++);
@@ -116,28 +137,42 @@
if (v < -1)
v =3D -1;
=
- *(cb++) =3D st_14linear2ulaw((int16_t) (v * 0x1FFF));
+ *(b++) =3D st_14linear2ulaw((int16_t) (v * 0x1FFF));
}
}
=
-static void alaw_to_float32ne(unsigned n, const void *a, float *b) {
- const uint8_t *ca =3D a;
-
- assert(a);
- assert(b);
-
- for (; n > 0; n--)
- *(b++) =3D st_alaw2linear16(*(ca++)) * 1.0F / 0x7FFF;
-}
-
-static void alaw_from_float32ne(unsigned n, const float *a, void *b) {
- uint8_t *cb =3D b;
-
- assert(a);
- assert(b);
-
- for (; n > 0; n--) {
- float v =3D *(a++);
+static void ulaw_to_s16ne(unsigned n, const uint8_t *a, int16_t *b) {
+ pa_assert(a);
+ pa_assert(b);
+
+ for (; n > 0; n--, a++, b++)
+ *b =3D st_ulaw2linear16(*a);
+}
+
+static void ulaw_from_s16ne(unsigned n, const int16_t *a, uint8_t *b) {
+ pa_assert(a);
+ pa_assert(b);
+
+ for (; n > 0; n--, a++, b++)
+ *b =3D st_14linear2ulaw(*a >> 2);
+}
+
+/* alaw */
+
+static void alaw_to_float32ne(unsigned n, const uint8_t *a, float *b) {
+ pa_assert(a);
+ pa_assert(b);
+
+ for (; n > 0; n--, a++, b++)
+ *b =3D st_alaw2linear16(*a) * 1.0F / 0x7FFF;
+}
+
+static void alaw_from_float32ne(unsigned n, const float *a, uint8_t *b) {
+ pa_assert(a);
+ pa_assert(b);
+
+ for (; n > 0; n--, a++, b++) {
+ float v =3D *a;
=
if (v > 1)
v =3D 1;
@@ -145,48 +180,94 @@
if (v < -1)
v =3D -1;
=
- *(cb++) =3D st_13linear2alaw((int16_t) (v * 0xFFF));
+ *b =3D st_13linear2alaw((int16_t) (v * 0xFFF));
}
}
=
-pa_convert_to_float32ne_func_t pa_get_convert_to_float32ne_function(pa_sam=
ple_format_t f) {
- switch(f) {
- case PA_SAMPLE_U8:
- return u8_to_float32ne;
- case PA_SAMPLE_S16LE:
- return pa_sconv_s16le_to_float32ne;
- case PA_SAMPLE_S16BE:
- return pa_sconv_s16be_to_float32ne;
- case PA_SAMPLE_FLOAT32NE:
- return float32ne_to_float32ne;
- case PA_SAMPLE_FLOAT32RE:
- return float32re_to_float32ne;
- case PA_SAMPLE_ALAW:
- return alaw_to_float32ne;
- case PA_SAMPLE_ULAW:
- return ulaw_to_float32ne;
- default:
- return NULL;
- }
-}
-
-pa_convert_from_float32ne_func_t pa_get_convert_from_float32ne_function(pa=
_sample_format_t f) {
- switch(f) {
- case PA_SAMPLE_U8:
- return u8_from_float32ne;
- case PA_SAMPLE_S16LE:
- return pa_sconv_s16le_from_float32ne;
- case PA_SAMPLE_S16BE:
- return pa_sconv_s16be_from_float32ne;
- case PA_SAMPLE_FLOAT32NE:
- return float32ne_from_float32ne;
- case PA_SAMPLE_FLOAT32RE:
- return float32re_from_float32ne;
- case PA_SAMPLE_ALAW:
- return alaw_from_float32ne;
- case PA_SAMPLE_ULAW:
- return ulaw_from_float32ne;
- default:
- return NULL;
- }
-}
+static void alaw_to_s16ne(unsigned n, const int8_t *a, int16_t *b) {
+ pa_assert(a);
+ pa_assert(b);
+
+ for (; n > 0; n--, a++, b++)
+ *b =3D st_alaw2linear16(*a);
+}
+
+static void alaw_from_s16ne(unsigned n, const int16_t *a, uint8_t *b) {
+ pa_assert(a);
+ pa_assert(b);
+
+ for (; n > 0; n--)
+ *b =3D st_13linear2alaw(*a >> 3);
+}
+
+pa_convert_func_t pa_get_convert_to_float32ne_function(pa_sample_format_t =
f) {
+
+ static const pa_convert_func_t table[] =3D {
+ [PA_SAMPLE_U8] =3D (pa_convert_func_t) u8_to_float32ne,
+ [PA_SAMPLE_ALAW] =3D (pa_convert_func_t) alaw_to_float32ne,
+ [PA_SAMPLE_ULAW] =3D (pa_convert_func_t) ulaw_to_float32ne,
+ [PA_SAMPLE_S16LE] =3D (pa_convert_func_t) pa_sconv_s16le_to_fl=
oat32ne,
+ [PA_SAMPLE_S16BE] =3D (pa_convert_func_t) pa_sconv_s16be_to_fl=
oat32ne,
+ [PA_SAMPLE_FLOAT32NE] =3D (pa_convert_func_t) float32ne_to_float32=
ne,
+ [PA_SAMPLE_FLOAT32RE] =3D (pa_convert_func_t) float32re_to_float32=
ne,
+ };
+
+ pa_assert(f >=3D 0);
+ pa_assert(f < PA_SAMPLE_MAX);
+
+ return table[f];
+}
+
+pa_convert_func_t pa_get_convert_from_float32ne_function(pa_sample_format_=
t f) {
+
+ static const pa_convert_func_t table[] =3D {
+ [PA_SAMPLE_U8] =3D (pa_convert_func_t) u8_from_float32ne,
+ [PA_SAMPLE_S16LE] =3D (pa_convert_func_t) pa_sconv_s16le_from_=
float32ne,
+ [PA_SAMPLE_S16BE] =3D (pa_convert_func_t) pa_sconv_s16be_from_=
float32ne,
+ [PA_SAMPLE_FLOAT32NE] =3D (pa_convert_func_t) float32ne_to_float32=
ne,
+ [PA_SAMPLE_FLOAT32RE] =3D (pa_convert_func_t) float32re_to_float32=
ne,
+ [PA_SAMPLE_ALAW] =3D (pa_convert_func_t) alaw_from_float32ne,
+ [PA_SAMPLE_ULAW] =3D (pa_convert_func_t) ulaw_from_float32ne
+ };
+
+ pa_assert(f >=3D 0);
+ pa_assert(f < PA_SAMPLE_MAX);
+
+ return table[f];
+}
+
+pa_convert_func_t pa_get_convert_to_s16ne_function(pa_sample_format_t f) {
+
+ static const pa_convert_func_t table[] =3D {
+ [PA_SAMPLE_U8] =3D (pa_convert_func_t) u8_to_s16ne,
+ [PA_SAMPLE_S16NE] =3D (pa_convert_func_t) s16ne_to_s16ne,
+ [PA_SAMPLE_S16RE] =3D (pa_convert_func_t) s16re_to_s16ne,
+ [PA_SAMPLE_FLOAT32BE] =3D (pa_convert_func_t) pa_sconv_float32be_t=
o_s16ne,
+ [PA_SAMPLE_FLOAT32LE] =3D (pa_convert_func_t) pa_sconv_float32le_t=
o_s16ne,
+ [PA_SAMPLE_ALAW] =3D (pa_convert_func_t) alaw_to_s16ne,
+ [PA_SAMPLE_ULAW] =3D (pa_convert_func_t) ulaw_to_s16ne
+ };
+
+ pa_assert(f >=3D 0);
+ pa_assert(f < PA_SAMPLE_MAX);
+
+ return table[f];
+}
+
+pa_convert_func_t pa_get_convert_from_s16ne_function(pa_sample_format_t f)=
{
+
+ static const pa_convert_func_t table[] =3D {
+ [PA_SAMPLE_U8] =3D (pa_convert_func_t) u8_from_s16ne,
+ [PA_SAMPLE_S16NE] =3D (pa_convert_func_t) s16ne_to_s16ne,
+ [PA_SAMPLE_S16RE] =3D (pa_convert_func_t) s16re_to_s16ne,
+ [PA_SAMPLE_FLOAT32BE] =3D (pa_convert_func_t) pa_sconv_float32be_f=
rom_s16ne,
+ [PA_SAMPLE_FLOAT32LE] =3D (pa_convert_func_t) pa_sconv_float32le_f=
rom_s16ne,
+ [PA_SAMPLE_ALAW] =3D (pa_convert_func_t) alaw_from_s16ne,
+ [PA_SAMPLE_ULAW] =3D (pa_convert_func_t) ulaw_from_s16ne,
+ };
+
+ pa_assert(f >=3D 0);
+ pa_assert(f < PA_SAMPLE_MAX);
+
+ return table[f];
+}
Modified: branches/lennart/src/pulsecore/sconv.h
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/=
sconv.h?rev=3D1712&root=3Dpulseaudio&r1=3D1711&r2=3D1712&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/pulsecore/sconv.h (original)
+++ branches/lennart/src/pulsecore/sconv.h Fri Aug 24 00:35:40 2007
@@ -27,10 +27,12 @@
=
#include <pulse/sample.h>
=
-typedef void (*pa_convert_to_float32ne_func_t)(unsigned n, const void *a, =
float *b);
-typedef void (*pa_convert_from_float32ne_func_t)(unsigned n, const float *=
a, void *b);
+typedef void (*pa_convert_func_t)(unsigned n, const void *a, void *b);
=
-pa_convert_to_float32ne_func_t pa_get_convert_to_float32ne_function(pa_sam=
ple_format_t f);
-pa_convert_from_float32ne_func_t pa_get_convert_from_float32ne_function(pa=
_sample_format_t f);
+pa_convert_func_t pa_get_convert_to_float32ne_function(pa_sample_format_t =
f);
+pa_convert_func_t pa_get_convert_from_float32ne_function(pa_sample_format_=
t f);
+
+pa_convert_func_t pa_get_convert_to_s16ne_function(pa_sample_format_t f);
+pa_convert_func_t pa_get_convert_from_s16ne_function(pa_sample_format_t f);
=
#endif
More information about the pulseaudio-commits
mailing list