summaryrefslogtreecommitdiffstats
path: root/libAACenc/src
diff options
context:
space:
mode:
Diffstat (limited to 'libAACenc/src')
-rw-r--r--libAACenc/src/aacEnc_ram.cpp16
-rw-r--r--libAACenc/src/aacEnc_ram.h4
-rw-r--r--libAACenc/src/aacenc.cpp2
-rw-r--r--libAACenc/src/aacenc.h2
-rw-r--r--libAACenc/src/aacenc_lib.cpp28
-rw-r--r--libAACenc/src/adj_thr.cpp54
-rw-r--r--libAACenc/src/adj_thr.h8
-rw-r--r--libAACenc/src/adj_thr_data.h2
-rw-r--r--libAACenc/src/bandwidth.cpp4
-rw-r--r--libAACenc/src/bitenc.cpp2
-rw-r--r--libAACenc/src/channel_map.cpp51
-rw-r--r--libAACenc/src/interface.h4
-rw-r--r--libAACenc/src/metadata_compressor.cpp27
-rw-r--r--libAACenc/src/psy_main.cpp8
-rw-r--r--libAACenc/src/psy_main.h4
-rw-r--r--libAACenc/src/qc_data.h8
-rw-r--r--libAACenc/src/qc_main.cpp26
-rw-r--r--libAACenc/src/qc_main.h2
18 files changed, 137 insertions, 115 deletions
diff --git a/libAACenc/src/aacEnc_ram.cpp b/libAACenc/src/aacEnc_ram.cpp
index 1844331..be3eea2 100644
--- a/libAACenc/src/aacEnc_ram.cpp
+++ b/libAACenc/src/aacEnc_ram.cpp
@@ -119,12 +119,12 @@ C_ALLOC_MEM (Ram_aacEnc_AacEncoder, AAC_ENC, 1)
PsyInputBuffer.
*/
-C_ALLOC_MEM2 (Ram_aacEnc_PsyElement, PSY_ELEMENT, 1, (6))
+C_ALLOC_MEM2 (Ram_aacEnc_PsyElement, PSY_ELEMENT, 1, (8))
C_ALLOC_MEM (Ram_aacEnc_PsyInternal, PSY_INTERNAL, 1)
-C_ALLOC_MEM2 (Ram_aacEnc_PsyStatic, PSY_STATIC, 1, (6))
+C_ALLOC_MEM2 (Ram_aacEnc_PsyStatic, PSY_STATIC, 1, (8))
-C_ALLOC_MEM2 (Ram_aacEnc_PsyInputBuffer, INT_PCM, MAX_INPUT_BUFFER_SIZE, (6))
+C_ALLOC_MEM2 (Ram_aacEnc_PsyInputBuffer, INT_PCM, MAX_INPUT_BUFFER_SIZE, (8))
PSY_DYNAMIC *GetRam_aacEnc_PsyDynamic (int n, UCHAR* dynamic_RAM) {
FDK_ASSERT(dynamic_RAM!=0);
@@ -139,8 +139,8 @@ C_ALLOC_MEM2 (Ram_aacEnc_PsyInputBuffer, INT_PCM, MAX_INPUT_BUFFER_SIZE, (6))
*/
C_ALLOC_MEM2 (Ram_aacEnc_PsyOut, PSY_OUT, 1, (1))
-C_ALLOC_MEM2 (Ram_aacEnc_PsyOutElements, PSY_OUT_ELEMENT, 1, (1)*(6))
-C_ALLOC_MEM2 (Ram_aacEnc_PsyOutChannel, PSY_OUT_CHANNEL, 1, (1)*(6))
+C_ALLOC_MEM2 (Ram_aacEnc_PsyOutElements, PSY_OUT_ELEMENT, 1, (1)*(8))
+C_ALLOC_MEM2 (Ram_aacEnc_PsyOutChannel, PSY_OUT_CHANNEL, 1, (1)*(8))
/*
@@ -155,8 +155,8 @@ C_ALLOC_MEM2 (Ram_aacEnc_PsyOutChannel, PSY_OUT_CHANNEL, 1, (1)*(6))
C_ALLOC_MEM (Ram_aacEnc_QCstate, QC_STATE, 1)
C_ALLOC_MEM (Ram_aacEnc_AdjustThreshold, ADJ_THR_STATE, 1)
-C_ALLOC_MEM2 (Ram_aacEnc_AdjThrStateElement, ATS_ELEMENT, 1, (6))
-C_ALLOC_MEM2 (Ram_aacEnc_ElementBits, ELEMENT_BITS, 1, (6))
+C_ALLOC_MEM2 (Ram_aacEnc_AdjThrStateElement, ATS_ELEMENT, 1, (8))
+C_ALLOC_MEM2 (Ram_aacEnc_ElementBits, ELEMENT_BITS, 1, (8))
C_ALLOC_MEM (Ram_aacEnc_BitCntrState, BITCNTR_STATE, 1)
INT *GetRam_aacEnc_BitLookUp(int n, UCHAR* dynamic_RAM) {
@@ -175,7 +175,7 @@ C_ALLOC_MEM (Ram_aacEnc_BitCntrState, BITCNTR_STATE, 1)
*/
C_ALLOC_MEM2 (Ram_aacEnc_QCout, QC_OUT, 1, (1))
-C_ALLOC_MEM2 (Ram_aacEnc_QCelement, QC_OUT_ELEMENT, (1), (6))
+C_ALLOC_MEM2 (Ram_aacEnc_QCelement, QC_OUT_ELEMENT, (1), (8))
QC_OUT_CHANNEL *GetRam_aacEnc_QCchannel (int n, UCHAR* dynamic_RAM) {
FDK_ASSERT(dynamic_RAM!=0);
return ((QC_OUT_CHANNEL*) (dynamic_RAM + P_BUF_0 + n*sizeof(QC_OUT_CHANNEL)));
diff --git a/libAACenc/src/aacEnc_ram.h b/libAACenc/src/aacEnc_ram.h
index d2cad60..cf7da7c 100644
--- a/libAACenc/src/aacEnc_ram.h
+++ b/libAACenc/src/aacEnc_ram.h
@@ -118,7 +118,7 @@ amm-info@iis.fraunhofer.de
*/
/* define hBitstream size: max AAC framelength is 6144 bits/channel */
-/*#define BUFFER_BITSTR_SIZE ((6400*(6)/bbWordSize) +((bbWordSize - 1) / bbWordSize))*/
+/*#define BUFFER_BITSTR_SIZE ((6400*(8)/bbWordSize) +((bbWordSize - 1) / bbWordSize))*/
struct AAC_ENC {
@@ -173,7 +173,7 @@ struct AAC_ENC {
++++++++++++++++++++++++++++++++++++++++++++
*/
-#define BUF_SIZE_0 ( ALIGN_SIZE(sizeof(QC_OUT_CHANNEL)*(6)) )
+#define BUF_SIZE_0 ( ALIGN_SIZE(sizeof(QC_OUT_CHANNEL)*(8)) )
#define BUF_SIZE_1 ( ALIGN_SIZE(maxSize(sizeof(PSY_DYNAMIC), \
(BIT_LOOK_UP_SIZE+MERGE_GAIN_LOOK_UP_SIZE))) )
diff --git a/libAACenc/src/aacenc.cpp b/libAACenc/src/aacenc.cpp
index 6ce7b22..569662b 100644
--- a/libAACenc/src/aacenc.cpp
+++ b/libAACenc/src/aacenc.cpp
@@ -393,7 +393,7 @@ AAC_ENCODER_ERROR FDKaacEnc_Initialize(HANDLE_AAC_ENC hAacEnc,
/******************* sanity checks *******************/
/* check config structure */
- if (config->nChannels < 1 || config->nChannels > (6)) {
+ if (config->nChannels < 1 || config->nChannels > (8)) {
return AAC_ENC_UNSUPPORTED_CHANNELCONFIG;
}
diff --git a/libAACenc/src/aacenc.h b/libAACenc/src/aacenc.h
index f07bc17..87fc3e8 100644
--- a/libAACenc/src/aacenc.h
+++ b/libAACenc/src/aacenc.h
@@ -154,7 +154,7 @@ typedef enum {
#define ANC_DATA_BUFFERSIZE 1024 /* ancBuffer size */
-#define MAX_TOTAL_EXT_PAYLOADS (((6) * (1)) + (2+2))
+#define MAX_TOTAL_EXT_PAYLOADS (((8) * (1)) + (2+2))
typedef enum {
diff --git a/libAACenc/src/aacenc_lib.cpp b/libAACenc/src/aacenc_lib.cpp
index 056958b..49f8225 100644
--- a/libAACenc/src/aacenc_lib.cpp
+++ b/libAACenc/src/aacenc_lib.cpp
@@ -98,7 +98,7 @@ amm-info@iis.fraunhofer.de
/* Encoder library info */
#define AACENCODER_LIB_VL0 3
#define AACENCODER_LIB_VL1 4
-#define AACENCODER_LIB_VL2 11
+#define AACENCODER_LIB_VL2 12
#define AACENCODER_LIB_TITLE "AAC Encoder"
#define AACENCODER_LIB_BUILD_DATE __DATE__
#define AACENCODER_LIB_BUILD_TIME __TIME__
@@ -215,8 +215,8 @@ struct AACENCODER
AACENC_EXT_PAYLOAD extPayload [MAX_TOTAL_EXT_PAYLOADS];
/* Extension payload */
- UCHAR extPayloadData [(1)][(6)][MAX_PAYLOAD_SIZE];
- UINT extPayloadSize [(1)][(6)]; /* payload sizes in bits */
+ UCHAR extPayloadData [(1)][(8)][MAX_PAYLOAD_SIZE];
+ UINT extPayloadSize [(1)][(8)]; /* payload sizes in bits */
ULONG InitFlags; /* internal status to treggier re-initialization */
@@ -699,8 +699,8 @@ INT aacEncoder_LimitBitrate(
/* Find total bitrate which provides valid configuration for each SBR element. */
do {
int e;
- SBR_ELEMENT_INFO sbrElInfo[(6)];
- FDK_ASSERT(cm.nElements <= (6));
+ SBR_ELEMENT_INFO sbrElInfo[(8)];
+ FDK_ASSERT(cm.nElements <= (8));
initialBitrate = adjustedBitrate;
@@ -1061,7 +1061,7 @@ static AACENC_ERROR aacEncInit(HANDLE_AACENCODER hAacEncoder,
((InitFlags & AACENC_INIT_CONFIG) || (InitFlags & AACENC_INIT_STATES)) )
{
INT sbrError;
- SBR_ELEMENT_INFO sbrElInfo[(6)];
+ SBR_ELEMENT_INFO sbrElInfo[(8)];
CHANNEL_MAPPING channelMapping;
if ( FDKaacEnc_InitChannelMapping(hAacConfig->channelMode,
@@ -1072,7 +1072,7 @@ static AACENC_ERROR aacEncInit(HANDLE_AACENCODER hAacEncoder,
}
/* Check return value and if the SBR encoder can handle enough elements */
- if (channelMapping.nElements > (6)) {
+ if (channelMapping.nElements > (8)) {
return AACENC_INIT_ERROR;
}
@@ -1249,8 +1249,8 @@ AACENC_ERROR aacEncOpen(
/* Determine max channel configuration. */
if (maxChannels==0) {
- hAacEncoder->nMaxAacChannels = (6);
- hAacEncoder->nMaxSbrChannels = (6);
+ hAacEncoder->nMaxAacChannels = (8);
+ hAacEncoder->nMaxSbrChannels = (8);
}
else {
hAacEncoder->nMaxAacChannels = (maxChannels&0x00FF);
@@ -1258,15 +1258,15 @@ AACENC_ERROR aacEncOpen(
hAacEncoder->nMaxSbrChannels = (maxChannels&0xFF00) ? (maxChannels>>8) : hAacEncoder->nMaxAacChannels;
}
- if ( (hAacEncoder->nMaxAacChannels>(6)) || (hAacEncoder->nMaxSbrChannels>(6)) ) {
+ if ( (hAacEncoder->nMaxAacChannels>(8)) || (hAacEncoder->nMaxSbrChannels>(8)) ) {
err = AACENC_INVALID_CONFIG;
goto bail;
}
} /* maxChannels==0 */
/* Max number of elements could be tuned any more. */
- hAacEncoder->nMaxAacElements = fixMin((6), hAacEncoder->nMaxAacChannels);
- hAacEncoder->nMaxSbrElements = fixMin((6), hAacEncoder->nMaxSbrChannels);
+ hAacEncoder->nMaxAacElements = fixMin((8), hAacEncoder->nMaxAacChannels);
+ hAacEncoder->nMaxSbrElements = fixMin((8), hAacEncoder->nMaxSbrChannels);
hAacEncoder->nMaxSubFrames = (1);
@@ -1595,7 +1595,7 @@ AACENC_ERROR aacEncEncode(
}
else {
/* Add SBR extension payload */
- for (i = 0; i < (6); i++) {
+ for (i = 0; i < (8); i++) {
if (hAacEncoder->extPayloadSize[nPayload][i] > 0) {
hAacEncoder->extPayload[nExtensions].pData = hAacEncoder->extPayloadData[nPayload][i];
{
@@ -1850,7 +1850,7 @@ AACENC_ERROR aacEncoder_SetParam(
}
if ( (pConfig->nElements > hAacEncoder->nMaxAacElements)
|| (pConfig->nChannelsEff > hAacEncoder->nMaxAacChannels)
- || !((value>=1) && (value<=6))
+ || !(((value>=1) && (value<=7))||((value>=33) && (value<=34)))
)
{
err = AACENC_INVALID_CONFIG;
diff --git a/libAACenc/src/adj_thr.cpp b/libAACenc/src/adj_thr.cpp
index 0bd5827..6433633 100644
--- a/libAACenc/src/adj_thr.cpp
+++ b/libAACenc/src/adj_thr.cpp
@@ -1137,12 +1137,12 @@ the difference can be distributed among the scale factor bands.
New thresholds can be derived from this pe-difference
*****************************************************************************/
static void FDKaacEnc_correctThresh(CHANNEL_MAPPING* cm,
- QC_OUT_ELEMENT* qcElement[(6)],
- PSY_OUT_ELEMENT* psyOutElement[(6)],
- UCHAR ahFlag[(6)][(2)][MAX_GROUPED_SFB],
- FIXP_DBL thrExp[(6)][(2)][MAX_GROUPED_SFB],
- const FIXP_DBL redVal[(6)],
- const SCHAR redValScaling[(6)],
+ QC_OUT_ELEMENT* qcElement[(8)],
+ PSY_OUT_ELEMENT* psyOutElement[(8)],
+ UCHAR ahFlag[(8)][(2)][MAX_GROUPED_SFB],
+ FIXP_DBL thrExp[(8)][(2)][MAX_GROUPED_SFB],
+ const FIXP_DBL redVal[(8)],
+ const SCHAR redValScaling[(8)],
const INT deltaPe,
const INT processElements,
const INT elementOffset)
@@ -1153,8 +1153,8 @@ static void FDKaacEnc_correctThresh(CHANNEL_MAPPING* cm,
PE_CHANNEL_DATA *peChanData;
FIXP_DBL thrFactorLdData;
FIXP_DBL sfbEnLdData, sfbThrLdData, sfbThrReducedLdData;
- FIXP_DBL *sfbPeFactorsLdData[(6)][(2)];
- FIXP_DBL sfbNActiveLinesLdData[(6)][(2)][MAX_GROUPED_SFB];
+ FIXP_DBL *sfbPeFactorsLdData[(8)][(2)];
+ FIXP_DBL sfbNActiveLinesLdData[(8)][(2)][MAX_GROUPED_SFB];
INT normFactorInt;
FIXP_DBL normFactorLdData;
@@ -1308,9 +1308,9 @@ static void FDKaacEnc_correctThresh(CHANNEL_MAPPING* cm,
reducing minSnr
*****************************************************************************/
void FDKaacEnc_reduceMinSnr(CHANNEL_MAPPING* cm,
- QC_OUT_ELEMENT* qcElement[(6)],
- PSY_OUT_ELEMENT* psyOutElement[(6)],
- UCHAR ahFlag[(6)][(2)][MAX_GROUPED_SFB],
+ QC_OUT_ELEMENT* qcElement[(8)],
+ PSY_OUT_ELEMENT* psyOutElement[(8)],
+ UCHAR ahFlag[(8)][(2)][MAX_GROUPED_SFB],
const INT desiredPe,
INT* redPeGlobal,
const INT processElements,
@@ -1410,10 +1410,10 @@ bail:
bands have to be quantized to zero
*****************************************************************************/
static void FDKaacEnc_allowMoreHoles(CHANNEL_MAPPING* cm,
- QC_OUT_ELEMENT* qcElement[(6)],
- PSY_OUT_ELEMENT* psyOutElement[(6)],
- ATS_ELEMENT* AdjThrStateElement[(6)],
- UCHAR ahFlag[(6)][(2)][MAX_GROUPED_SFB],
+ QC_OUT_ELEMENT* qcElement[(8)],
+ PSY_OUT_ELEMENT* psyOutElement[(8)],
+ ATS_ELEMENT* AdjThrStateElement[(8)],
+ UCHAR ahFlag[(8)][(2)][MAX_GROUPED_SFB],
const INT desiredPe,
const INT currentPe,
const int processElements,
@@ -1645,17 +1645,17 @@ functionname: FDKaacEnc_adaptThresholdsToPe
description: two guesses for the reduction value and one final correction of the thresholds
*****************************************************************************/
static void FDKaacEnc_adaptThresholdsToPe(CHANNEL_MAPPING* cm,
- ATS_ELEMENT* AdjThrStateElement[(6)],
- QC_OUT_ELEMENT* qcElement[(6)],
- PSY_OUT_ELEMENT* psyOutElement[(6)],
+ ATS_ELEMENT* AdjThrStateElement[(8)],
+ QC_OUT_ELEMENT* qcElement[(8)],
+ PSY_OUT_ELEMENT* psyOutElement[(8)],
const INT desiredPe,
const INT processElements,
const INT elementOffset)
{
- FIXP_DBL redValue[(6)];
- SCHAR redValScaling[(6)];
- UCHAR pAhFlag[(6)][(2)][MAX_GROUPED_SFB];
- FIXP_DBL pThrExp[(6)][(2)][MAX_GROUPED_SFB];
+ FIXP_DBL redValue[(8)];
+ SCHAR redValScaling[(8)];
+ UCHAR pAhFlag[(8)][(2)][MAX_GROUPED_SFB];
+ FIXP_DBL pThrExp[(8)][(2)][MAX_GROUPED_SFB];
int iter;
INT constPartGlobal, noRedPeGlobal, nActiveLinesGlobal, redPeGlobal;
@@ -2219,7 +2219,7 @@ description: initialize ADJ_THR_STATE
void FDKaacEnc_AdjThrInit(
ADJ_THR_STATE *hAdjThr,
const INT meanPe,
- ELEMENT_BITS *elBits[(6)],
+ ELEMENT_BITS *elBits[(8)],
INT invQuant,
INT nElements,
INT nChannelsEff,
@@ -2540,10 +2540,10 @@ void FDKaacEnc_DistributeBits(ADJ_THR_STATE *adjThrState,
functionname: FDKaacEnc_AdjustThresholds
description: adjust thresholds
*****************************************************************************/
-void FDKaacEnc_AdjustThresholds(ATS_ELEMENT* AdjThrStateElement[(6)],
- QC_OUT_ELEMENT* qcElement[(6)],
+void FDKaacEnc_AdjustThresholds(ATS_ELEMENT* AdjThrStateElement[(8)],
+ QC_OUT_ELEMENT* qcElement[(8)],
QC_OUT* qcOut,
- PSY_OUT_ELEMENT* psyOutElement[(6)],
+ PSY_OUT_ELEMENT* psyOutElement[(8)],
INT CBRbitrateMode,
CHANNEL_MAPPING* cm)
{
@@ -2620,7 +2620,7 @@ void FDKaacEnc_AdjThrClose(ADJ_THR_STATE** phAdjThr)
ADJ_THR_STATE* hAdjThr = *phAdjThr;
if (hAdjThr!=NULL) {
- for (i=0; i<(6); i++) {
+ for (i=0; i<(8); i++) {
if (hAdjThr->adjThrStateElem[i]!=NULL) {
FreeRam_aacEnc_AdjThrStateElement(&hAdjThr->adjThrStateElem[i]);
}
diff --git a/libAACenc/src/adj_thr.h b/libAACenc/src/adj_thr.h
index a429dff..69b1dcc 100644
--- a/libAACenc/src/adj_thr.h
+++ b/libAACenc/src/adj_thr.h
@@ -112,7 +112,7 @@ INT FDKaacEnc_AdjThrNew(ADJ_THR_STATE** phAdjThr,
void FDKaacEnc_AdjThrInit(ADJ_THR_STATE *hAdjThr,
const INT peMean,
- ELEMENT_BITS* elBits[(6)],
+ ELEMENT_BITS* elBits[(8)],
INT invQuant,
INT nElements,
INT nChannelsEff,
@@ -135,10 +135,10 @@ void FDKaacEnc_DistributeBits(ADJ_THR_STATE *adjThrState,
const FIXP_DBL maxBitFac,
const INT bitDistributionMode);
-void FDKaacEnc_AdjustThresholds(ATS_ELEMENT* AdjThrStateElement[(6)],
- QC_OUT_ELEMENT* qcElement[(6)],
+void FDKaacEnc_AdjustThresholds(ATS_ELEMENT* AdjThrStateElement[(8)],
+ QC_OUT_ELEMENT* qcElement[(8)],
QC_OUT* qcOut,
- PSY_OUT_ELEMENT* psyOutElement[(6)],
+ PSY_OUT_ELEMENT* psyOutElement[(8)],
INT CBRbitrateMode,
CHANNEL_MAPPING* cm);
diff --git a/libAACenc/src/adj_thr_data.h b/libAACenc/src/adj_thr_data.h
index 675393e..3eb7678 100644
--- a/libAACenc/src/adj_thr_data.h
+++ b/libAACenc/src/adj_thr_data.h
@@ -144,7 +144,7 @@ typedef struct {
typedef struct {
BRES_PARAM bresParamLong, bresParamShort;
- ATS_ELEMENT* adjThrStateElem[(6)];
+ ATS_ELEMENT* adjThrStateElem[(8)];
} ADJ_THR_STATE;
#endif
diff --git a/libAACenc/src/bandwidth.cpp b/libAACenc/src/bandwidth.cpp
index da9b850..6fc7d87 100644
--- a/libAACenc/src/bandwidth.cpp
+++ b/libAACenc/src/bandwidth.cpp
@@ -316,6 +316,8 @@ AAC_ENCODER_ERROR FDKaacEnc_DetermineBandWidth(INT* bandWidth,
case MODE_1_2_2:
case MODE_1_2_2_1:
case MODE_1_2_2_2_1:
+ case MODE_7_1_REAR_SURROUND:
+ case MODE_7_1_FRONT_CENTER:
*bandWidth = bandWidthTableVBR[bitrateMode].bandWidth2AndMoreChan;
break;
default:
@@ -346,6 +348,8 @@ AAC_ENCODER_ERROR FDKaacEnc_DetermineBandWidth(INT* bandWidth,
case MODE_1_2_2: /* sce + cpe + cpe */
case MODE_1_2_2_1: /* (5.1) sce + cpe + cpe + lfe */
case MODE_1_2_2_2_1: /* (7.1) sce + cpe + cpe + cpe + lfe */
+ case MODE_7_1_REAR_SURROUND:
+ case MODE_7_1_FRONT_CENTER:
entryNo = 1; /* use stereo bandwith settings */
break;
diff --git a/libAACenc/src/bitenc.cpp b/libAACenc/src/bitenc.cpp
index 5e9eaf9..8e477aa 100644
--- a/libAACenc/src/bitenc.cpp
+++ b/libAACenc/src/bitenc.cpp
@@ -1360,7 +1360,7 @@ AAC_ENCODER_ERROR FDKaacEnc_WriteBitstream(HANDLE_TRANSPORTENC hTpEnc,
if ( (syntaxFlags & AC_ER) && !(syntaxFlags & AC_DRM) )
{
- UCHAR channelElementExtensionWritten[(6)][(1)]; /* 0: extension not touched, 1: extension already written */
+ UCHAR channelElementExtensionWritten[(8)][(1)]; /* 0: extension not touched, 1: extension already written */
FDKmemclear(channelElementExtensionWritten, sizeof(channelElementExtensionWritten));
diff --git a/libAACenc/src/channel_map.cpp b/libAACenc/src/channel_map.cpp
index 352f48c..559a4ce 100644
--- a/libAACenc/src/channel_map.cpp
+++ b/libAACenc/src/channel_map.cpp
@@ -124,7 +124,7 @@ amm-info@iis.fraunhofer.de
typedef struct {
CHANNEL_MODE encoderMode;
- INT channel_assignment[/*(6)*/12];
+ INT channel_assignment[/*(8)*/12];
} CHANNEL_ASSIGNMENT_INFO_TAB;
@@ -139,6 +139,8 @@ static const CHANNEL_ASSIGNMENT_INFO_TAB assignmentInfoTabMpeg[] =
{ MODE_1_2_2, { 0, 1, 2, 3, 4,-1,-1,-1,-1,-1,-1,-1} }, /* 5ch */
{ MODE_1_2_2_1, { 0, 1, 2, 3, 4, 5,-1,-1,-1,-1,-1,-1} }, /* 5.1ch */
{ MODE_1_2_2_2_1, { 0, 1, 2, 3, 4, 5, 6, 7,-1,-1,-1,-1} }, /* 7.1ch */
+ { MODE_7_1_REAR_SURROUND, { 0, 1, 2, 3, 4, 5, 6, 7,-1,-1,-1,-1} }, /* 7.1ch */
+ { MODE_7_1_FRONT_CENTER, { 0, 1, 2, 3, 4, 5, 6, 7,-1,-1,-1,-1} } /* 7.1ch */
};
static const CHANNEL_ASSIGNMENT_INFO_TAB assignmentInfoTabWav[] =
@@ -150,7 +152,9 @@ static const CHANNEL_ASSIGNMENT_INFO_TAB assignmentInfoTabWav[] =
{ MODE_1_2_1, { 2, 0, 1, 3,-1,-1,-1,-1,-1,-1,-1,-1} }, /* 4ch */
{ MODE_1_2_2, { 2, 0, 1, 3, 4,-1,-1,-1,-1,-1,-1,-1} }, /* 5ch */
{ MODE_1_2_2_1, { 2, 0, 1, 4, 5, 3,-1,-1,-1,-1,-1,-1} }, /* 5.1ch */
- { MODE_1_2_2_2_1, { 2, 0, 1, 6, 7, 4, 5, 3,-1,-1,-1,-1} }, /* 7.1ch */
+ { MODE_1_2_2_2_1, { 2, 6, 7, 0, 1, 4, 5, 3,-1,-1,-1,-1} }, /* 7.1ch */
+ { MODE_7_1_REAR_SURROUND, { 2, 0, 1, 6, 7, 4, 5, 3,-1,-1,-1,-1} }, /* 7.1ch */
+ { MODE_7_1_FRONT_CENTER, { 2, 6, 7, 0, 1, 4, 5, 3,-1,-1,-1,-1} }, /* 7.1ch */
};
/* Channel mode configuration tab provides,
@@ -165,6 +169,8 @@ static const CHANNEL_MODE_CONFIG_TAB channelModeConfig[] =
{ MODE_1_2_2, 5, 5, 3 }, /* SCE,CPE,CPE */
{ MODE_1_2_2_1, 6, 5, 4 }, /* SCE,CPE,CPE,LFE */
{ MODE_1_2_2_2_1, 8, 7, 5 }, /* SCE,CPE,CPE,CPE,LFE */
+ { MODE_7_1_REAR_SURROUND, 8, 7, 5 },
+ { MODE_7_1_FRONT_CENTER, 8, 7, 5 },
};
#define MAX_MODES (sizeof(assignmentInfoTabWav)/sizeof(CHANNEL_ASSIGNMENT_INFO_TAB))
@@ -315,6 +321,8 @@ AAC_ENCODER_ERROR FDKaacEnc_InitChannelMapping(CHANNEL_MODE mode, CHANNEL_ORDER
break;
case MODE_1_2_2_2_1:
+ case MODE_7_1_REAR_SURROUND:
+ case MODE_7_1_FRONT_CENTER:
/* (7.1) sce + cpe + cpe + cpe + lfe */
FDKaacEnc_initElement(&cm->elInfo[0], ID_SCE, &count, mode, co, it_cnt, FL2FXCONST_DBL(0.18f));
FDKaacEnc_initElement(&cm->elInfo[1], ID_CPE, &count, mode, co, it_cnt, FL2FXCONST_DBL(0.26f));
@@ -322,14 +330,13 @@ AAC_ENCODER_ERROR FDKaacEnc_InitChannelMapping(CHANNEL_MODE mode, CHANNEL_ORDER
FDKaacEnc_initElement(&cm->elInfo[3], ID_CPE, &count, mode, co, it_cnt, FL2FXCONST_DBL(0.26f));
FDKaacEnc_initElement(&cm->elInfo[4], ID_LFE, &count, mode, co, it_cnt, FL2FXCONST_DBL(0.04f));
break;
-
default:
//*chMap=0;
return AAC_ENC_UNSUPPORTED_CHANNELCONFIG;
};
- FDK_ASSERT(cm->nElements<=(6));
+ FDK_ASSERT(cm->nElements<=(8));
return AAC_ENC_OK;
@@ -442,19 +449,18 @@ AAC_ENCODER_ERROR FDKaacEnc_InitElementBits(QC_STATE *hQC,
break;
}
-
- case MODE_1_2_2_2_1:{
- /* (7.1) sce + cpe + cpe + cpe + lfe */
- hQC->elementBits[0]->relativeBitsEl = cm->elInfo[0].relativeBits;
- hQC->elementBits[1]->relativeBitsEl = cm->elInfo[1].relativeBits;
- hQC->elementBits[2]->relativeBitsEl = cm->elInfo[2].relativeBits;
- hQC->elementBits[3]->relativeBitsEl = cm->elInfo[3].relativeBits;
- hQC->elementBits[4]->relativeBitsEl = cm->elInfo[4].relativeBits;
- FIXP_DBL sceRate = cm->elInfo[0].relativeBits;
- FIXP_DBL cpe1Rate = cm->elInfo[1].relativeBits;
- FIXP_DBL cpe2Rate = cm->elInfo[2].relativeBits;
- FIXP_DBL cpe3Rate = cm->elInfo[3].relativeBits;
- FIXP_DBL lfeRate = cm->elInfo[4].relativeBits;
+ case MODE_7_1_REAR_SURROUND:
+ case MODE_7_1_FRONT_CENTER:
+ case MODE_1_2_2_2_1: {
+ int cpe3Idx = 3;
+ int lfeIdx = 4;
+
+ /* (7.1) sce + cpe + cpe + cpe + lfe */
+ FIXP_DBL sceRate = hQC->elementBits[0]->relativeBitsEl = cm->elInfo[0].relativeBits;
+ FIXP_DBL cpe1Rate = hQC->elementBits[1]->relativeBitsEl = cm->elInfo[1].relativeBits;
+ FIXP_DBL cpe2Rate = hQC->elementBits[2]->relativeBitsEl = cm->elInfo[2].relativeBits;
+ FIXP_DBL cpe3Rate = hQC->elementBits[cpe3Idx]->relativeBitsEl = cm->elInfo[cpe3Idx].relativeBits;
+ FIXP_DBL lfeRate = hQC->elementBits[lfeIdx]->relativeBitsEl = cm->elInfo[lfeIdx].relativeBits;
int maxBitsTot = maxChannelBits * 7; /* LFE does not add to bit reservoir */
int sc = CountLeadingBits(fixMax(maxChannelBits,averageBitsTot));
@@ -466,17 +472,16 @@ AAC_ENCODER_ERROR FDKaacEnc_InitElementBits(QC_STATE *hQC,
hQC->elementBits[0]->chBitrateEl = fMult(sceRate, (FIXP_DBL)(bitrateTot<<sc_brTot))>>sc_brTot;
hQC->elementBits[1]->chBitrateEl = fMult(cpe1Rate, (FIXP_DBL)(bitrateTot<<sc_brTot))>>(sc_brTot+1);
hQC->elementBits[2]->chBitrateEl = fMult(cpe2Rate, (FIXP_DBL)(bitrateTot<<sc_brTot))>>(sc_brTot+1);
- hQC->elementBits[3]->chBitrateEl = fMult(cpe3Rate, (FIXP_DBL)(bitrateTot<<sc_brTot))>>(sc_brTot+1);
- hQC->elementBits[4]->chBitrateEl = fMult(lfeRate, (FIXP_DBL)(bitrateTot<<sc_brTot))>>sc_brTot;
+ hQC->elementBits[cpe3Idx]->chBitrateEl = fMult(cpe3Rate, (FIXP_DBL)(bitrateTot<<sc_brTot))>>(sc_brTot+1);
+ hQC->elementBits[lfeIdx]->chBitrateEl = fMult(lfeRate, (FIXP_DBL)(bitrateTot<<sc_brTot))>>sc_brTot;
hQC->elementBits[0]->maxBitsEl = maxChannelBits;
hQC->elementBits[1]->maxBitsEl = 2*maxChannelBits;
hQC->elementBits[2]->maxBitsEl = 2*maxChannelBits;
- hQC->elementBits[3]->maxBitsEl = 2*maxChannelBits;
- hQC->elementBits[4]->maxBitsEl = maxLfeBits;
+ hQC->elementBits[cpe3Idx]->maxBitsEl = 2*maxChannelBits;
+ hQC->elementBits[lfeIdx]->maxBitsEl = maxLfeBits;
break;
}
-
default:
return AAC_ENC_UNSUPPORTED_CHANNELCONFIG;
}
@@ -518,6 +523,8 @@ ELEMENT_MODE FDKaacEnc_GetMonoStereoMode(const CHANNEL_MODE mode){
case MODE_1_2_2:
case MODE_1_2_2_1:
case MODE_1_2_2_2_1:
+ case MODE_7_1_REAR_SURROUND:
+ case MODE_7_1_FRONT_CENTER:
monoStereoSetting = EL_MODE_STEREO;
break;
default: /* error */
diff --git a/libAACenc/src/interface.h b/libAACenc/src/interface.h
index 2ec1852..51fb72a 100644
--- a/libAACenc/src/interface.h
+++ b/libAACenc/src/interface.h
@@ -156,8 +156,8 @@ typedef struct {
typedef struct {
- PSY_OUT_ELEMENT* psyOutElement[(6)];
- PSY_OUT_CHANNEL* pPsyOutChannels[(6)];
+ PSY_OUT_ELEMENT* psyOutElement[(8)];
+ PSY_OUT_CHANNEL* pPsyOutChannels[(8)];
}PSY_OUT;
diff --git a/libAACenc/src/metadata_compressor.cpp b/libAACenc/src/metadata_compressor.cpp
index 6fd8266..876de57 100644
--- a/libAACenc/src/metadata_compressor.cpp
+++ b/libAACenc/src/metadata_compressor.cpp
@@ -539,14 +539,25 @@ INT FDK_DRC_Generator_Initialize(
drcComp->channelIdx[RS] = channelMapping.elInfo[2].ChannelIndex[1];
break;
case MODE_1_2_2_2_1: /* 7.1 ch */
- drcComp->channelIdx[L] = channelMapping.elInfo[1].ChannelIndex[0];
- drcComp->channelIdx[R] = channelMapping.elInfo[1].ChannelIndex[1];
- drcComp->channelIdx[C] = channelMapping.elInfo[0].ChannelIndex[0];
- drcComp->channelIdx[LFE] = channelMapping.elInfo[4].ChannelIndex[0];
- drcComp->channelIdx[LS] = channelMapping.elInfo[2].ChannelIndex[0];
- drcComp->channelIdx[RS] = channelMapping.elInfo[2].ChannelIndex[1];
- drcComp->channelIdx[LS2] = channelMapping.elInfo[3].ChannelIndex[0];
- drcComp->channelIdx[RS2] = channelMapping.elInfo[3].ChannelIndex[1];
+ case MODE_7_1_FRONT_CENTER:
+ drcComp->channelIdx[L] = channelMapping.elInfo[2].ChannelIndex[0]; /* l */
+ drcComp->channelIdx[R] = channelMapping.elInfo[2].ChannelIndex[1]; /* r */
+ drcComp->channelIdx[C] = channelMapping.elInfo[0].ChannelIndex[0]; /* c */
+ drcComp->channelIdx[LFE] = channelMapping.elInfo[4].ChannelIndex[0]; /* lfe */
+ drcComp->channelIdx[LS] = channelMapping.elInfo[3].ChannelIndex[0]; /* ls */
+ drcComp->channelIdx[RS] = channelMapping.elInfo[3].ChannelIndex[1]; /* rs */
+ drcComp->channelIdx[LS2] = channelMapping.elInfo[1].ChannelIndex[0]; /* lc */
+ drcComp->channelIdx[RS2] = channelMapping.elInfo[1].ChannelIndex[1]; /* rc */
+ break;
+ case MODE_7_1_REAR_SURROUND:
+ drcComp->channelIdx[L] = channelMapping.elInfo[1].ChannelIndex[0]; /* l */
+ drcComp->channelIdx[R] = channelMapping.elInfo[1].ChannelIndex[1]; /* r */
+ drcComp->channelIdx[C] = channelMapping.elInfo[0].ChannelIndex[0]; /* c */
+ drcComp->channelIdx[LFE] = channelMapping.elInfo[4].ChannelIndex[0]; /* lfe */
+ drcComp->channelIdx[LS] = channelMapping.elInfo[3].ChannelIndex[0]; /* lrear */
+ drcComp->channelIdx[RS] = channelMapping.elInfo[3].ChannelIndex[1]; /* rrear */
+ drcComp->channelIdx[LS2] = channelMapping.elInfo[2].ChannelIndex[0]; /* ls */
+ drcComp->channelIdx[RS2] = channelMapping.elInfo[2].ChannelIndex[1]; /* rs */
break;
case MODE_1_1:
case MODE_1_1_1_1:
diff --git a/libAACenc/src/psy_main.cpp b/libAACenc/src/psy_main.cpp
index 0949b6d..59193c7 100644
--- a/libAACenc/src/psy_main.cpp
+++ b/libAACenc/src/psy_main.cpp
@@ -1340,7 +1340,7 @@ void FDKaacEnc_PsyClose(PSY_INTERNAL **phPsyInternal,
if (hPsyInternal)
{
- for (i=0; i<(6); i++) {
+ for (i=0; i<(8); i++) {
if (hPsyInternal->pStaticChannels[i]) {
if (hPsyInternal->pStaticChannels[i]->psyInputBuffer)
FreeRam_aacEnc_PsyInputBuffer(&hPsyInternal->pStaticChannels[i]->psyInputBuffer); /* AUDIO INPUT BUFFER */
@@ -1349,7 +1349,7 @@ void FDKaacEnc_PsyClose(PSY_INTERNAL **phPsyInternal,
}
}
- for (i=0; i<(6); i++) {
+ for (i=0; i<(8); i++) {
if (hPsyInternal->psyElement[i])
FreeRam_aacEnc_PsyElement(&hPsyInternal->psyElement[i]); /* PSY_ELEMENT */
}
@@ -1363,12 +1363,12 @@ void FDKaacEnc_PsyClose(PSY_INTERNAL **phPsyInternal,
for (n=0; n<(1); n++) {
if (phPsyOut[n])
{
- for (i=0; i<(6); i++) {
+ for (i=0; i<(8); i++) {
if (phPsyOut[n]->pPsyOutChannels[i])
FreeRam_aacEnc_PsyOutChannel(&phPsyOut[n]->pPsyOutChannels[i]); /* PSY_OUT_CHANNEL */
}
- for (i=0; i<(6); i++) {
+ for (i=0; i<(8); i++) {
if (phPsyOut[n]->psyOutElement[i])
FreeRam_aacEnc_PsyOutElements(&phPsyOut[n]->psyOutElement[i]); /* PSY_OUT_ELEMENTS */
}
diff --git a/libAACenc/src/psy_main.h b/libAACenc/src/psy_main.h
index 29edca5..7bdcc38 100644
--- a/libAACenc/src/psy_main.h
+++ b/libAACenc/src/psy_main.h
@@ -117,8 +117,8 @@ typedef struct {
typedef struct {
PSY_CONFIGURATION psyConf[2]; /* LONG / SHORT */
- PSY_ELEMENT* psyElement[(6)];
- PSY_STATIC* pStaticChannels[(6)];
+ PSY_ELEMENT* psyElement[(8)];
+ PSY_STATIC* pStaticChannels[(8)];
PSY_DYNAMIC* psyDynamic;
INT granuleLength;
diff --git a/libAACenc/src/qc_data.h b/libAACenc/src/qc_data.h
index 51e66c6..a9309c8 100644
--- a/libAACenc/src/qc_data.h
+++ b/libAACenc/src/qc_data.h
@@ -127,7 +127,7 @@ typedef struct {
INT nChannels;
INT nChannelsEff;
INT nElements;
- ELEMENT_INFO elInfo[(6)];
+ ELEMENT_INFO elInfo[(8)];
} CHANNEL_MAPPING;
typedef struct {
@@ -217,8 +217,8 @@ typedef struct
typedef struct
{
- QC_OUT_ELEMENT *qcElement[(6)];
- QC_OUT_CHANNEL *pQcOutChannels[(6)];
+ QC_OUT_ELEMENT *qcElement[(8)];
+ QC_OUT_CHANNEL *pQcOutChannels[(8)];
QC_OUT_EXTENSION extension[(2+2)]; /* global extension payload */
INT nExtensions; /* number of extension payloads for this AU */
INT maxDynBits; /* maximal allowed dynamic bits in frame */
@@ -265,7 +265,7 @@ typedef struct
PADDING padding;
- ELEMENT_BITS *elementBits[(6)];
+ ELEMENT_BITS *elementBits[(8)];
BITCNTR_STATE *hBitCounter;
ADJ_THR_STATE *hAdjThr;
diff --git a/libAACenc/src/qc_main.cpp b/libAACenc/src/qc_main.cpp
index 15646e9..b74510a 100644
--- a/libAACenc/src/qc_main.cpp
+++ b/libAACenc/src/qc_main.cpp
@@ -511,7 +511,7 @@ AAC_ENCODER_ERROR FDKaacEnc_AdjustBitrate(QC_STATE *RESTRICT hQC,
}
static AAC_ENCODER_ERROR FDKaacEnc_distributeElementDynBits(QC_STATE* hQC,
- QC_OUT_ELEMENT* qcElement[(6)],
+ QC_OUT_ELEMENT* qcElement[(8)],
CHANNEL_MAPPING* cm,
INT codeBits)
{
@@ -610,7 +610,7 @@ static AAC_ENCODER_ERROR FDKaacEnc_prepareBitDistribution(QC_STATE* h
PSY_OUT** psyOut,
QC_OUT** qcOut,
CHANNEL_MAPPING* cm,
- QC_OUT_ELEMENT* qcElement[(1)][(6)],
+ QC_OUT_ELEMENT* qcElement[(1)][(8)],
INT avgTotalBits,
INT *totalAvailableBits,
INT *avgTotalDynBits)
@@ -677,7 +677,7 @@ static AAC_ENCODER_ERROR FDKaacEnc_prepareBitDistribution(QC_STATE* h
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
static AAC_ENCODER_ERROR FDKaacEnc_updateUsedDynBits(INT* sumDynBitsConsumed,
- QC_OUT_ELEMENT* qcElement[(6)],
+ QC_OUT_ELEMENT* qcElement[(8)],
CHANNEL_MAPPING* cm)
{
INT i;
@@ -720,7 +720,7 @@ static INT FDKaacEnc_getTotalConsumedDynBits(QC_OUT** qcOut,
}
static INT FDKaacEnc_getTotalConsumedBits(QC_OUT** qcOut,
- QC_OUT_ELEMENT* qcElement[(1)][(6)],
+ QC_OUT_ELEMENT* qcElement[(1)][(8)],
CHANNEL_MAPPING* cm,
INT globHdrBits,
INT nSubFrames)
@@ -820,7 +820,7 @@ AAC_ENCODER_ERROR FDKaacEnc_QCMain(QC_STATE* RESTRICT hQC,
/*-------------------------------------------- */
/* helper pointer */
- QC_OUT_ELEMENT* qcElement[(1)][(6)];
+ QC_OUT_ELEMENT* qcElement[(1)][(8)];
/* work on a copy of qcChannel and qcElement */
for (i=0; i<cm->nElements; i++)
@@ -897,10 +897,10 @@ AAC_ENCODER_ERROR FDKaacEnc_QCMain(QC_STATE* RESTRICT hQC,
} /* -end- sub frame counter */
/*-------------------------------------------- */
- INT iterations[(1)][(6)];
- INT chConstraintsFulfilled[(1)][(6)][(2)];
- INT calculateQuant[(1)][(6)][(2)];
- INT constraintsFulfilled[(1)][(6)];
+ INT iterations[(1)][(8)];
+ INT chConstraintsFulfilled[(1)][(8)][(2)];
+ INT calculateQuant[(1)][(8)][(2)];
+ INT constraintsFulfilled[(1)][(8)];
/*-------------------------------------------- */
@@ -1247,7 +1247,7 @@ static AAC_ENCODER_ERROR FDKaacEnc_reduceBitConsumption(int* iterati
AAC_ENCODER_ERROR FDKaacEnc_updateFillBits(CHANNEL_MAPPING* cm,
QC_STATE* qcKernel,
- ELEMENT_BITS* RESTRICT elBits[(6)],
+ ELEMENT_BITS* RESTRICT elBits[(8)],
QC_OUT** qcOut)
{
switch (qcKernel->bitrateMode) {
@@ -1603,10 +1603,10 @@ void FDKaacEnc_QCClose (QC_STATE **phQCstate, QC_OUT **phQC)
for (n=0;n<(1);n++) {
if (phQC[n] != NULL) {
QC_OUT *hQC = phQC[n];
- for (i=0; i<(6); i++) {
+ for (i=0; i<(8); i++) {
}
- for (i=0; i<(6); i++) {
+ for (i=0; i<(8); i++) {
if (hQC->qcElement[i])
FreeRam_aacEnc_QCelement(&hQC->qcElement[i]);
}
@@ -1626,7 +1626,7 @@ void FDKaacEnc_QCClose (QC_STATE **phQCstate, QC_OUT **phQC)
if (hQCstate->hBitCounter != NULL)
FDKaacEnc_BCClose(&hQCstate->hBitCounter);
- for (i=0; i<(6); i++) {
+ for (i=0; i<(8); i++) {
if (hQCstate->elementBits[i]!=NULL) {
FreeRam_aacEnc_ElementBits(&hQCstate->elementBits[i]);
}
diff --git a/libAACenc/src/qc_main.h b/libAACenc/src/qc_main.h
index e1f5787..4e8c042 100644
--- a/libAACenc/src/qc_main.h
+++ b/libAACenc/src/qc_main.h
@@ -140,7 +140,7 @@ AAC_ENCODER_ERROR FDKaacEnc_QCMain(QC_STATE* RESTRICT hQC,
AAC_ENCODER_ERROR FDKaacEnc_updateFillBits(CHANNEL_MAPPING* cm,
QC_STATE* qcKernel,
- ELEMENT_BITS* RESTRICT elBits[(6)],
+ ELEMENT_BITS* RESTRICT elBits[(8)],
QC_OUT** qcOut);