shithub: opus

Download patch

ref: 03892c18d4096111cd904531e84268d45478fe75
parent: 9455d1b13cd87ee30bcc1f95b8c35bb1e2e44681
author: Jean-Marc Valin <[email protected]>
date: Fri Mar 7 12:25:47 EST 2008

fixed-point: finished intra_prediction(). No float ops left in vq.c

--- a/libcelt/arch.h
+++ b/libcelt/arch.h
@@ -64,7 +64,7 @@
 #define SIG_SCALING_1 (1.f/16384.f)
 #define SIG_SHIFT 14
 
-#define NORM_SCALING 16384.f
+#define NORM_SCALING 16384
 #define NORM_SCALING_1 (1.f/16384.f)
 #define NORM_SHIFT 14
 
--- a/libcelt/vq.c
+++ b/libcelt/vq.c
@@ -390,13 +390,13 @@
    {
       int j;
       celt_word32_t xy=0, yy=0;
-      float score;
+      celt_word32_t score;
       for (j=0;j<N;j++)
       {
          xy = MAC16_16(xy, x[j], Y[i+N-j-1]);
          yy = MAC16_16(yy, Y[i+N-j-1], Y[i+N-j-1]);
       }
-      score = 1.f*xy*xy/(.001+yy);
+      score = DIV32(MULT16_16(ROUND(xy,14),ROUND(xy,14)), ROUND(yy,14));
       if (score > best_score)
       {
          best_score = score;
@@ -420,7 +420,7 @@
       pred_gain = pg[10];
    else
       pred_gain = pg[K];
-   E = 1e-10;
+   E = EPSILON;
    for (j=0;j<N;j++)
    {
       P[j] = s*Y[best+N-j-1];