shithub: opus

Download patch

ref: bdcaaf73c62844f7971b946ae19d641e58a8afad
parent: 9310096e3cdbdbf907347561e482501dc214436d
author: Jean-Marc Valin <[email protected]>
date: Mon Jul 5 09:52:41 EDT 2010

Fixed a few more issues with the _ec() calls.

--- a/libcelt/celt.c
+++ b/libcelt/celt.c
@@ -467,9 +467,13 @@
    if (i<2)
       ec_enc_uint(enc, flag_bits, 4);
    else if (i<6)
-      ec_enc_uint(enc, flag_bits, 16);
-   else
-      ec_enc_uint(enc, flag_bits, 8);
+   {
+      ec_enc_uint(enc, flag_bits>>2, 4);
+      ec_enc_uint(enc, flag_bits&0x3, 4);
+   } else {
+      ec_enc_uint(enc, flag_bits>>1, 4);
+      ec_enc_uint(enc, flag_bits&0x1, 2);
+   }
 }
 
 static void decode_flags(ec_dec *dec, int *intra_ener, int *has_pitch, int *shortBlocks, int *has_fold)
@@ -748,7 +752,7 @@
       enc = &_enc;
       nbFilledBytes=0;
    } else {
-      nbFilledBytes=ec_enc_tell(enc, 0);
+      nbFilledBytes=(ec_enc_tell(enc, 0)+4)>>3;
    }
    nbAvailableBytes = nbCompressedBytes - nbFilledBytes;
 
@@ -1700,7 +1704,7 @@
       dec = &_dec;
       nbFilledBytes = 0;
    } else {
-      nbFilledBytes = ec_dec_tell(dec, 0);
+      nbFilledBytes = (ec_dec_tell(dec, 0)+4)>>3;
    }
    nbAvailableBytes = len-nbFilledBytes;