* 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 http://www.xiph.org/ *
+ * *
********************************************************************
function: utility main for setting entropy encoding parameters
for lattice codebooks
- last mod: $Id: latticetune.c,v 1.10 2001/12/16 04:15:57 xiphmont Exp $
********************************************************************/
b=codebook_load(filename);
c=(static_codebook *)(b->c);
-
+
ptr=strrchr(filename,'.');
if(ptr){
*ptr='\0';
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);
}
char *pos=strchr(line,':');
if(pos){
- long code=atol(line);
- long val=atol(pos+1);
- hits[code]+=val;
+ long code=atol(line);
+ long val=atol(pos+1);
+ hits[code]+=val;
}
line=setup_line(in);
build_tree_from_lengths0(entries,hits,lengths);
c->lengthlist=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;i<entries;i++)
if(c->lengthlist[i]>base)base=c->lengthlist[i];
-
+
for(j=0;j<entries;j++){
if(c->lengthlist[j]){
- int indexdiv=1;
- fprintf(stderr,"%4ld: ",j);
- for(k=0;k<c->dim;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;k<base-c->lengthlist[j];k++)fprintf(stderr,"*");
- fprintf(stderr,"\n");
+ int indexdiv=1;
+ fprintf(stderr,"%4ld: ",j);
+ for(k=0;k<c->dim;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;k<base-c->lengthlist[j];k++)fprintf(stderr,"*");
+ fprintf(stderr,"\n");
}
}
}
-
+
fprintf(stderr,"\r "
- "\nDone.\n");
+ "\nDone.\n");
exit(0);
}