* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
* *
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2014 *
- * by the Xiph.Org Foundation http://www.xiph.org/ *
+ * by the Xiph.Org Foundation https://xiph.org/ *
* *
********************************************************************
function: utility functions for loading .vqh and .vqd files
- last mod: $Id$
********************************************************************/
while(!gotline){
if(sofar+1>=lbufsize){
- if(!lbufsize){
+ if(!lbufsize){
lbufsize=1024;
linebuffer=_ogg_malloc(lbufsize);
}else{
}
}
}
-
+
if(linebuffer[0]=='#'){
sofar=0;
}else{
for(i=1;i<c->dim;i++)
if(get_line_value(in,a+i))
break;
-
+
if(i==c->dim){
float temp=a[c->dim-1];
for(i=0;i<c->dim;i++)a[i]-=sequence_base;
fprintf(stderr,"1: syntax in %s in line:\t %s",filename,line);
exit(1);
}
-
+
switch(c->maptype){
case 0:
quant_to_read=0;
quant_to_read=c->entries*c->dim;
break;
}
-
+
/* load the quantized entries */
find_seek_to(in,"static const long _vq_quantlist_");
reset_next_value();
fprintf(stderr,"out of data while reading codebook %s\n",filename);
exit(1);
}
-
+
/* load the lengthlist */
find_seek_to(in,"_lengthlist");
reset_next_value();
/* got it all */
fclose(in);
-
+
vorbis_book_init_encode(b,c);
b->valuelist=_book_unquantize(c,c->entries,NULL);
for(i=vals;i>1;i--){
int first=-1,second=-1;
long least=-1;
-
+
spinnit("building... ",i);
-
+
/* find the two nodes to join */
for(j=0;j<vals;j++)
if(least==-1 || hist[j]<=least){
fprintf(stderr,"huffman fault; no free branch\n");
exit(1);
}
-
+
/* join them */
least=hist[first]+hist[second];
for(j=0;j<vals;j++)
fprintf(stderr,"\rEliminating %d unused entries; %d entries remain\n",
vals-upper,upper);
}
-
+
build_tree_from_lengths(upper,newhist,lengthlist);
-
+
upper=0;
for(i=0;i<vals;i++)
if(hist[i]>0)
fprintf(out,"};\n\n");
/* tie it all together */
-
+
fprintf(out,"static const static_codebook %s = {\n",name);
-
+
fprintf(out,"\t%ld, %ld,\n",c->dim,c->entries);
fprintf(out,"\t(char *)_vq_lengthlist_%s,\n",name);
fprintf(out,"\t%d, %ld, %ld, %d, %d,\n",