Latest psychoacoustics work -- still highly experimental
[opus.git] / tests / cwrs64-test.c
index 862f124..548fa22 100644 (file)
@@ -13,8 +13,8 @@ int main(int _argc,char **_argv){
   int n;
   for(n=2;n<=NMAX;n+=3){
     int m;
-    for(m=0;m<=MMAX;m++){
-      celt_uint64_t uu[NMAX];
+    for(m=1;m<=MMAX;m++){
+      celt_uint64_t uu[MMAX+2];
       celt_uint64_t inc;
       celt_uint64_t nc;
       celt_uint64_t i;
@@ -24,34 +24,24 @@ int main(int _argc,char **_argv){
       if(inc<1)inc=1;
       /*printf("%d/%d: %llu",n,m, nc);*/
       for(i=0;i<nc;i+=inc){
-        celt_uint64_t u[NMAX];
-        int           x[MMAX+1];
-        int           s[MMAX];
-        int           x2[MMAX];
-        int           s2[MMAX];
+        celt_uint64_t u[MMAX+2];
         int           y[NMAX];
+        celt_uint64_t v;
         int           k;
-        memcpy(u,uu,n*sizeof(*u));
-        cwrsi64(n,m,i,x,s,u);
+        memcpy(u,uu,(m+2)*sizeof(*u));
+        cwrsi64(n,m,i,y,u);
         /*printf("%llu of %llu:",i,nc);
-        for(k=0;k<m;k++){
-          printf(" %c%i",k>0&&x[k]==x[k-1]?' ':s[k]?'-':'+',x[k]);
-        }
+        for(k=0;k<n;k++)printf(" %+3i",y[k]);
         printf(" ->");*/
-        memcpy(u,uu,n*sizeof(*u));
-        if(icwrs64(n,m,x,s,u)!=i){
+        if(icwrs64(n,m,&v,y,u)!=i){
           fprintf(stderr,"Combination-index mismatch.\n");
           return 1;
         }
-        x[m] = -1;
-        comb2pulse(n,m,y,x,s);
-        /*for(j=0;j<n;j++)printf(" %c%i",y[j]?y[j]<0?'-':'+':' ',abs(y[j]));
-        printf("\n");*/
-        pulse2comb(n,m,x2,s2,y);
-        for(k=0;k<m;k++)if(x[k]!=x2[k]||s[k]!=s2[k]){
-          fprintf(stderr,"Pulse-combination mismatch.\n");
-          return 1;
+        if(v!=nc){
+          fprintf(stderr,"Combination count mismatch.\n");
+          return 2;
         }
+        /*printf(" %6llu\n",i);*/
       }
       /*printf("\n");*/
     }