Add ec_enc_tellf, which can return the number of bits used to fractional precision.

git-svn-id: http://svn.xiph.org/trunk/ghost@14393 0101bb08-14d6-0310-b084-bc0e0c8e3800
This commit is contained in:
tterribe 2008-01-11 05:12:17 +00:00 committed by Jean-Marc Valin
parent 06390d082d
commit fad779ca56
4 changed files with 63 additions and 4 deletions

View file

@ -73,11 +73,11 @@ int main(int _argc,char **_argv){
}
ec_probmod_clear(&mod);
}
nbits=ec_enc_tell(&enc);
nbits=ec_enc_tellf(&enc,4);
ec_enc_done(&enc);
fprintf(stderr,
"Encoded %0.2lf bits of entropy to %li bits (%0.3lf%% wasted).\n",
entropy,nbits,100*(nbits-entropy)/nbits);
"Encoded %0.2lf bits of entropy to %0.2lf bits (%0.3lf%% wasted).\n",
entropy,ldexp(nbits,-4),100*(nbits-ldexp(entropy,4))/nbits);
fprintf(stderr,"Packed to %li bytes.\n",(long)(buf.ptr-buf.buf));
ec_byte_readinit(&buf,ec_byte_get_buffer(&buf),ec_byte_bytes(&buf));
ec_dec_init(&dec,&buf);