[pulseaudio-discuss] [PATCH] sconv: Use optimized conversion function for both directions
Peter Meerwald
pmeerw at pmeerw.net
Mon Aug 4 09:20:05 PDT 2014
From: Peter Meerwald <p.meerwald at bct-electronic.com>
for example, the conversion function for
convert_from_float32ne(PA_SAMPLE_S16LE) can also be used for
convert_to_s16ne(PA_SAMPLE_FLOAT32LE)
v2: ARM can potentially be big- or little endian; only apply
optimization on LE based on WORDS_BIGENDIAN #define (thanks, Tanu)
Signed-off-by: Peter Meerwald <pmeerw at pmeerw.net>
---
src/pulsecore/sconv_neon.c | 4 ++++
src/pulsecore/sconv_sse.c | 3 ++-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/pulsecore/sconv_neon.c b/src/pulsecore/sconv_neon.c
index 6c2a2b3..11d94d2 100644
--- a/src/pulsecore/sconv_neon.c
+++ b/src/pulsecore/sconv_neon.c
@@ -89,4 +89,8 @@ void pa_convert_func_init_neon(pa_cpu_arm_flag_t flags) {
pa_log_info("Initialising ARM NEON optimized conversions.");
pa_set_convert_from_float32ne_function(PA_SAMPLE_S16LE, (pa_convert_func_t) pa_sconv_s16le_from_f32ne_neon);
pa_set_convert_to_float32ne_function(PA_SAMPLE_S16LE, (pa_convert_func_t) pa_sconv_s16le_to_f32ne_neon);
+#ifndef WORDS_BIGENDIAN
+ pa_set_convert_from_s16ne_function(PA_SAMPLE_FLOAT32LE, (pa_convert_func_t) pa_sconv_s16le_to_f32ne_neon);
+ pa_set_convert_to_s16ne_function(PA_SAMPLE_FLOAT32LE, (pa_convert_func_t) pa_sconv_s16le_from_f32ne_neon);
+#endif
}
diff --git a/src/pulsecore/sconv_sse.c b/src/pulsecore/sconv_sse.c
index 10943ba..9cfb9d9 100644
--- a/src/pulsecore/sconv_sse.c
+++ b/src/pulsecore/sconv_sse.c
@@ -168,10 +168,11 @@ void pa_convert_func_init_sse(pa_cpu_x86_flag_t flags) {
if (flags & PA_CPU_X86_SSE2) {
pa_log_info("Initialising SSE2 optimized conversions.");
pa_set_convert_from_float32ne_function(PA_SAMPLE_S16LE, (pa_convert_func_t) pa_sconv_s16le_from_f32ne_sse2);
-
+ pa_set_convert_to_s16ne_function(PA_SAMPLE_FLOAT32LE, (pa_convert_func_t) pa_sconv_s16le_from_f32ne_sse2);
} else if (flags & PA_CPU_X86_SSE) {
pa_log_info("Initialising SSE optimized conversions.");
pa_set_convert_from_float32ne_function(PA_SAMPLE_S16LE, (pa_convert_func_t) pa_sconv_s16le_from_f32ne_sse);
+ pa_set_convert_to_s16ne_function(PA_SAMPLE_FLOAT32LE, (pa_convert_func_t) pa_sconv_s16le_from_f32ne_sse);
}
#endif /* defined (__i386__) || defined (__amd64__) */
--
1.7.9.5
More information about the pulseaudio-discuss
mailing list