Making exp_rotation1() use MAC16_16(), which saves a few cycles on ARM
authorJean-Marc Valin <jmvalin@jmvalin.ca>
Sun, 5 Jan 2014 02:06:24 +0000 (21:06 -0500)
committerJean-Marc Valin <jmvalin@jmvalin.ca>
Sun, 5 Jan 2014 02:06:24 +0000 (21:06 -0500)
celt/vq.c

index 189bf23..7d92246 100644 (file)
--- a/celt/vq.c
+++ b/celt/vq.c
 static void exp_rotation1(celt_norm *X, int len, int stride, opus_val16 c, opus_val16 s)
 {
    int i;
+   opus_val16 ms;
    celt_norm *Xptr;
    Xptr = X;
+   ms = NEG16(s);
    for (i=0;i<len-stride;i++)
    {
       celt_norm x1, x2;
       x1 = Xptr[0];
       x2 = Xptr[stride];
-      Xptr[stride] = EXTRACT16(PSHR32(MULT16_16(c,x2) + MULT16_16(s,x1), 15));
-      *Xptr++      = EXTRACT16(PSHR32(MULT16_16(c,x1) - MULT16_16(s,x2), 15));
+      Xptr[stride] = EXTRACT16(PSHR32(MAC16_16(MULT16_16(c, x2),  s, x1), 15));
+      *Xptr++      = EXTRACT16(PSHR32(MAC16_16(MULT16_16(c, x1), ms, x2), 15));
    }
    Xptr = &X[len-2*stride-1];
    for (i=len-2*stride-1;i>=0;i--)
@@ -58,8 +60,8 @@ static void exp_rotation1(celt_norm *X, int len, int stride, opus_val16 c, opus_
       celt_norm x1, x2;
       x1 = Xptr[0];
       x2 = Xptr[stride];
-      Xptr[stride] = EXTRACT16(PSHR32(MULT16_16(c,x2) + MULT16_16(s,x1), 15));
-      *Xptr--      = EXTRACT16(PSHR32(MULT16_16(c,x1) - MULT16_16(s,x2), 15));
+      Xptr[stride] = EXTRACT16(PSHR32(MAC16_16(MULT16_16(c, x2),  s, x1), 15));
+      *Xptr--      = EXTRACT16(PSHR32(MAC16_16(MULT16_16(c, x1), ms, x2), 15));
    }
 }