[xiph-cvs] cvs commit: vorbis/vq distribution.c

Monty xiphmont at xiph.org
Tue Jan 2 19:32:11 PST 2001



xiphmont    01/01/02 19:32:11

  Modified:    vq       Tag: monty_branch_20001226 distribution.c
  Log:
  Fix entry sorting when displaying

Revision  Changes    Path
No                   revision

No                   revision

1.1.2.4   +5 -5      vorbis/vq/Attic/distribution.c

Index: distribution.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/vq/Attic/distribution.c,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -u -r1.1.2.3 -r1.1.2.4
--- distribution.c	2000/12/31 23:56:07	1.1.2.3
+++ distribution.c	2001/01/03 03:32:10	1.1.2.4
@@ -12,7 +12,7 @@
  ********************************************************************
 
  function: utility for finding the distribution in a data set
- last mod: $Id: distribution.c,v 1.1.2.3 2000/12/31 23:56:07 xiphmont Exp $
+ last mod: $Id: distribution.c,v 1.1.2.4 2001/01/03 03:32:10 xiphmont Exp $
 
  ********************************************************************/
 
@@ -28,7 +28,7 @@
 */
 
 int ascend(const void *a,const void *b){
-  return(*((long *)a)-*((long *)b));
+  return(**((long **)a)-**((long **)b));
 }
 
 int main(int argc,char *argv[]){
@@ -98,7 +98,7 @@
         long base=c->lengthlist[0];
         countarray=calloc(bins,sizeof(long));
 
-	for(i=0;i<bins;i++)sort[i]=countarray+i;
+	for(i=0;i<bins;i++)sort[i]=c->quantlist+i;
         qsort(sort,bins,sizeof(long *),ascend);
 
         for(i=0;i<b->entries;i++)
@@ -124,9 +124,9 @@
             if(countarray[i]>maxcount)maxcount=countarray[i];
       
           for(i=0;i<bins;i++){
-	    int ptr=sort[i]-countarray;
+	    int ptr=sort[i]-c->quantlist;
             int stars=rint(50./maxcount*countarray[ptr]);
-	    printf("%08f (%8ld) |",c->quantlist[ptr]*delta+min,countarray[ptr]);
+	    printf("%+08f (%8ld) |",c->quantlist[ptr]*delta+min,countarray[ptr]);
             for(j=0;j<stars;j++)printf("*");
             printf("\n");
           }

--- >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 'cvs-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 commits mailing list