aboutsummaryrefslogtreecommitdiffstats
path: root/libswresample/arm
diff options
context:
space:
mode:
authorMans Rullgard <mans@mansr.com>2012-09-10 15:47:00 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-09-24 23:16:14 +0200
commit5dc73634469dc54e109fe0fd9f3fc0c24409e548 (patch)
treec86420f7d09ae12d6fed70157604bfc1328b7910 /libswresample/arm
parent0eebde07a99f14cf5f96bd64e705db45b6de6364 (diff)
downloadffmpeg-5dc73634469dc54e109fe0fd9f3fc0c24409e548.tar.gz
ARM: libswresample: NEON optimised stereo fltp to s16 conversion
Adaption to swr by: Michael Niedermayer <michaelni@gmx.at> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libswresample/arm')
-rw-r--r--libswresample/arm/audio_convert_init.c8
-rw-r--r--libswresample/arm/audio_convert_neon.S64
2 files changed, 72 insertions, 0 deletions
diff --git a/libswresample/arm/audio_convert_init.c b/libswresample/arm/audio_convert_init.c
index f8f80078a7..a52ea5a196 100644
--- a/libswresample/arm/audio_convert_init.c
+++ b/libswresample/arm/audio_convert_init.c
@@ -27,11 +27,17 @@
#include "libswresample/audioconvert.h"
void swri_oldapi_conv_flt_to_s16_neon(int16_t *dst, const float *src, int len);
+void swri_oldapi_conv_fltp_to_s16_2ch_neon(int16_t *dst, float *const *src, int len, int channels);
static void conv_flt_to_s16_neon(uint8_t **dst, const uint8_t **src, int len){
swri_oldapi_conv_flt_to_s16_neon((int16_t*)*dst, (const float*)*src, len);
}
+static void conv_fltp_to_s16_2ch_neon(uint8_t **dst, const uint8_t **src, int len){
+ swri_oldapi_conv_fltp_to_s16_2ch_neon((int16_t*)*dst, (float *const*)src, len, 2);
+}
+
+
av_cold void swri_audio_convert_init_arm(struct AudioConvert *ac,
enum AVSampleFormat out_fmt,
enum AVSampleFormat in_fmt,
@@ -44,5 +50,7 @@ av_cold void swri_audio_convert_init_arm(struct AudioConvert *ac,
if (have_neon(cpu_flags)) {
if(out_fmt == AV_SAMPLE_FMT_S16 && in_fmt == AV_SAMPLE_FMT_FLT || out_fmt == AV_SAMPLE_FMT_S16P && in_fmt == AV_SAMPLE_FMT_FLTP)
ac->simd_f = conv_flt_to_s16_neon;
+ if(out_fmt == AV_SAMPLE_FMT_S16 && in_fmt == AV_SAMPLE_FMT_FLTP && channels == 2)
+ ac->simd_f = conv_fltp_to_s16_2ch_neon;
}
}
diff --git a/libswresample/arm/audio_convert_neon.S b/libswresample/arm/audio_convert_neon.S
index e174a7730f..f6099dac93 100644
--- a/libswresample/arm/audio_convert_neon.S
+++ b/libswresample/arm/audio_convert_neon.S
@@ -64,3 +64,67 @@ function swri_oldapi_conv_flt_to_s16_neon, export=1
vst1.16 {q2}, [r0,:128]!
bx lr
endfunc
+
+function swri_oldapi_conv_fltp_to_s16_2ch_neon, export=1
+ ldm r1, {r1, r3}
+ subs r2, r2, #8
+ vld1.32 {q0}, [r1,:128]!
+ vcvt.s32.f32 q8, q0, #31
+ vld1.32 {q1}, [r1,:128]!
+ vcvt.s32.f32 q9, q1, #31
+ vld1.32 {q10}, [r3,:128]!
+ vcvt.s32.f32 q10, q10, #31
+ vld1.32 {q11}, [r3,:128]!
+ vcvt.s32.f32 q11, q11, #31
+ beq 3f
+ bics r12, r2, #15
+ beq 2f
+1: subs r12, r12, #16
+ vld1.32 {q0}, [r1,:128]!
+ vcvt.s32.f32 q0, q0, #31
+ vsri.32 q10, q8, #16
+ vld1.32 {q1}, [r1,:128]!
+ vcvt.s32.f32 q1, q1, #31
+ vld1.32 {q12}, [r3,:128]!
+ vcvt.s32.f32 q12, q12, #31
+ vld1.32 {q13}, [r3,:128]!
+ vsri.32 q11, q9, #16
+ vst1.16 {q10}, [r0,:128]!
+ vcvt.s32.f32 q13, q13, #31
+ vst1.16 {q11}, [r0,:128]!
+ vsri.32 q12, q0, #16
+ vld1.32 {q8}, [r1,:128]!
+ vsri.32 q13, q1, #16
+ vst1.16 {q12}, [r0,:128]!
+ vcvt.s32.f32 q8, q8, #31
+ vld1.32 {q9}, [r1,:128]!
+ vcvt.s32.f32 q9, q9, #31
+ vld1.32 {q10}, [r3,:128]!
+ vcvt.s32.f32 q10, q10, #31
+ vld1.32 {q11}, [r3,:128]!
+ vcvt.s32.f32 q11, q11, #31
+ vst1.16 {q13}, [r0,:128]!
+ bne 1b
+ ands r2, r2, #15
+ beq 3f
+2: vsri.32 q10, q8, #16
+ vld1.32 {q0}, [r1,:128]!
+ vcvt.s32.f32 q0, q0, #31
+ vld1.32 {q1}, [r1,:128]!
+ vcvt.s32.f32 q1, q1, #31
+ vld1.32 {q12}, [r3,:128]!
+ vcvt.s32.f32 q12, q12, #31
+ vsri.32 q11, q9, #16
+ vld1.32 {q13}, [r3,:128]!
+ vcvt.s32.f32 q13, q13, #31
+ vst1.16 {q10}, [r0,:128]!
+ vsri.32 q12, q0, #16
+ vst1.16 {q11}, [r0,:128]!
+ vsri.32 q13, q1, #16
+ vst1.16 {q12-q13},[r0,:128]!
+ bx lr
+3: vsri.32 q10, q8, #16
+ vsri.32 q11, q9, #16
+ vst1.16 {q10-q11},[r0,:128]!
+ bx lr
+endfunc