[pulseaudio-commits] 2 commits - src/pulsecore

Tanu Kaskinen tanuk at kemper.freedesktop.org
Thu Jul 4 23:54:19 PDT 2013


 src/pulsecore/sconv_neon.c |   21 +++++++--------------
 1 file changed, 7 insertions(+), 14 deletions(-)

New commits:
commit 736e0419809e08bd4163e785f850619af4519b4d
Author: Peter Meerwald <p.meerwald at bct-electronic.com>
Date:   Tue Jul 2 14:06:04 2013 +0200

    sconv: avoid multiply in ARM NEON s16->float conversion
    
    Signed-off-by: Peter Meerwald <pmeerw at pmeerw.net>

diff --git a/src/pulsecore/sconv_neon.c b/src/pulsecore/sconv_neon.c
index 6f1a3c9..071ba85 100644
--- a/src/pulsecore/sconv_neon.c
+++ b/src/pulsecore/sconv_neon.c
@@ -61,19 +61,14 @@ static void pa_sconv_s16le_from_f32ne_neon(unsigned n, const float *src, int16_t
 static void pa_sconv_s16le_to_f32ne_neon(unsigned n, const int16_t *src, float *dst) {
     unsigned i = n & 3;
 
-    const float invscale = 1.0f / (1 << 15);
-
     __asm__ __volatile__ (
         "movs        %[n], %[n], lsr #2     \n\t"
         "beq        2f                      \n\t"
 
-        "vdup.f32   q1, %[invscale]         \n\t"
-
         "1:                                 \n\t"
         "vld1.16    {d0}, [%[src]]!         \n\t"
         "vmovl.s16  q0, d0                  \n\t" /* widen */
-        "vcvt.f32.s32 q0, q0                \n\t" /* f32<-s32 */
-        "vmul.f32   q0, q0, q1              \n\t"
+        "vcvt.f32.s32 q0, q0, #15           \n\t" /* f32<-s32 and divide by (1<<15) */
         "subs       %[n], %[n], #1          \n\t"
         "vst1.32    {q0}, [%[dst]]!         \n\t"
         "bgt        1b                      \n\t"
@@ -81,11 +76,12 @@ static void pa_sconv_s16le_to_f32ne_neon(unsigned n, const int16_t *src, float *
         "2:                                 \n\t"
 
         : [dst] "+r" (dst), [src] "+r" (src), [n] "+r" (n) /* output operands (or input operands that get modified) */
-        : [invscale] "r" (invscale) /* input operands */
-        : "memory", "cc", "q0", "q1" /* clobber list */
+        : /* input operands */
+        : "memory", "cc", "q0" /* clobber list */
     );
 
     /* leftovers */
+    const float invscale = 1.0f / (1 << 15);
     while (i--) {
         *dst++ = *src++ * invscale;
     }

commit 40c3c117e79112700cf5192ce0c966ad881cfd89
Author: Peter Meerwald <p.meerwald at bct-electronic.com>
Date:   Tue Jul 2 11:43:35 2013 +0200

    sconv: avoid multiply in ARM NEON float->s16 conversion
    
    optimization idea taken from libavresample
    
    Signed-off-by: Peter Meerwald <pmeerw at pmeerw.net>

diff --git a/src/pulsecore/sconv_neon.c b/src/pulsecore/sconv_neon.c
index ddcdcc2..6f1a3c9 100644
--- a/src/pulsecore/sconv_neon.c
+++ b/src/pulsecore/sconv_neon.c
@@ -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"
         "beq        2f                      \n\t"
 
-        "vdup.f32   q1, %[scale]            \n\t"
-
         "1:                                 \n\t"
         "vld1.32    {q0}, [%[src]]!         \n\t"
-        "vmul.f32   q0, q0, q1              \n\t" /* scale */
-        "vcvt.s32.f32 q0, q0, #16           \n\t" /* s32<-f32 as 16:16 fixed-point */
+        "vcvt.s32.f32 q0, q0, #31           \n\t" /* s32<-f32 as 16:16 fixed-point, with implicit multiplication by 32768 */
         "vqrshrn.s32 d0, q0, #16            \n\t" /* shift, round, narrow */
         "subs       %[n], %[n], #1          \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"
 
         : [dst] "+r" (dst), [src] "+r" (src), [n] "+r" (n) /* output operands (or input operands that get modified) */
-        : [scale] "r" (32768.0f) /* input operands */
-        : "memory", "cc", "q0", "q1" /* clobber list */
+        : /* input operands */
+        : "memory", "cc", "q0" /* clobber list */
     );
 
     /* leftovers */



More information about the pulseaudio-commits mailing list