removed some if()s from an ltp inner loop
authorJean-Marc Valin <jean-marc.valin@usherbrooke.ca>
Sat, 6 Sep 2008 01:44:59 +0000 (21:44 -0400)
committerJean-Marc Valin <jean-marc.valin@usherbrooke.ca>
Sat, 6 Sep 2008 03:01:20 +0000 (23:01 -0400)
libspeex/ltp.c

index 2815587..f20bca5 100644 (file)
@@ -394,18 +394,22 @@ int scaledown
       new_target[j] = target[j];
 
    {
+      int bound;
       VARDECL(spx_mem_t *mm);
       int pp=pitch-1;
       ALLOC(mm, p, spx_mem_t);
-      for (j=0;j<nsf;j++)
-      {
-         if (j-pp<0)
-            e[j]=exc2[j-pp];
-         else if (j-pp-pitch<0)
-            e[j]=exc2[j-pp-pitch];
-         else
-            e[j]=0;
-      }
+      bound = nsf;
+      if (nsf-pp>0)
+         bound = pp;
+      for (j=0;j<bound;j++)
+         e[j]=exc2[j-pp];
+      bound = nsf;
+      if (nsf-pp-pitch>0)
+         bound = pp+pitch;
+      for (;j<bound;j++)
+         e[j]=exc2[j-pp-pitch];
+      for (;j<nsf;j++)
+         e[j]=0;
 #ifdef FIXED_POINT
       /* Scale target and excitation down if needed (avoiding overflow) */
       if (scaledown)
@@ -596,7 +600,7 @@ spx_word32_t *cumul_gain
          break;
       }
    }
-   for (i=-end;i<nsf;i++)
+   for (i=-end;i<0;i++)
    {
       if (ABS16(exc2[i])>16383)
       {