Splits cwrsi() inner loop in two to avoid the min/max and some load chains
authorJean-Marc Valin <jmvalin@jmvalin.ca>
Sat, 15 Jun 2013 04:42:38 +0000 (00:42 -0400)
committerJean-Marc Valin <jmvalin@jmvalin.ca>
Sat, 15 Jun 2013 04:42:38 +0000 (00:42 -0400)
celt/cwrs.c

index e6a25e9..e1428f6 100644 (file)
@@ -473,7 +473,13 @@ static void cwrsi(int _n,int _k,opus_uint32 _i,int *_y){
     _i-=p&s;
     /*Count how many pulses were placed in this dimension.*/
     k0=_k;
-    for(p=CELT_PVQ_U(_n,_k);p>_i;p=CELT_PVQ_U(_n,_k))_k--;
+    p=CELT_PVQ_U(_n,_k);
+    if(_k>_n){
+      const opus_uint32 *row;
+      row=CELT_PVQ_U_ROW[_n];
+      for(;p>_i&&_k>_n;p=row[_k])_k--;
+    }
+    for(;p>_i;p=CELT_PVQ_U_ROW[_k][_n])_k--;
     _i-=p;
     *_y++=(k0-_k+s)^s;
   }