Add oc_enc_tell to report an estimate of the number of bits used so far.
Remove the special case for 0 in EC_ILOG, as we never pass it 0 and this generates slightly better code. Update ec_enc_bits64 to split the encoded values along word boundaries... this should generate slightly better code, as well as fix a subtle bug (the proper bits were not being masked out of the low part). However, this will render previous streams that used this function undecodable (to my knowledge, no one is actually using it yet). git-svn-id: http://svn.xiph.org/trunk/ghost@14391 0101bb08-14d6-0310-b084-bc0e0c8e3800
This commit is contained in:
parent
45018cbfa2
commit
06390d082d
7 changed files with 81 additions and 16 deletions
|
@ -75,12 +75,10 @@ void ec_enc_bits(ec_enc *_this,ec_uint32 _fl,int _ftb){
|
|||
}
|
||||
|
||||
void ec_enc_bits64(ec_enc *_this,ec_uint64 _fl,int _ftb){
|
||||
ec_uint32 fl;
|
||||
ec_uint32 ft;
|
||||
if(_ftb>32){
|
||||
_ftb-=32;
|
||||
fl=(ec_uint32)(_fl>>_ftb)&0xFFFFFFFF;
|
||||
ec_enc_bits(_this,fl,32);
|
||||
ec_enc_bits(_this,(ec_uint32)(_fl>>32),_ftb-32);
|
||||
_ftb=32;
|
||||
_fl&=0xFFFFFFFF;
|
||||
}
|
||||
ec_enc_bits(_this,(ec_uint32)_fl,_ftb);
|
||||
}
|
||||
|
@ -91,7 +89,7 @@ void ec_enc_uint(ec_enc *_this,ec_uint32 _fl,ec_uint32 _ft){
|
|||
unsigned fl;
|
||||
int ftb;
|
||||
_ft--;
|
||||
ftb=EC_ILOG(_ft);
|
||||
ftb=EC_ILOG(_ft)&-!!_ft;
|
||||
while(ftb>EC_UNIT_BITS){
|
||||
ftb-=EC_UNIT_BITS;
|
||||
ft=(_ft>>ftb)+1;
|
||||
|
@ -114,7 +112,7 @@ void ec_enc_uint64(ec_enc *_this,ec_uint64 _fl,ec_uint64 _ft){
|
|||
unsigned fl;
|
||||
int ftb;
|
||||
_ft--;
|
||||
ftb=EC_ILOG64(_ft);
|
||||
ftb=EC_ILOG64(_ft)&-!!_ft;
|
||||
while(ftb>EC_UNIT_BITS){
|
||||
ftb-=EC_UNIT_BITS;
|
||||
ft=(unsigned)(_ft>>ftb)+1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue