shithub: opus

Download patch

ref: 16abc6fe6e515fd2b6f78e61fd92c57bf3868eed
parent: c8649d0e0bbc726313a5e483ecdaba34ed33e19b
author: Timothy B. Terriberry <[email protected]>
date: Fri Oct 28 02:25:38 EDT 2011

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.

--- a/celt/entenc.c
+++ b/celt/entenc.c
@@ -225,7 +225,7 @@
     /*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);