shithub: aacenc

Download patch

ref: 7c4345c40195a6d1c724934229e2eb88887ab031
parent: c484946e5db501ce5de17256c1954dc79ccf7113
author: menno <menno>
date: Tue May 29 02:42:12 EDT 2001

Fixed bit counting, file length calculation works again

--- a/libfaac/bitstream.c
+++ b/libfaac/bitstream.c
@@ -16,10 +16,11 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- * $Id: bitstream.c,v 1.15 2001/05/28 14:11:47 menno Exp $
+ * $Id: bitstream.c,v 1.16 2001/05/29 06:42:12 menno Exp $
  */
 
 #include <stdlib.h>
+#include <assert.h>
 
 #include "coder.h"
 #include "channels.h"
@@ -104,6 +105,8 @@
 	 * in MPEG4 the byte_alignment() is officially done before the new frame
 	 * instead of at the end. But this is basically the same.
 	 */
+	assert(bitStream->numBit==bits);
+	bitStream->numBit=bits;
     if (hEncoder->config.mpegVersion == 0)
   	  bits += ByteAlign(bitStream, 1,2);
 
@@ -181,6 +184,7 @@
 
 	/* Now byte align the bitstream */
 
+	bitStream->numBit=bits;
     if (hEncoder->config.mpegVersion == 0)
 		bits += ByteAlign(bitStream, 0,2);
 
@@ -806,10 +810,8 @@
 {
 	int len, i,j;
 
-#if 0
 	assert(offset<8);
 	assert(offset>=0);
-#endif
 
 	len = BufferNumBit(bitStream);
 
@@ -823,5 +825,8 @@
 			PutBit(bitStream, 0, 1);
 		}
 	}
+	else
+		bitStream->numBit+=j;
+
 	return j;
 }