Add ec_dec_tell() to report the same information as ec_enc_tell() decode side. Remove ec_enc_tell() and replace it with ec_enc_tellf(): just request 0 fractional bits if you want an integer value.
git-svn-id: http://svn.xiph.org/trunk/ghost@14394 0101bb08-14d6-0310-b084-bc0e0c8e3800
This commit is contained in:
parent
fad779ca56
commit
3eff11d8d4
7 changed files with 111 additions and 75 deletions
|
@ -91,20 +91,7 @@ void ec_encode(ec_enc *_this,unsigned _fl,unsigned _fh,unsigned _ft){
|
|||
ec_enc_normalize(_this);
|
||||
}
|
||||
|
||||
long ec_enc_tell(ec_enc *_this){
|
||||
long nbits;
|
||||
nbits=ec_byte_bytes(_this->buf)+(_this->rem>=0)+_this->ext<<3;
|
||||
/*To handle the non-integral number of bits still left in the encoder state,
|
||||
we compute the number of bits of low that must be encoded to ensure that
|
||||
the value is inside the range for any possible subsequent bits.
|
||||
Note that this is subtly different than the actual value we would end the
|
||||
stream with, which tries to make as many of the trailing bits zeros as
|
||||
possible.*/
|
||||
nbits+=EC_CODE_BITS-EC_ILOG(_this->rng);
|
||||
return nbits;
|
||||
}
|
||||
|
||||
long ec_enc_tellf(ec_enc *_this,int _b){
|
||||
long ec_enc_tell(ec_enc *_this,int _b){
|
||||
ec_uint32 r;
|
||||
int l;
|
||||
long nbits;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue