X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=vq%2Flatticetune.c;h=67fc1e2dc79c3b21638832bf36fc418444df90c4;hb=eb40ca5fbd0c60d8bd1fd33be07f02defc21e5d7;hp=b3934951e8181dc392343fba858416a26b990091;hpb=7bfceda6317dcb2cb749ad84efee310a9a792911;p=platform%2Fupstream%2Flibvorbis.git diff --git a/vq/latticetune.c b/vq/latticetune.c index b393495..67fc1e2 100644 --- a/vq/latticetune.c +++ b/vq/latticetune.c @@ -6,13 +6,12 @@ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 * - * by the XIPHOPHORUS Company http://www.xiph.org/ * - + * by the Xiph.Org Foundation https://xiph.org/ * + * * ******************************************************************** function: utility main for setting entropy encoding parameters for lattice codebooks - last mod: $Id: latticetune.c,v 1.7 2001/02/26 03:51:12 xiphmont Exp $ ********************************************************************/ @@ -23,7 +22,7 @@ #include #include "bookutil.h" -static char *strrcmp_i(char *s,char *cmp){ +static int strrcmp_i(char *s,char *cmp){ return(strncmp(s+strlen(s)-strlen(cmp),cmp,strlen(cmp))); } @@ -63,7 +62,7 @@ int main(int argc,char *argv[]){ b=codebook_load(filename); c=(static_codebook *)(b->c); - + ptr=strrchr(filename,'.'); if(ptr){ *ptr='\0'; @@ -94,49 +93,33 @@ int main(int argc,char *argv[]){ if(!strrcmp_i(argv[0],"latticetune")){ long lines=0; line=setup_line(in); - while(line){ + while(line){ long code; lines++; if(!(lines&0xfff))spinnit("codewords so far...",lines); - + if(sscanf(line,"%ld",&code)==1) - hits[code]++; + hits[code]++; line=setup_line(in); } } - if(!strrcmp_i(argv[0],"restune")){ - long step; - long lines=0; - long cols=-1; - float *vec; + /* now we simply count already collated by-entry data */ + if(!strrcmp_i(argv[0],"res0tune") || !strrcmp_i(argv[0],"res1tune")){ + line=setup_line(in); while(line){ - int code; - if(!(lines&0xfff))spinnit("codewords so far...",lines); - if(cols==-1){ - char *temp=line; - while(*temp==' ')temp++; - for(cols=0;*temp;cols++){ - while(*temp>32)temp++; - while(*temp==' ')temp++; - } - vec=alloca(sizeof(float)*cols); - step=cols/dim; - } - - for(j=0;jlengthlist=lengths; - write_codebook(stdout,name,c); - + write_codebook(stdout,name,c); + + { + long bins=_book_maptype1_quantvals(c); + long i,k,base=c->lengthlist[0]; + for(i=0;ilengthlist[i]>base)base=c->lengthlist[i]; + + for(j=0;jlengthlist[j]){ + int indexdiv=1; + fprintf(stderr,"%4ld: ",j); + for(k=0;kdim;k++){ + int index= (j/indexdiv)%bins; + fprintf(stderr,"%+3.1f,", c->quantlist[index]*_float32_unpack(c->q_delta)+ + _float32_unpack(c->q_min)); + indexdiv*=bins; + } + fprintf(stderr,"\t|"); + for(k=0;klengthlist[j];k++)fprintf(stderr,"*"); + fprintf(stderr,"\n"); + } + } + } + fprintf(stderr,"\r " - "\nDone.\n"); + "\nDone.\n"); exit(0); }