[pulseaudio-discuss] [PATCH] core: Fix a litte-endian bug in ARM svolume code

Arun Raghavan arun.raghavan at collabora.co.uk
Wed Oct 17 22:31:54 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!
---
 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()
-- 
1.7.8.6



More information about the pulseaudio-discuss mailing list