[pulseaudio-discuss] [PATCH] core: Fix a litte-endian bug in ARM svolume code
Peter Meerwald
pmeerw at pmeerw.net
Thu Oct 18 04:33:46 PDT 2012
> The old code seems to be written for big-endian code.
> NB: This one's really strange since this effectively means that our soft
> volumes on ARMv6 have been mostly broken (since almost everybody uses
> litte-endian). Review would be appreciated!
benchmark results on Cortex-A8 were horrible
(http://lists.freedesktop.org/archives/pulseaudio-discuss/2012-February/012864.html):
runtime on beagle-xm, 800 MHz:
checking NEON volume_float32ne
NEON: 10223 usec.
ref: 46480 usec.
checking NEON volume_s16ne
NEON: 8484 usec.
ARM: 339272 usec.
ref: 20203 usec.
regards, p.
> ---
> src/pulsecore/svolume_arm.c | 21 +++++++++++++++++++++
> 1 files changed, 21 insertions(+), 0 deletions(-)
>
> diff --git a/src/pulsecore/svolume_arm.c b/src/pulsecore/svolume_arm.c
> index b5ccc67..f06a702 100644
> --- a/src/pulsecore/svolume_arm.c
> +++ b/src/pulsecore/svolume_arm.c
> @@ -75,13 +75,22 @@ static void pa_volume_s16ne_arm(int16_t *samples, const int32_t *volumes, unsign
> " ldrd r2, [r6], #8 \n\t" /* 2 samples at a time */
> " ldr r0, [%0] \n\t"
>
> +#ifdef WORDS_BIGENDIAN
> " smulwt r2, r2, r0 \n\t"
> " smulwb r3, r3, r0 \n\t"
> +#else
> + " smulwb r2, r2, r0 \n\t"
> + " smulwt r3, r3, r0 \n\t"
> +#endif
>
> " ssat r2, #16, r2 \n\t"
> " ssat r3, #16, r3 \n\t"
>
> +#ifdef WORDS_BIGENDIAN
> " pkhbt r0, r3, r2, LSL #16 \n\t"
> +#else
> + " pkhbt r0, r2, r3, LSL #16 \n\t"
> +#endif
> " str r0, [%0], #4 \n\t"
>
> MOD_INC()
> @@ -95,18 +104,30 @@ static void pa_volume_s16ne_arm(int16_t *samples, const int32_t *volumes, unsign
> " ldrd r4, [r6], #8 \n\t"
> " ldrd r0, [%0] \n\t"
>
> +#ifdef WORDS_BIGENDIAN
> " smulwt r2, r2, r0 \n\t"
> " smulwb r3, r3, r0 \n\t"
> " smulwt r4, r4, r1 \n\t"
> " smulwb r5, r5, r1 \n\t"
> +#else
> + " smulwb r2, r2, r0 \n\t"
> + " smulwt r3, r3, r0 \n\t"
> + " smulwb r4, r4, r1 \n\t"
> + " smulwt r5, r5, r1 \n\t"
> +#endif
>
> " ssat r2, #16, r2 \n\t"
> " ssat r3, #16, r3 \n\t"
> " ssat r4, #16, r4 \n\t"
> " ssat r5, #16, r5 \n\t"
>
> +#ifdef WORDS_BIGENDIAN
> " pkhbt r0, r3, r2, LSL #16 \n\t"
> " pkhbt r1, r5, r4, LSL #16 \n\t"
> +#else
> + " pkhbt r0, r2, r3, LSL #16 \n\t"
> + " pkhbt r1, r4, r5, LSL #16 \n\t"
> +#endif
> " strd r0, [%0], #8 \n\t"
>
> MOD_INC()
>
--
Peter Meerwald
+43-664-2444418 (mobile)
More information about the pulseaudio-discuss
mailing list