aboutsummaryrefslogtreecommitdiffstats
path: root/libAACenc/src
diff options
context:
space:
mode:
Diffstat (limited to 'libAACenc/src')
-rw-r--r--libAACenc/src/aacenc.cpp2
-rw-r--r--libAACenc/src/aacenc_lib.cpp1
-rw-r--r--libAACenc/src/bitenc.cpp26
-rw-r--r--libAACenc/src/qc_main.cpp6
4 files changed, 25 insertions, 10 deletions
diff --git a/libAACenc/src/aacenc.cpp b/libAACenc/src/aacenc.cpp
index 1b1fd0d..89a8830 100644
--- a/libAACenc/src/aacenc.cpp
+++ b/libAACenc/src/aacenc.cpp
@@ -754,6 +754,7 @@ AAC_ENCODER_ERROR FDKaacEnc_EncodeFrame( HANDLE_AAC_ENC hAacEnc,
/* advance psychoacoustics */
for (el=0; el<cm->nElements; el++) {
ELEMENT_INFO elInfo = cm->elInfo[el];
+ //fprintf(stderr, "elInfo.elType=%d\n", elInfo.elType);
if ( (elInfo.elType == ID_SCE)
|| (elInfo.elType == ID_CPE)
@@ -972,6 +973,7 @@ AAC_ENCODER_ERROR FDKaacEnc_EncodeFrame( HANDLE_AAC_ENC hAacEnc,
/*-------------------------------------------- */
/* for ( all sub frames ) ... */
+ fprintf(stderr, "totalBits=%d, qcOut->totalBits=%d, qcOut->totFillBits=%d\n", totalBits, qcOut->totalBits, qcOut->totFillBits);
/* write bitstream header */
transportEnc_WriteAccessUnit(
hTpEnc,
diff --git a/libAACenc/src/aacenc_lib.cpp b/libAACenc/src/aacenc_lib.cpp
index efde05f..b88a22c 100644
--- a/libAACenc/src/aacenc_lib.cpp
+++ b/libAACenc/src/aacenc_lib.cpp
@@ -1893,6 +1893,7 @@ AACENC_ERROR aacEncoder_SetParam(
case 3:
case 4:
case 5:
+ case 7:
case 8:
settings->userBitrateMode = value;
hAacEncoder->InitFlags |= AACENC_INIT_CONFIG | AACENC_INIT_TRANSPORT;
diff --git a/libAACenc/src/bitenc.cpp b/libAACenc/src/bitenc.cpp
index c521cc9..3b969de 100644
--- a/libAACenc/src/bitenc.cpp
+++ b/libAACenc/src/bitenc.cpp
@@ -87,7 +87,7 @@ amm-info@iis.fraunhofer.de
contents/description: Bitstream encoder
******************************************************************************/
-
+#include <stdio.h>
#include "bitenc.h"
#include "bit_cnt.h"
#include "dyn_bits.h"
@@ -645,7 +645,7 @@ static INT FDKaacEnc_writeExtensionPayload( HANDLE_FDK_BITSTREAM hBitStream,
#define FILL_NIBBLE_BITS ( 4 )
INT extBitsUsed = 0;
-
+ //fprintf(stderr, "FDKaacEnc_writeExtensionPayload() extPayloadType=%d\n", extPayloadType);
if (extPayloadBits >= EXT_TYPE_BITS)
{
UCHAR fillByte = 0x00; /* for EXT_FIL and EXT_FILL_DATA */
@@ -749,7 +749,7 @@ static INT FDKaacEnc_writeDataStreamElement( HANDLE_TRANSPORTENC hTpEnc,
#define MAX_DSE_DATA_BYTES ( 510 )
INT dseBitsUsed = 0;
-
+ fprintf(stderr, "FDKaacEnc_writeDataStreamElement() dataPayloadBytes=%d\n", dataPayloadBytes);
while (dataPayloadBytes > 0)
{
int esc_count = -1;
@@ -840,6 +840,7 @@ INT FDKaacEnc_writeExtensionData( HANDLE_TRANSPORTENC hTpEnc,
hBitStream = transportEnc_GetBitstream(hTpEnc);
}
+ //fprintf(stderr, "FDKaacEnc_writeExtensionData() pExtension->type=%d\n", pExtension->type);
if (syntaxFlags & (AC_SCALABLE|AC_ER))
{
if ( syntaxFlags & AC_DRM )
@@ -1393,7 +1394,7 @@ AAC_ENCODER_ERROR FDKaacEnc_WriteBitstream(HANDLE_TRANSPORTENC hTpEnc,
if (channelElementExtensionWritten[i][n]==0)
{
- /* Write all ramaining extension payloads in element */
+ /* Write all remaining extension payloads in element */
FDKaacEnc_writeExtensionData( hTpEnc,
&qcOut->qcElement[i]->extension[n],
0,
@@ -1430,9 +1431,16 @@ AAC_ENCODER_ERROR FDKaacEnc_WriteBitstream(HANDLE_TRANSPORTENC hTpEnc,
/* Add fill data / stuffing bits */
n = qcOut->nExtensions;
- qcOut->extension[n].type = EXT_FILL_DATA;
- qcOut->extension[n].nPayloadBits = qcOut->totFillBits;
- qcOut->nExtensions++;
+
+// if (!(syntaxFlags & AC_DAB)) {
+ qcOut->extension[n].type = EXT_FILL_DATA;
+ qcOut->extension[n].nPayloadBits = qcOut->totFillBits;
+ qcOut->nExtensions++;
+// } else {
+// doByteAlign = 0;
+// }
+ if (syntaxFlags & AC_DAB)
+ doByteAlign = 0;
/* Write global extension payload and fill data */
for (n = 0; (n < qcOut->nExtensions) && (n < (2+2)); n++)
@@ -1448,7 +1456,7 @@ AAC_ENCODER_ERROR FDKaacEnc_WriteBitstream(HANDLE_TRANSPORTENC hTpEnc,
/* For EXT_FIL or EXT_FILL_DATA we could do an additional sanity check here */
}
- if (!(syntaxFlags & (AC_SCALABLE|AC_ER))) {
+ if (!(syntaxFlags & (AC_SCALABLE|AC_ER|AC_DAB))) {
FDKwriteBits(hBs, ID_END, EL_ID_BITS);
}
@@ -1467,9 +1475,11 @@ AAC_ENCODER_ERROR FDKaacEnc_WriteBitstream(HANDLE_TRANSPORTENC hTpEnc,
transportEnc_EndAccessUnit(hTpEnc, &frameBits);
if (frameBits != qcOut->totalBits + qcKernel->globHdrBits){
+ fprintf(stderr, "frameBits != qcOut->totalBits + qcKernel->globHdrBits: %d != %d + %d", frameBits, qcOut->totalBits, qcKernel->globHdrBits);
return AAC_ENC_WRITTEN_BITS_ERROR;
}
+ fprintf(stderr, "ErrorStatus=%d", ErrorStatus);
return ErrorStatus;
}
diff --git a/libAACenc/src/qc_main.cpp b/libAACenc/src/qc_main.cpp
index e09769e..9866a3a 100644
--- a/libAACenc/src/qc_main.cpp
+++ b/libAACenc/src/qc_main.cpp
@@ -1378,7 +1378,7 @@ AAC_ENCODER_ERROR FDKaacEnc_FinalizeBitConsumption(CHANNEL_MAPPING *cm,
/* Get total consumed bits in AU */
qcOut->totalBits = qcOut->staticBits + qcOut->usedDynBits + qcOut->totFillBits +
qcOut->elementExtBits + qcOut->globalExtBits;
-
+#if 1
if (qcKernel->bitrateMode==QCDATA_BR_MODE_CBR) {
/* Now we can get the exact transport bit amount, and hopefully it is equal to the estimated value */
@@ -1420,7 +1420,7 @@ AAC_ENCODER_ERROR FDKaacEnc_FinalizeBitConsumption(CHANNEL_MAPPING *cm,
}
} /* MODE_CBR */
-
+#endif
/* Update exact number of consumed header bits. */
qcKernel->globHdrBits = transportEnc_GetStaticBits(hTpEnc, qcOut->totalBits);
@@ -1441,6 +1441,8 @@ AAC_ENCODER_ERROR FDKaacEnc_FinalizeBitConsumption(CHANNEL_MAPPING *cm,
aot,
epConfig );
+ //fprintf(stderr, "FinalizeBitConsumption(): totFillBits=%d, qcOut->totFillBits=%d \n", totFillBits, qcOut->totFillBits);
+
/* now distribute extra fillbits and alignbits */
alignBits = 7 - (qcOut->staticBits + qcOut->usedDynBits + qcOut->elementExtBits
+ qcOut->totFillBits + qcOut->globalExtBits -1)%8;