ref: 17d71a7011a2dee7cba76568b63bc73f4ba029d5
parent: 1c10295d291b041e9466949b47d3e4dde39d8380
author: menno <menno>
date: Wed Jun 6 11:17:57 EDT 2001
(I hope I have) fixed MPEG4 compatibility once and for all ;-)
--- a/include/faac.h
+++ b/include/faac.h
@@ -16,7 +16,7 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id: faac.h,v 1.11 2001/05/30 08:57:08 menno Exp $
+ * $Id: faac.h,v 1.12 2001/06/06 15:17:56 menno Exp $
*/
#ifndef FAACLIB_H
@@ -37,8 +37,8 @@
#endif
#endif
-#define FAACENC_VERSION 1.1
-#define FAACENC_VERSIONB 0 /* If 1 this version is still in beta */
+#define FAACENC_VERSION 1.5
+#define FAACENC_VERSIONB 1 /* If 1 this version is still in beta */
/* MPEG ID's */
#define MPEG2 1
--- a/libfaac/bitstream.c
+++ b/libfaac/bitstream.c
@@ -16,11 +16,10 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id: bitstream.c,v 1.17 2001/05/30 08:57:08 menno Exp $
+ * $Id: bitstream.c,v 1.18 2001/06/06 15:17:57 menno Exp $
*/
#include <stdlib.h>
-#include <assert.h>
#include "coder.h"
#include "channels.h"
@@ -105,13 +104,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);
+ bits += ByteAlign(bitStream, 1);
- bits += ByteAlign(bitStream, 1,0);
-
return bits;
}
@@ -183,13 +177,8 @@
bits += LEN_SE_ID;
/* Now byte align the bitstream */
+ bits += ByteAlign(bitStream, 0);
- bitStream->numBit=bits;
- if (hEncoder->config.mpegVersion == 0)
- bits += ByteAlign(bitStream, 0,2);
-
- bits += ByteAlign(bitStream, 0,0);
-
hEncoder->usedBytes = bit2byte(bits);
return bits;
@@ -806,27 +795,20 @@
return 0;
}
-static int ByteAlign(BitStream *bitStream, int writeFlag, int offset)
+static int ByteAlign(BitStream *bitStream, int writeFlag)
{
int len, i,j;
- assert(offset<8);
- assert(offset>=0);
-
len = BufferNumBit(bitStream);
+
+ j = (8 - (len%8))%8;
- j = (16+offset - (len%8))%8;
-
- if ((len % 8) == offset)
- j = 0;
-
+ if ((len % 8) == 0) j = 0;
if (writeFlag) {
for( i=0; i<j; i++ ) {
PutBit(bitStream, 0, 1);
}
}
- else
- bitStream->numBit+=j;
-
return j;
}
+
--- a/libfaac/bitstream.h
+++ b/libfaac/bitstream.h
@@ -16,7 +16,7 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id: bitstream.h,v 1.8 2001/05/30 08:57:08 menno Exp $
+ * $Id: bitstream.h,v 1.9 2001/06/06 15:17:57 menno Exp $
*/
#ifndef BITSTREAM_H
@@ -215,8 +215,7 @@
int numBit);
static int ByteAlign(BitStream* bitStream,
- int writeFlag,
- int offset);
+ int writeFlag);
#ifdef __cplusplus
}