mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-09 13:29:59 -05:00
sconv: avoid multiply in ARM NEON float->s16 conversion
optimization idea taken from libavresample Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
This commit is contained in:
parent
0e8d26a6a1
commit
40c3c117e7
1 changed files with 3 additions and 6 deletions
|
|
@ -36,12 +36,9 @@ static void pa_sconv_s16le_from_f32ne_neon(unsigned n, const float *src, int16_t
|
||||||
"movs %[n], %[n], lsr #2 \n\t"
|
"movs %[n], %[n], lsr #2 \n\t"
|
||||||
"beq 2f \n\t"
|
"beq 2f \n\t"
|
||||||
|
|
||||||
"vdup.f32 q1, %[scale] \n\t"
|
|
||||||
|
|
||||||
"1: \n\t"
|
"1: \n\t"
|
||||||
"vld1.32 {q0}, [%[src]]! \n\t"
|
"vld1.32 {q0}, [%[src]]! \n\t"
|
||||||
"vmul.f32 q0, q0, q1 \n\t" /* scale */
|
"vcvt.s32.f32 q0, q0, #31 \n\t" /* s32<-f32 as 16:16 fixed-point, with implicit multiplication by 32768 */
|
||||||
"vcvt.s32.f32 q0, q0, #16 \n\t" /* s32<-f32 as 16:16 fixed-point */
|
|
||||||
"vqrshrn.s32 d0, q0, #16 \n\t" /* shift, round, narrow */
|
"vqrshrn.s32 d0, q0, #16 \n\t" /* shift, round, narrow */
|
||||||
"subs %[n], %[n], #1 \n\t"
|
"subs %[n], %[n], #1 \n\t"
|
||||||
"vst1.16 {d0}, [%[dst]]! \n\t"
|
"vst1.16 {d0}, [%[dst]]! \n\t"
|
||||||
|
|
@ -50,8 +47,8 @@ static void pa_sconv_s16le_from_f32ne_neon(unsigned n, const float *src, int16_t
|
||||||
"2: \n\t"
|
"2: \n\t"
|
||||||
|
|
||||||
: [dst] "+r" (dst), [src] "+r" (src), [n] "+r" (n) /* output operands (or input operands that get modified) */
|
: [dst] "+r" (dst), [src] "+r" (src), [n] "+r" (n) /* output operands (or input operands that get modified) */
|
||||||
: [scale] "r" (32768.0f) /* input operands */
|
: /* input operands */
|
||||||
: "memory", "cc", "q0", "q1" /* clobber list */
|
: "memory", "cc", "q0" /* clobber list */
|
||||||
);
|
);
|
||||||
|
|
||||||
/* leftovers */
|
/* leftovers */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue