summaryrefslogtreecommitdiff
path: root/celt/entenc.c
diff options
context:
space:
mode:
authorTimothy B. Terriberry <tterribe@xiph.org>2011-10-28 06:25:38 -0700
committerGregory Maxwell <greg@xiph.org>2011-10-28 09:51:38 -0400
commit16abc6fe6e515fd2b6f78e61fd92c57bf3868eed (patch)
treef676c8de499111083c0d338940b1a831d669ad45 /celt/entenc.c
parentc8649d0e0bbc726313a5e483ecdaba34ed33e19b (diff)
downloadopus-16abc6fe6e515fd2b6f78e61fd92c57bf3868eed.tar.gz
Fix for ec_enc_patch_initial_bits().
The test to make sure that _nbits had been encoded was checking for 8-_nbits instead of _nbits. This only affected cases when less than 8 bits had ever been encoded by the time the initial bits were patched.
Diffstat (limited to 'celt/entenc.c')
-rw-r--r--celt/entenc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/celt/entenc.c b/celt/entenc.c
index bff2d899..2e20c357 100644
--- a/celt/entenc.c
+++ b/celt/entenc.c
@@ -225,7 +225,7 @@ void ec_enc_patch_initial_bits(ec_enc *_this,unsigned _val,unsigned _nbits){
/*The first byte is still awaiting carry propagation.*/
_this->rem=(_this->rem&~mask)|_val<<shift;
}
- else if(_this->rng<=(EC_CODE_TOP>>shift)){
+ else if(_this->rng<=(EC_CODE_TOP>>_nbits)){
/*The renormalization loop has never been run.*/
_this->val=(_this->val&~((opus_uint32)mask<<EC_CODE_SHIFT))|
(opus_uint32)_val<<(EC_CODE_SHIFT+shift);