[vorbis-dev] vq: postbeta2 patch

Erik Kruus kruus at on2.com
Wed Sep 13 18:26:11 PDT 2000



There are some missing fixes for reading floats
         and a few unused variables
Now I have the postbeta2 branch behaving like the main one, at least!

diff -bBu2 branch_postbeta2/vq/bookutil.c vorbis-postb2/vq/bookutil.c
--- branch_postbeta2/vq/bookutil.c      Thu Aug 31 05:00:02 2000
+++ vorbis-postb2/vq/bookutil.c Wed Sep 13 17:59:15 2000
@@ -309,5 +309,5 @@
     c->pigeon_tree=p=calloc(1,sizeof(encode_aux_pigeonhole));
     line=get_line(in);
-    if(sscanf(line,"%lf, %lf, %d, %d",&(p->min),&(p->del),
+    if(sscanf(line,"%f, %f, %d, %d",&(p->min),&(p->del),
              &(p->mapentries),&(p->quantvals))!=4){
       fprintf(stderr,"5: syntax in %s in line:\t %s",filename,line);
diff -bBu2 branch_postbeta2/vq/build.c vorbis-postb2/vq/build.c
--- branch_postbeta2/vq/build.c Thu Aug 31 05:00:02 2000
+++ vorbis-postb2/vq/build.c    Wed Sep 13 18:08:55 2000
@@ -153,5 +153,5 @@
     for(k=0;k<dim;k++){
       line=rline(in,out);
-      sscanf(line,"%lf",&a);
+      sscanf(line,"%f",&a);
       v.entrylist[i]=a;
       quantlist[i++]=rint(a);
@@ -173,5 +173,5 @@
        line=rline(in,out);
        if(!line)break;
-       sscanf(line,"%lf",b+k);
+       sscanf(line,"%f",b+k);
       }
       if(feof(in))break;
diff -bBu2 branch_postbeta2/vq/latticepare.c vorbis-postb2/vq/latticepare.c
--- branch_postbeta2/vq/latticepare.c   Thu Aug 31 05:00:03 2000
+++ vorbis-postb2/vq/latticepare.c      Wed Sep 13 18:08:51 2000
@@ -86,5 +86,5 @@
   encode_aux_threshmatch *tt=b->c->thresh_tree;
   int dim=b->dim;
-  int i,k,o;
+  int k,o;
   int best=0;

@@ -102,7 +102,7 @@

 static int closest(codebook *b,float *vec,int current){
-  encode_aux_threshmatch *tt=b->c->thresh_tree;
+  /*encode_aux_threshmatch *tt=b->c->thresh_tree;*/
   int dim=b->dim;
-  int i,k,o;
+  int i;

   float bestmetric=0;
@@ -542,5 +542,5 @@
     for(i=0;i<points-entries;i++){
       int best=_best(b,pointlist+i*dim,1);
-      float *a=pointlist+i*dim;
+      /*float *a=pointlist+i*dim;*/
       if(!(i&0xff))spinnit("counting hits...",i);
       if(best==-1){
diff -bBu2 branch_postbeta2/vq/lspdata.c vorbis-postb2/vq/lspdata.c
--- branch_postbeta2/vq/lspdata.c       Thu Aug 31 05:00:03 2000
+++ vorbis-postb2/vq/lspdata.c  Wed Sep 13 17:54:32 2000
@@ -115,5 +115,5 @@
     acc+=val*val;
   }
-  return sqrt(acc/v->elements);
+  return (acc/v->elements>0)? sqrt(acc/v->elements): 0;
 }

diff -bBu2 branch_postbeta2/vq/train.c vorbis-postb2/vq/train.c
--- branch_postbeta2/vq/train.c Thu Aug 31 05:00:03 2000
+++ vorbis-postb2/vq/train.c    Wed Sep 13 18:01:08 2000
@@ -152,5 +152,5 @@
        for(k=0;k<dim;k++){
          line=rline(in,out,0);
-         sscanf(line,"%lf",&a);
+         sscanf(line,"%f",&a);
          v.entrylist[i++]=a;
        }
@@ -162,5 +162,5 @@
       for(j=0;j<entries;j++){
        line=rline(in,out,0);
-       sscanf(line,"%lf",&a);
+       sscanf(line,"%f",&a);
        v.bias[i++]=a;
       }
@@ -174,5 +174,5 @@
            line=rline(in,out,0);
            if(!line)break;
-           sscanf(line,"%lf",b+k);
+           sscanf(line,"%f",b+k);
          }
          if(feof(in))break;
@@ -205,11 +205,12 @@
            goto syner;
        }
        break;
       case 'e':
-       if(sscanf(argv[1],"%lf",&desired)!=1)
+       if(sscanf(argv[1],"%f",&desired)!=1)
          goto syner;
        break;
       case 'd':
-       if(sscanf(argv[1],"%lf",&mindist)!=1)
+       if(sscanf(argv[1],"%f",&mindist)!=1)
          goto syner;
        if(init)v.mindist=mindist;

--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'vorbis-dev-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the Vorbis-dev mailing list