Commit fa3eba16 authored by Jean-Michel Trivi's avatar Jean-Michel Trivi

Encoder 7.1 support

* AAC-Encoder

   - Add 7.1 rear surround and 7.1 front center support to supported encoder
     channel modes. Change max channels from 6 to 8 and add 7.1 configuration
     to bandwidth and channel mapping functions.
     Modified file(s):
        libAACenc\include\aacenc_lib.h
        libAACenc\src\aacEnc_ram.cpp
        libAACenc\src\aacEnc_ram.h
        libAACenc\src\aacenc.cpp
        libAACenc\src\aacenc.h
        libAACenc\src\aacenc_lib.cpp
        libAACenc\src\adj_thr.cpp
        libAACenc\src\adj_thr.h
        libAACenc\src\adj_thr_data.h
        libAACenc\src\bandwidth.cpp
        libAACenc\src\bitenc.cpp
        libAACenc\src\channel_map.cpp
        libAACenc\src\interface.h
        libAACenc\src\metadata_compressor.cpp
        libAACenc\src\psy_main.cpp
        libAACenc\src\psy_main.h
        libAACenc\src\qc_data.h
        libAACenc\src\qc_main.cpp
        libAACenc\src\qc_main.h

* SBR-Encoder

   - Support up to 7.1 audio channels. Changed max channels from 6 to 8.
     Modified file(s):
        libSBRenc\include\sbr_encoder.h
        libSBRenc\src\sbr.h
        libSBRenc\src\sbr_encoder.cpp
        libSBRenc\src\sbr_ram.cpp

* Transport-Encoder
   - Add 7.1 channel configuration to audio specific config writer in
     transport encoder library.
     Modified file(s):
        libMpegTPEnc\src\tpenc_asc.cpp
        libMpegTPEnc\src\version

* SYS-Library
   - Add 7.1 channel modes to CHANNEL_MODE description.
     Modified file(s):
        libSYS\include\FDK_audio.h
        libSYS\src\genericStds.cpp

Bug 9428126

Change-Id: Ide53583aa8e03df4537b98db80740dfe0e7a9e0f
parent 9f455bea
...@@ -377,16 +377,20 @@ For user defined Configurations the Channel Configuration is set to 0 and the Ch ...@@ -377,16 +377,20 @@ For user defined Configurations the Channel Configuration is set to 0 and the Ch
Program Config Element. The present Encoder implementation does not allow the user to configure this Channel Configuration from Program Config Element. The present Encoder implementation does not allow the user to configure this Channel Configuration from
extern. The Encoder implementation supports fixed Channel Modes which are mapped to Channel Configuration as follow. extern. The Encoder implementation supports fixed Channel Modes which are mapped to Channel Configuration as follow.
\verbatim \verbatim
-------------------------------------------------------------------- -------------------------------------------------------------------------------
ChannelMode | ChCfg | front_El | side_El | back_El | lfe_El ChannelMode | ChCfg | front_El | side_El | back_El | lfe_El
-----------------+--------+----------+----------+----------+-------- -----------------------+--------+---------------+----------+----------+--------
MODE_1 | 1 | SCE | | | MODE_1 | 1 | SCE | | |
MODE_2 | 2 | CPE | | | MODE_2 | 2 | CPE | | |
MODE_1_2 | 3 | SCE, CPE | | | MODE_1_2 | 3 | SCE, CPE | | |
MODE_1_2_1 | 4 | SCE, CPE | | SCE | MODE_1_2_1 | 4 | SCE, CPE | | SCE |
MODE_1_2_2 | 5 | SCE, CPE | | CPE | MODE_1_2_2 | 5 | SCE, CPE | | CPE |
MODE_1_2_2_1 | 6 | SCE, CPE | | CPE | LFE MODE_1_2_2_1 | 6 | SCE, CPE | | CPE | LFE
-------------------------------------------------------------------- MODE_1_2_2_2_1 | 7 | SCE, CPE, CPE | | CPE | LFE
-----------------------+--------+---------------+----------+----------+--------
MODE_7_1_REAR_SURROUND | 0 | SCE, CPE | | CPE, CPE | LFE
MODE_7_1_FRONT_CENTER | 0 | SCE, CPE, CPE | | CPE | LFE
-------------------------------------------------------------------------------
- SCE: Single Channel Element. - SCE: Single Channel Element.
- CPE: Channel Pair. - CPE: Channel Pair.
- SCE: Low Frequency Element. - SCE: Low Frequency Element.
...@@ -402,16 +406,20 @@ Beside the Channel Element assignment the Channel Modes are resposible for audio ...@@ -402,16 +406,20 @@ Beside the Channel Element assignment the Channel Modes are resposible for audio
of the audio data depends on the selected ::AACENC_CHANNELORDER which can be MPEG or WAV like order.\n of the audio data depends on the selected ::AACENC_CHANNELORDER which can be MPEG or WAV like order.\n
Following Table describes the complete channel mapping for both Channel Order configurations. Following Table describes the complete channel mapping for both Channel Order configurations.
\verbatim \verbatim
--------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------
ChannelMode | MPEG-Channelorder | WAV-Channelorder ChannelMode | MPEG-Channelorder | WAV-Channelorder
-----------------+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+--- -----------------------+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---
MODE_1 | 0 | | | | | | | | 0 | | | | | | | MODE_1 | 0 | | | | | | | | 0 | | | | | | |
MODE_2 | 0 | 1 | | | | | | | 0 | 1 | | | | | | MODE_2 | 0 | 1 | | | | | | | 0 | 1 | | | | | |
MODE_1_2 | 0 | 1 | 2 | | | | | | 2 | 0 | 1 | | | | | MODE_1_2 | 0 | 1 | 2 | | | | | | 2 | 0 | 1 | | | | |
MODE_1_2_1 | 0 | 1 | 2 | 3 | | | | | 2 | 0 | 1 | 3 | | | | MODE_1_2_1 | 0 | 1 | 2 | 3 | | | | | 2 | 0 | 1 | 3 | | | |
MODE_1_2_2 | 0 | 1 | 2 | 3 | 4 | | | | 2 | 0 | 1 | 3 | 4 | | | MODE_1_2_2 | 0 | 1 | 2 | 3 | 4 | | | | 2 | 0 | 1 | 3 | 4 | | |
MODE_1_2_2_1 | 0 | 1 | 2 | 3 | 4 | 5 | | | 2 | 0 | 1 | 4 | 5 | 3 | | MODE_1_2_2_1 | 0 | 1 | 2 | 3 | 4 | 5 | | | 2 | 0 | 1 | 4 | 5 | 3 | |
--------------------------------------------------------------------------------- MODE_1_2_2_2_1 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 2 | 6 | 7 | 0 | 1 | 4 | 5 | 3
-----------------------+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---
MODE_7_1_REAR_SURROUND | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 2 | 0 | 1 | 6 | 7 | 4 | 5 | 3
MODE_7_1_FRONT_CENTER | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 2 | 6 | 7 | 0 | 1 | 4 | 5 | 3
---------------------------------------------------------------------------------------
\endverbatim \endverbatim
The denoted mapping is important for correct audio channel assignment when using MPEG or WAV ordering. The incoming audio The denoted mapping is important for correct audio channel assignment when using MPEG or WAV ordering. The incoming audio
...@@ -920,7 +928,7 @@ typedef enum ...@@ -920,7 +928,7 @@ typedef enum
- 480: Optional length in LD/ELD configuration. */ - 480: Optional length in LD/ELD configuration. */
AACENC_CHANNELMODE = 0x0106, /*!< Set explicit channel mode. Channel mode must match with number of input channels. AACENC_CHANNELMODE = 0x0106, /*!< Set explicit channel mode. Channel mode must match with number of input channels.
- 1-6: MPEG channel modes supported, see ::CHANNEL_MODE in FDK_audio.h. */ - 1-7 and 33,34: MPEG channel modes supported, see ::CHANNEL_MODE in FDK_audio.h. */
AACENC_CHANNELORDER = 0x0107, /*!< Input audio data channel ordering scheme: AACENC_CHANNELORDER = 0x0107, /*!< Input audio data channel ordering scheme:
- 0: MPEG channel ordering (e. g. 5.1: C, L, R, SL, SR, LFE). (default) - 0: MPEG channel ordering (e. g. 5.1: C, L, R, SL, SR, LFE). (default)
......
...@@ -119,12 +119,12 @@ C_ALLOC_MEM (Ram_aacEnc_AacEncoder, AAC_ENC, 1) ...@@ -119,12 +119,12 @@ C_ALLOC_MEM (Ram_aacEnc_AacEncoder, AAC_ENC, 1)
PsyInputBuffer. 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_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) { PSY_DYNAMIC *GetRam_aacEnc_PsyDynamic (int n, UCHAR* dynamic_RAM) {
FDK_ASSERT(dynamic_RAM!=0); FDK_ASSERT(dynamic_RAM!=0);
...@@ -139,8 +139,8 @@ C_ALLOC_MEM2 (Ram_aacEnc_PsyInputBuffer, INT_PCM, MAX_INPUT_BUFFER_SIZE, (6)) ...@@ -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_PsyOut, PSY_OUT, 1, (1))
C_ALLOC_MEM2 (Ram_aacEnc_PsyOutElements, PSY_OUT_ELEMENT, 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)*(6)) 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)) ...@@ -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_QCstate, QC_STATE, 1)
C_ALLOC_MEM (Ram_aacEnc_AdjustThreshold, ADJ_THR_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_AdjThrStateElement, ATS_ELEMENT, 1, (8))
C_ALLOC_MEM2 (Ram_aacEnc_ElementBits, ELEMENT_BITS, 1, (6)) C_ALLOC_MEM2 (Ram_aacEnc_ElementBits, ELEMENT_BITS, 1, (8))
C_ALLOC_MEM (Ram_aacEnc_BitCntrState, BITCNTR_STATE, 1) C_ALLOC_MEM (Ram_aacEnc_BitCntrState, BITCNTR_STATE, 1)
INT *GetRam_aacEnc_BitLookUp(int n, UCHAR* dynamic_RAM) { INT *GetRam_aacEnc_BitLookUp(int n, UCHAR* dynamic_RAM) {
...@@ -175,7 +175,7 @@ C_ALLOC_MEM (Ram_aacEnc_BitCntrState, BITCNTR_STATE, 1) ...@@ -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_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) { QC_OUT_CHANNEL *GetRam_aacEnc_QCchannel (int n, UCHAR* dynamic_RAM) {
FDK_ASSERT(dynamic_RAM!=0); FDK_ASSERT(dynamic_RAM!=0);
return ((QC_OUT_CHANNEL*) (dynamic_RAM + P_BUF_0 + n*sizeof(QC_OUT_CHANNEL))); return ((QC_OUT_CHANNEL*) (dynamic_RAM + P_BUF_0 + n*sizeof(QC_OUT_CHANNEL)));
......
...@@ -118,7 +118,7 @@ amm-info@iis.fraunhofer.de ...@@ -118,7 +118,7 @@ amm-info@iis.fraunhofer.de
*/ */
/* define hBitstream size: max AAC framelength is 6144 bits/channel */ /* 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 { struct AAC_ENC {
...@@ -173,7 +173,7 @@ 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), \ #define BUF_SIZE_1 ( ALIGN_SIZE(maxSize(sizeof(PSY_DYNAMIC), \
(BIT_LOOK_UP_SIZE+MERGE_GAIN_LOOK_UP_SIZE))) ) (BIT_LOOK_UP_SIZE+MERGE_GAIN_LOOK_UP_SIZE))) )
......
...@@ -393,7 +393,7 @@ AAC_ENCODER_ERROR FDKaacEnc_Initialize(HANDLE_AAC_ENC hAacEnc, ...@@ -393,7 +393,7 @@ AAC_ENCODER_ERROR FDKaacEnc_Initialize(HANDLE_AAC_ENC hAacEnc,
/******************* sanity checks *******************/ /******************* sanity checks *******************/
/* check config structure */ /* check config structure */
if (config->nChannels < 1 || config->nChannels > (6)) { if (config->nChannels < 1 || config->nChannels > (8)) {
return AAC_ENC_UNSUPPORTED_CHANNELCONFIG; return AAC_ENC_UNSUPPORTED_CHANNELCONFIG;
} }
......
...@@ -154,7 +154,7 @@ typedef enum { ...@@ -154,7 +154,7 @@ typedef enum {
#define ANC_DATA_BUFFERSIZE 1024 /* ancBuffer size */ #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 { typedef enum {
......
...@@ -98,7 +98,7 @@ amm-info@iis.fraunhofer.de ...@@ -98,7 +98,7 @@ amm-info@iis.fraunhofer.de
/* Encoder library info */ /* Encoder library info */
#define AACENCODER_LIB_VL0 3 #define AACENCODER_LIB_VL0 3
#define AACENCODER_LIB_VL1 4 #define AACENCODER_LIB_VL1 4
#define AACENCODER_LIB_VL2 11 #define AACENCODER_LIB_VL2 12
#define AACENCODER_LIB_TITLE "AAC Encoder" #define AACENCODER_LIB_TITLE "AAC Encoder"
#define AACENCODER_LIB_BUILD_DATE __DATE__ #define AACENCODER_LIB_BUILD_DATE __DATE__
#define AACENCODER_LIB_BUILD_TIME __TIME__ #define AACENCODER_LIB_BUILD_TIME __TIME__
...@@ -215,8 +215,8 @@ struct AACENCODER ...@@ -215,8 +215,8 @@ struct AACENCODER
AACENC_EXT_PAYLOAD extPayload [MAX_TOTAL_EXT_PAYLOADS]; AACENC_EXT_PAYLOAD extPayload [MAX_TOTAL_EXT_PAYLOADS];
/* Extension payload */ /* Extension payload */
UCHAR extPayloadData [(1)][(6)][MAX_PAYLOAD_SIZE]; UCHAR extPayloadData [(1)][(8)][MAX_PAYLOAD_SIZE];
UINT extPayloadSize [(1)][(6)]; /* payload sizes in bits */ UINT extPayloadSize [(1)][(8)]; /* payload sizes in bits */
ULONG InitFlags; /* internal status to treggier re-initialization */ ULONG InitFlags; /* internal status to treggier re-initialization */
...@@ -699,8 +699,8 @@ INT aacEncoder_LimitBitrate( ...@@ -699,8 +699,8 @@ INT aacEncoder_LimitBitrate(
/* Find total bitrate which provides valid configuration for each SBR element. */ /* Find total bitrate which provides valid configuration for each SBR element. */
do { do {
int e; int e;
SBR_ELEMENT_INFO sbrElInfo[(6)]; SBR_ELEMENT_INFO sbrElInfo[(8)];
FDK_ASSERT(cm.nElements <= (6)); FDK_ASSERT(cm.nElements <= (8));
initialBitrate = adjustedBitrate; initialBitrate = adjustedBitrate;
...@@ -1061,7 +1061,7 @@ static AACENC_ERROR aacEncInit(HANDLE_AACENCODER hAacEncoder, ...@@ -1061,7 +1061,7 @@ static AACENC_ERROR aacEncInit(HANDLE_AACENCODER hAacEncoder,
((InitFlags & AACENC_INIT_CONFIG) || (InitFlags & AACENC_INIT_STATES)) ) ((InitFlags & AACENC_INIT_CONFIG) || (InitFlags & AACENC_INIT_STATES)) )
{ {
INT sbrError; INT sbrError;
SBR_ELEMENT_INFO sbrElInfo[(6)]; SBR_ELEMENT_INFO sbrElInfo[(8)];
CHANNEL_MAPPING channelMapping; CHANNEL_MAPPING channelMapping;
if ( FDKaacEnc_InitChannelMapping(hAacConfig->channelMode, if ( FDKaacEnc_InitChannelMapping(hAacConfig->channelMode,
...@@ -1072,7 +1072,7 @@ static AACENC_ERROR aacEncInit(HANDLE_AACENCODER hAacEncoder, ...@@ -1072,7 +1072,7 @@ static AACENC_ERROR aacEncInit(HANDLE_AACENCODER hAacEncoder,
} }
/* Check return value and if the SBR encoder can handle enough elements */ /* Check return value and if the SBR encoder can handle enough elements */
if (channelMapping.nElements > (6)) { if (channelMapping.nElements > (8)) {
return AACENC_INIT_ERROR; return AACENC_INIT_ERROR;
} }
...@@ -1249,8 +1249,8 @@ AACENC_ERROR aacEncOpen( ...@@ -1249,8 +1249,8 @@ AACENC_ERROR aacEncOpen(
/* Determine max channel configuration. */ /* Determine max channel configuration. */
if (maxChannels==0) { if (maxChannels==0) {
hAacEncoder->nMaxAacChannels = (6); hAacEncoder->nMaxAacChannels = (8);
hAacEncoder->nMaxSbrChannels = (6); hAacEncoder->nMaxSbrChannels = (8);
} }
else { else {
hAacEncoder->nMaxAacChannels = (maxChannels&0x00FF); hAacEncoder->nMaxAacChannels = (maxChannels&0x00FF);
...@@ -1258,15 +1258,15 @@ AACENC_ERROR aacEncOpen( ...@@ -1258,15 +1258,15 @@ AACENC_ERROR aacEncOpen(
hAacEncoder->nMaxSbrChannels = (maxChannels&0xFF00) ? (maxChannels>>8) : hAacEncoder->nMaxAacChannels; 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; err = AACENC_INVALID_CONFIG;
goto bail; goto bail;
} }
} /* maxChannels==0 */ } /* maxChannels==0 */
/* Max number of elements could be tuned any more. */ /* Max number of elements could be tuned any more. */
hAacEncoder->nMaxAacElements = fixMin((6), hAacEncoder->nMaxAacChannels); hAacEncoder->nMaxAacElements = fixMin((8), hAacEncoder->nMaxAacChannels);
hAacEncoder->nMaxSbrElements = fixMin((6), hAacEncoder->nMaxSbrChannels); hAacEncoder->nMaxSbrElements = fixMin((8), hAacEncoder->nMaxSbrChannels);
hAacEncoder->nMaxSubFrames = (1); hAacEncoder->nMaxSubFrames = (1);
...@@ -1595,7 +1595,7 @@ AACENC_ERROR aacEncEncode( ...@@ -1595,7 +1595,7 @@ AACENC_ERROR aacEncEncode(
} }
else { else {
/* Add SBR extension payload */ /* Add SBR extension payload */
for (i = 0; i < (6); i++) { for (i = 0; i < (8); i++) {
if (hAacEncoder->extPayloadSize[nPayload][i] > 0) { if (hAacEncoder->extPayloadSize[nPayload][i] > 0) {
hAacEncoder->extPayload[nExtensions].pData = hAacEncoder->extPayloadData[nPayload][i]; hAacEncoder->extPayload[nExtensions].pData = hAacEncoder->extPayloadData[nPayload][i];
{ {
...@@ -1850,7 +1850,7 @@ AACENC_ERROR aacEncoder_SetParam( ...@@ -1850,7 +1850,7 @@ AACENC_ERROR aacEncoder_SetParam(
} }
if ( (pConfig->nElements > hAacEncoder->nMaxAacElements) if ( (pConfig->nElements > hAacEncoder->nMaxAacElements)
|| (pConfig->nChannelsEff > hAacEncoder->nMaxAacChannels) || (pConfig->nChannelsEff > hAacEncoder->nMaxAacChannels)
|| !((value>=1) && (value<=6)) || !(((value>=1) && (value<=7))||((value>=33) && (value<=34)))
) )
{ {
err = AACENC_INVALID_CONFIG; err = AACENC_INVALID_CONFIG;
......
...@@ -1137,12 +1137,12 @@ the difference can be distributed among the scale factor bands. ...@@ -1137,12 +1137,12 @@ the difference can be distributed among the scale factor bands.
New thresholds can be derived from this pe-difference New thresholds can be derived from this pe-difference
*****************************************************************************/ *****************************************************************************/
static void FDKaacEnc_correctThresh(CHANNEL_MAPPING* cm, static void FDKaacEnc_correctThresh(CHANNEL_MAPPING* cm,
QC_OUT_ELEMENT* qcElement[(6)], QC_OUT_ELEMENT* qcElement[(8)],
PSY_OUT_ELEMENT* psyOutElement[(6)], PSY_OUT_ELEMENT* psyOutElement[(8)],
UCHAR ahFlag[(6)][(2)][MAX_GROUPED_SFB], UCHAR ahFlag[(8)][(2)][MAX_GROUPED_SFB],
FIXP_DBL thrExp[(6)][(2)][MAX_GROUPED_SFB], FIXP_DBL thrExp[(8)][(2)][MAX_GROUPED_SFB],
const FIXP_DBL redVal[(6)], const FIXP_DBL redVal[(8)],
const SCHAR redValScaling[(6)], const SCHAR redValScaling[(8)],
const INT deltaPe, const INT deltaPe,
const INT processElements, const INT processElements,
const INT elementOffset) const INT elementOffset)
...@@ -1153,8 +1153,8 @@ static void FDKaacEnc_correctThresh(CHANNEL_MAPPING* cm, ...@@ -1153,8 +1153,8 @@ static void FDKaacEnc_correctThresh(CHANNEL_MAPPING* cm,
PE_CHANNEL_DATA *peChanData; PE_CHANNEL_DATA *peChanData;
FIXP_DBL thrFactorLdData; FIXP_DBL thrFactorLdData;
FIXP_DBL sfbEnLdData, sfbThrLdData, sfbThrReducedLdData; FIXP_DBL sfbEnLdData, sfbThrLdData, sfbThrReducedLdData;
FIXP_DBL *sfbPeFactorsLdData[(6)][(2)]; FIXP_DBL *sfbPeFactorsLdData[(8)][(2)];
FIXP_DBL sfbNActiveLinesLdData[(6)][(2)][MAX_GROUPED_SFB]; FIXP_DBL sfbNActiveLinesLdData[(8)][(2)][MAX_GROUPED_SFB];
INT normFactorInt; INT normFactorInt;
FIXP_DBL normFactorLdData; FIXP_DBL normFactorLdData;
...@@ -1308,9 +1308,9 @@ static void FDKaacEnc_correctThresh(CHANNEL_MAPPING* cm, ...@@ -1308,9 +1308,9 @@ static void FDKaacEnc_correctThresh(CHANNEL_MAPPING* cm,
reducing minSnr reducing minSnr
*****************************************************************************/ *****************************************************************************/
void FDKaacEnc_reduceMinSnr(CHANNEL_MAPPING* cm, void FDKaacEnc_reduceMinSnr(CHANNEL_MAPPING* cm,
QC_OUT_ELEMENT* qcElement[(6)], QC_OUT_ELEMENT* qcElement[(8)],
PSY_OUT_ELEMENT* psyOutElement[(6)], PSY_OUT_ELEMENT* psyOutElement[(8)],
UCHAR ahFlag[(6)][(2)][MAX_GROUPED_SFB], UCHAR ahFlag[(8)][(2)][MAX_GROUPED_SFB],
const INT desiredPe, const INT desiredPe,
INT* redPeGlobal, INT* redPeGlobal,
const INT processElements, const INT processElements,
...@@ -1410,10 +1410,10 @@ bail: ...@@ -1410,10 +1410,10 @@ bail:
bands have to be quantized to zero bands have to be quantized to zero
*****************************************************************************/ *****************************************************************************/
static void FDKaacEnc_allowMoreHoles(CHANNEL_MAPPING* cm, static void FDKaacEnc_allowMoreHoles(CHANNEL_MAPPING* cm,
QC_OUT_ELEMENT* qcElement[(6)], QC_OUT_ELEMENT* qcElement[(8)],
PSY_OUT_ELEMENT* psyOutElement[(6)], PSY_OUT_ELEMENT* psyOutElement[(8)],
ATS_ELEMENT* AdjThrStateElement[(6)], ATS_ELEMENT* AdjThrStateElement[(8)],
UCHAR ahFlag[(6)][(2)][MAX_GROUPED_SFB], UCHAR ahFlag[(8)][(2)][MAX_GROUPED_SFB],
const INT desiredPe, const INT desiredPe,
const INT currentPe, const INT currentPe,
const int processElements, const int processElements,
...@@ -1645,17 +1645,17 @@ functionname: FDKaacEnc_adaptThresholdsToPe ...@@ -1645,17 +1645,17 @@ functionname: FDKaacEnc_adaptThresholdsToPe
description: two guesses for the reduction value and one final correction of the thresholds description: two guesses for the reduction value and one final correction of the thresholds
*****************************************************************************/ *****************************************************************************/
static void FDKaacEnc_adaptThresholdsToPe(CHANNEL_MAPPING* cm, static void FDKaacEnc_adaptThresholdsToPe(CHANNEL_MAPPING* cm,
ATS_ELEMENT* AdjThrStateElement[(6)], ATS_ELEMENT* AdjThrStateElement[(8)],
QC_OUT_ELEMENT* qcElement[(6)], QC_OUT_ELEMENT* qcElement[(8)],
PSY_OUT_ELEMENT* psyOutElement[(6)], PSY_OUT_ELEMENT* psyOutElement[(8)],
const INT desiredPe, const INT desiredPe,
const INT processElements, const INT processElements,
const INT elementOffset) const INT elementOffset)
{ {
FIXP_DBL redValue[(6)]; FIXP_DBL redValue[(8)];
SCHAR redValScaling[(6)]; SCHAR redValScaling[(8)];
UCHAR pAhFlag[(6)][(2)][MAX_GROUPED_SFB]; UCHAR pAhFlag[(8)][(2)][MAX_GROUPED_SFB];
FIXP_DBL pThrExp[(6)][(2)][MAX_GROUPED_SFB]; FIXP_DBL pThrExp[(8)][(2)][MAX_GROUPED_SFB];
int iter; int iter;
INT constPartGlobal, noRedPeGlobal, nActiveLinesGlobal, redPeGlobal; INT constPartGlobal, noRedPeGlobal, nActiveLinesGlobal, redPeGlobal;
...@@ -2219,7 +2219,7 @@ description: initialize ADJ_THR_STATE ...@@ -2219,7 +2219,7 @@ description: initialize ADJ_THR_STATE
void FDKaacEnc_AdjThrInit( void FDKaacEnc_AdjThrInit(
ADJ_THR_STATE *hAdjThr, ADJ_THR_STATE *hAdjThr,
const INT meanPe, const INT meanPe,
ELEMENT_BITS *elBits[(6)], ELEMENT_BITS *elBits[(8)],
INT invQuant, INT invQuant,
INT nElements, INT nElements,
INT nChannelsEff, INT nChannelsEff,
...@@ -2540,10 +2540,10 @@ void FDKaacEnc_DistributeBits(ADJ_THR_STATE *adjThrState, ...@@ -2540,10 +2540,10 @@ void FDKaacEnc_DistributeBits(ADJ_THR_STATE *adjThrState,
functionname: FDKaacEnc_AdjustThresholds functionname: FDKaacEnc_AdjustThresholds
description: adjust thresholds description: adjust thresholds
*****************************************************************************/ *****************************************************************************/
void FDKaacEnc_AdjustThresholds(ATS_ELEMENT* AdjThrStateElement[(6)], void FDKaacEnc_AdjustThresholds(ATS_ELEMENT* AdjThrStateElement[(8)],
QC_OUT_ELEMENT* qcElement[(6)], QC_OUT_ELEMENT* qcElement[(8)],
QC_OUT* qcOut, QC_OUT* qcOut,
PSY_OUT_ELEMENT* psyOutElement[(6)], PSY_OUT_ELEMENT* psyOutElement[(8)],
INT CBRbitrateMode, INT CBRbitrateMode,
CHANNEL_MAPPING* cm) CHANNEL_MAPPING* cm)
{ {
...@@ -2620,7 +2620,7 @@ void FDKaacEnc_AdjThrClose(ADJ_THR_STATE** phAdjThr) ...@@ -2620,7 +2620,7 @@ void FDKaacEnc_AdjThrClose(ADJ_THR_STATE** phAdjThr)
ADJ_THR_STATE* hAdjThr = *phAdjThr; ADJ_THR_STATE* hAdjThr = *phAdjThr;
if (hAdjThr!=NULL) { if (hAdjThr!=NULL) {
for (i=0; i<(6); i++) { for (i=0; i<(8); i++) {
if (hAdjThr->adjThrStateElem[i]!=NULL) { if (hAdjThr->adjThrStateElem[i]!=NULL) {
FreeRam_aacEnc_AdjThrStateElement(&hAdjThr->adjThrStateElem[i]); FreeRam_aacEnc_AdjThrStateElement(&hAdjThr->adjThrStateElem[i]);
} }
......
...@@ -112,7 +112,7 @@ INT FDKaacEnc_AdjThrNew(ADJ_THR_STATE** phAdjThr, ...@@ -112,7 +112,7 @@ INT FDKaacEnc_AdjThrNew(ADJ_THR_STATE** phAdjThr,
void FDKaacEnc_AdjThrInit(ADJ_THR_STATE *hAdjThr, void FDKaacEnc_AdjThrInit(ADJ_THR_STATE *hAdjThr,
const INT peMean, const INT peMean,
ELEMENT_BITS* elBits[(6)], ELEMENT_BITS* elBits[(8)],
INT invQuant, INT invQuant,
INT nElements, INT nElements,
INT nChannelsEff, INT nChannelsEff,
...@@ -135,10 +135,10 @@ void FDKaacEnc_DistributeBits(ADJ_THR_STATE *adjThrState, ...@@ -135,10 +135,10 @@ void FDKaacEnc_DistributeBits(ADJ_THR_STATE *adjThrState,
const FIXP_DBL maxBitFac, const FIXP_DBL maxBitFac,
const INT bitDistributionMode); const INT bitDistributionMode);
void FDKaacEnc_AdjustThresholds(ATS_ELEMENT* AdjThrStateElement[(6)], void FDKaacEnc_AdjustThresholds(ATS_ELEMENT* AdjThrStateElement[(8)],
QC_OUT_ELEMENT* qcElement[(6)], QC_OUT_ELEMENT* qcElement[(8)],
QC_OUT* qcOut, QC_OUT* qcOut,
PSY_OUT_ELEMENT* psyOutElement[(6)], PSY_OUT_ELEMENT* psyOutElement[(8)],
INT CBRbitrateMode, INT CBRbitrateMode,
CHANNEL_MAPPING* cm); CHANNEL_MAPPING* cm);
......
...@@ -144,7 +144,7 @@ typedef struct { ...@@ -144,7 +144,7 @@ typedef struct {
typedef struct { typedef struct {
BRES_PARAM bresParamLong, bresParamShort; BRES_PARAM bresParamLong, bresParamShort;
ATS_ELEMENT* adjThrStateElem[(6)]; ATS_ELEMENT* adjThrStateElem[(8)];
} ADJ_THR_STATE; } ADJ_THR_STATE;
#endif #endif
...@@ -316,6 +316,8 @@ AAC_ENCODER_ERROR FDKaacEnc_DetermineBandWidth(INT* bandWidth, ...@@ -316,6 +316,8 @@ AAC_ENCODER_ERROR FDKaacEnc_DetermineBandWidth(INT* bandWidth,
case MODE_1_2_2: case MODE_1_2_2:
case MODE_1_2_2_1: case MODE_1_2_2_1:
case MODE_1_2_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; *bandWidth = bandWidthTableVBR[bitrateMode].bandWidth2AndMoreChan;
break; break;
default: default:
...@@ -346,6 +348,8 @@ AAC_ENCODER_ERROR FDKaacEnc_DetermineBandWidth(INT* bandWidth, ...@@ -346,6 +348,8 @@ AAC_ENCODER_ERROR FDKaacEnc_DetermineBandWidth(INT* bandWidth,
case MODE_1_2_2: /* sce + cpe + cpe */ 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_1: /* (5.1) sce + cpe + cpe + lfe */
case MODE_1_2_2_2_1: /* (7.1) sce + cpe + 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 */ entryNo = 1; /* use stereo bandwith settings */
break; break;
......
...@@ -1360,7 +1360,7 @@ AAC_ENCODER_ERROR FDKaacEnc_WriteBitstream(HANDLE_TRANSPORTENC hTpEnc, ...@@ -1360,7 +1360,7 @@ AAC_ENCODER_ERROR FDKaacEnc_WriteBitstream(HANDLE_TRANSPORTENC hTpEnc,
if ( (syntaxFlags & AC_ER) && !(syntaxFlags & AC_DRM) ) 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)); FDKmemclear(channelElementExtensionWritten, sizeof(channelElementExtensionWritten));
......
...@@ -124,7 +124,7 @@ amm-info@iis.fraunhofer.de ...@@ -124,7 +124,7 @@ amm-info@iis.fraunhofer.de
typedef struct { typedef struct {
CHANNEL_MODE encoderMode; CHANNEL_MODE encoderMode;
INT channel_assignment[/*(6)*/12]; INT channel_assignment[/*(8)*/12];
} CHANNEL_ASSIGNMENT_INFO_TAB; } CHANNEL_ASSIGNMENT_INFO_TAB;
...@@ -139,6 +139,8 @@ static const CHANNEL_ASSIGNMENT_INFO_TAB assignmentInfoTabMpeg[] = ...@@ -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, { 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_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_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[] = static const CHANNEL_ASSIGNMENT_INFO_TAB assignmentInfoTabWav[] =
...@@ -150,7 +152,9 @@ 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_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, { 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_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, /* Channel mode configuration tab provides,
...@@ -165,6 +169,8 @@ static const CHANNEL_MODE_CONFIG_TAB channelModeConfig[] = ...@@ -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, 5, 5, 3 }, /* SCE,CPE,CPE */
{ MODE_1_2_2_1, 6, 5, 4 }, /* SCE,CPE,CPE,LFE */ { 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_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)) #define MAX_MODES (sizeof(assignmentInfoTabWav)/sizeof(CHANNEL_ASSIGNMENT_INFO_TAB))
...@@ -315,6 +321,8 @@ AAC_ENCODER_ERROR FDKaacEnc_InitChannelMapping(CHANNEL_MODE mode, CHANNEL_ORDER ...@@ -315,6 +321,8 @@ AAC_ENCODER_ERROR FDKaacEnc_InitChannelMapping(CHANNEL_MODE mode, CHANNEL_ORDER
break; break;
case MODE_1_2_2_2_1: 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 */ /* (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[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)); 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 ...@@ -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[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)); FDKaacEnc_initElement(&cm->elInfo[4], ID_LFE, &count, mode, co, it_cnt, FL2FXCONST_DBL(0.04f));
break; break;
default: default:
//*chMap=0; //*chMap=0;
return AAC_ENC_UNSUPPORTED_CHANNELCONFIG; return AAC_ENC_UNSUPPORTED_CHANNELCONFIG;
}; };
FDK_ASSERT(cm->nElements<=(6)); FDK_ASSERT(cm->nElements<=(8));
return AAC_ENC_OK; return AAC_ENC_OK;
...@@ -442,19 +449,18 @@ AAC_ENCODER_ERROR FDKaacEnc_InitElementBits(QC_STATE *hQC, ...@@ -442,19 +449,18 @@ AAC_ENCODER_ERROR FDKaacEnc_InitElementBits(QC_STATE *hQC,
break; break;
} }
case MODE_7_1_REAR_SURROUND:
case MODE_1_2_2_2_1:{ case MODE_7_1_FRONT_CENTER:
/* (7.1) sce + cpe + cpe + cpe + lfe */ case MODE_1_2_2_2_1: {
hQC->elementBits[0]->relativeBitsEl = cm->elInfo[0].relativeBits; int cpe3Idx = 3;
hQC->elementBits[1]->relativeBitsEl = cm->elInfo[1].relativeBits; int lfeIdx = 4;
hQC->elementBits[2]->relativeBitsEl = cm->elInfo[2].relativeBits;
hQC->elementBits[3]->relativeBitsEl = cm->elInfo[3].relativeBits; /* (7.1) sce + cpe + cpe + cpe + lfe */
hQC->elementBits[4]->relativeBitsEl = cm->elInfo[4].relativeBits; FIXP_DBL sceRate = hQC->elementBits[0]->relativeBitsEl = cm->elInfo[0].relativeBits;
FIXP_DBL sceRate = cm->elInfo[0].relativeBits; FIXP_DBL cpe1Rate = hQC->elementBits[1]->relativeBitsEl = cm->elInfo[1].relativeBits;
FIXP_DBL cpe1Rate = cm->elInfo[1].relativeBits; FIXP_DBL cpe2Rate = hQC->elementBits[2]->relativeBitsEl = cm->elInfo[2].relativeBits;
FIXP_DBL cpe2Rate = cm->elInfo[2].relativeBits; FIXP_DBL cpe3Rate = hQC->elementBits[cpe3Idx]->relativeBitsEl = cm->elInfo[cpe3Idx].relativeBits;
FIXP_DBL cpe3Rate = cm->elInfo[3].relativeBits; FIXP_DBL lfeRate = hQC->elementBits[lfeIdx]->relativeBitsEl = cm->elInfo[lfeIdx].relativeBits;
FIXP_DBL lfeRate = cm->elInfo[4].relativeBits;
int maxBitsTot = maxChannelBits * 7; /* LFE does not add to bit reservoir */ int maxBitsTot = maxChannelBits * 7; /* LFE does not add to bit reservoir */
int sc = CountLeadingBits(fixMax(maxChannelBits,averageBitsTot)); int sc = CountLeadingBits(fixMax(maxChannelBits,averageBitsTot));
...@@ -466,17 +472,16 @@ AAC_ENCODER_ERROR FDKaacEnc_InitElementBits(QC_STATE *hQC, ...@@ -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[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[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[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[cpe3Idx]->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[lfeIdx]->chBitrateEl = fMult(lfeRate, (FIXP_DBL)(bitrateTot<<sc_brTot))>>sc_brTot;
hQC->elementBits[0]->maxBitsEl = maxChannelBits; hQC->elementBits[0]->maxBitsEl = maxChannelBits;
hQC->elementBits[1]->maxBitsEl = 2*maxChannelBits; hQC->elementBits[1]->maxBitsEl = 2*maxChannelBits;
hQC->elementBits[2]->maxBitsEl = 2*maxChannelBits; hQC->elementBits[2]->maxBitsEl = 2*maxChannelBits;
hQC->elementBits[3]->maxBitsEl = 2*maxChannelBits; hQC->elementBits[cpe3Idx]->maxBitsEl = 2*maxChannelBits;
hQC->elementBits[4]->maxBitsEl = maxLfeBits; hQC->elementBits[lfeIdx]->maxBitsEl = maxLfeBits;
break; break;
} }
default: default:
return AAC_ENC_UNSUPPORTED_CHANNELCONFIG; return AAC_ENC_UNSUPPORTED_CHANNELCONFIG;
} }
...@@ -518,6 +523,8 @@ ELEMENT_MODE FDKaacEnc_GetMonoStereoMode(const CHANNEL_MODE mode){ ...@@ -518,6 +523,8 @@ ELEMENT_MODE FDKaacEnc_GetMonoStereoMode(const CHANNEL_MODE mode){
case MODE_1_2_2: case MODE_1_2_2:
case MODE_1_2_2_1: case MODE_1_2_2_1:
case MODE_1_2_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; monoStereoSetting = EL_MODE_STEREO;
break; break;
default: /* error */ default: /* error */
......
...@@ -156,8 +156,8 @@ typedef struct { ...@@ -156,8 +156,8 @@ typedef struct {
typedef struct { typedef struct {
PSY_OUT_ELEMENT* psyOutElement[(6)]; PSY_OUT_ELEMENT* psyOutElement[(8)];
PSY_OUT_CHANNEL* pPsyOutChannels[(6)]; PSY_OUT_CHANNEL* pPsyOutChannels[(8)];
}PSY_OUT; }PSY_OUT;
......
...@@ -539,14 +539,25 @@ INT FDK_DRC_Generator_Initialize( ...@@ -539,14 +539,25 @@ INT FDK_DRC_Generator_Initialize(
drcComp->channelIdx[RS] = channelMapping.elInfo[2].ChannelIndex[1]; drcComp->channelIdx[RS] = channelMapping.elInfo[2].ChannelIndex[1];
break; break;
case MODE_1_2_2_2_1: /* 7.1 ch */ case MODE_1_2_2_2_1: /* 7.1 ch */
drcComp->channelIdx[L] = channelMapping.elInfo[1].ChannelIndex[0]; case MODE_7_1_FRONT_CENTER:
drcComp->channelIdx[R] = channelMapping.elInfo[1].ChannelIndex[1]; drcComp->channelIdx[L] = channelMapping.elInfo[2].ChannelIndex[0]; /* l */
drcComp->channelIdx[C] = channelMapping.elInfo[0].ChannelIndex[0]; drcComp->channelIdx[R] = channelMapping.elInfo[2].ChannelIndex[1]; /* r */
drcComp->channelIdx[LFE] = channelMapping.elInfo[4].ChannelIndex[0]; drcComp->channelIdx[C] = channelMapping.elInfo[0].ChannelIndex[0]; /* c */
drcComp->channelIdx[LS] = channelMapping.elInfo[2].ChannelIndex[0]; drcComp->channelIdx[LFE] = channelMapping.elInfo[4].ChannelIndex[0]; /* lfe */
drcComp->channelIdx[RS] = channelMapping.elInfo[2].ChannelIndex[1]; drcComp->channelIdx[LS] = channelMapping.elInfo[3].ChannelIndex[0]; /* ls */
drcComp->channelIdx[LS2] = channelMapping.elInfo[3].ChannelIndex[0]; drcComp->channelIdx[RS] = channelMapping.elInfo[3].ChannelIndex[1]; /* rs */
drcComp->channelIdx[RS2] = channelMapping.elInfo[3].ChannelIndex[1]; 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; break;
case MODE_1_1: case MODE_1_1:
case MODE_1_1_1_1: case MODE_1_1_1_1:
......
...@@ -1340,7 +1340,7 @@ void FDKaacEnc_PsyClose(PSY_INTERNAL **phPsyInternal, ...@@ -1340,7 +1340,7 @@ void FDKaacEnc_PsyClose(PSY_INTERNAL **phPsyInternal,
if (hPsyInternal) if (hPsyInternal)
{ {
for (i=0; i<(6); i++) { for (i=0; i<(8); i++) {
if (hPsyInternal->pStaticChannels[i]) { if (hPsyInternal->pStaticChannels[i]) {
if (hPsyInternal->pStaticChannels[i]->psyInputBuffer) if (hPsyInternal->pStaticChannels[i]->psyInputBuffer)
FreeRam_aacEnc_PsyInputBuffer(&hPsyInternal->pStaticChannels[i]->psyInputBuffer); /* AUDIO INPUT BUFFER */ FreeRam_aacEnc_PsyInputBuffer(&hPsyInternal->pStaticChannels[i]->psyInputBuffer); /* AUDIO INPUT BUFFER */
...@@ -1349,7 +1349,7 @@ void FDKaacEnc_PsyClose(PSY_INTERNAL **phPsyInternal, ...@@ -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]) if (hPsyInternal->psyElement[i])
FreeRam_aacEnc_PsyElement(&hPsyInternal->psyElement[i]); /* PSY_ELEMENT */ FreeRam_aacEnc_PsyElement(&hPsyInternal->psyElement[i]); /* PSY_ELEMENT */
} }
...@@ -1363,12 +1363,12 @@ void FDKaacEnc_PsyClose(PSY_INTERNAL **phPsyInternal, ...@@ -1363,12 +1363,12 @@ void FDKaacEnc_PsyClose(PSY_INTERNAL **phPsyInternal,
for (n=0; n<(1); n++) { for (n=0; n<(1); n++) {
if (phPsyOut[n]) if (phPsyOut[n])
{ {
for (i=0; i<(6); i++) { for (i=0; i<(8); i++) {
if (phPsyOut[n]->pPsyOutChannels[i]) if (phPsyOut[n]->pPsyOutChannels[i])
FreeRam_aacEnc_PsyOutChannel(&phPsyOut[n]->pPsyOutChannels[i]); /* PSY_OUT_CHANNEL */ 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]) if (phPsyOut[n]->psyOutElement[i])
FreeRam_aacEnc_PsyOutElements(&phPsyOut[n]->psyOutElement[i]); /* PSY_OUT_ELEMENTS */ FreeRam_aacEnc_PsyOutElements(&phPsyOut[n]->psyOutElement[i]); /* PSY_OUT_ELEMENTS */
} }
......
...@@ -117,8 +117,8 @@ typedef struct { ...@@ -117,8 +117,8 @@ typedef struct {
typedef struct { typedef struct {
PSY_CONFIGURATION psyConf[2]; /* LONG / SHORT */ PSY_CONFIGURATION psyConf[2]; /* LONG / SHORT */
PSY_ELEMENT* psyElement[(6)]; PSY_ELEMENT* psyElement[(8)];
PSY_STATIC* pStaticChannels[(6)]; PSY_STATIC* pStaticChannels[(8)];
PSY_DYNAMIC* psyDynamic; PSY_DYNAMIC* psyDynamic;
INT granuleLength; INT granuleLength;
......
...@@ -127,7 +127,7 @@ typedef struct { ...@@ -127,7 +127,7 @@ typedef struct {
INT nChannels; INT nChannels;
INT nChannelsEff; INT nChannelsEff;
INT nElements; INT nElements;
ELEMENT_INFO elInfo[(6)]; ELEMENT_INFO elInfo[(8)];
} CHANNEL_MAPPING; } CHANNEL_MAPPING;
typedef struct { typedef struct {
...@@ -217,8 +217,8 @@ typedef struct ...@@ -217,8 +217,8 @@ typedef struct
typedef struct typedef struct
{ {
QC_OUT_ELEMENT *qcElement[(6)]; QC_OUT_ELEMENT *qcElement[(8)];
QC_OUT_CHANNEL *pQcOutChannels[(6)]; QC_OUT_CHANNEL *pQcOutChannels[(8)];
QC_OUT_EXTENSION extension[(2+2)]; /* global extension payload */ QC_OUT_EXTENSION extension[(2+2)]; /* global extension payload */
INT nExtensions; /* number of extension payloads for this AU */ INT nExtensions; /* number of extension payloads for this AU */
INT maxDynBits; /* maximal allowed dynamic bits in frame */ INT maxDynBits; /* maximal allowed dynamic bits in frame */
...@@ -265,7 +265,7 @@ typedef struct ...@@ -265,7 +265,7 @@ typedef struct
PADDING padding; PADDING padding;
ELEMENT_BITS *elementBits[(6)]; ELEMENT_BITS *elementBits[(8)];
BITCNTR_STATE *hBitCounter; BITCNTR_STATE *hBitCounter;
ADJ_THR_STATE *hAdjThr; ADJ_THR_STATE *hAdjThr;
......
...@@ -511,7 +511,7 @@ AAC_ENCODER_ERROR FDKaacEnc_AdjustBitrate(QC_STATE *RESTRICT hQC, ...@@ -511,7 +511,7 @@ AAC_ENCODER_ERROR FDKaacEnc_AdjustBitrate(QC_STATE *RESTRICT hQC,
} }
static AAC_ENCODER_ERROR FDKaacEnc_distributeElementDynBits(QC_STATE* hQC, static AAC_ENCODER_ERROR FDKaacEnc_distributeElementDynBits(QC_STATE* hQC,
QC_OUT_ELEMENT* qcElement[(6)], QC_OUT_ELEMENT* qcElement[(8)],
CHANNEL_MAPPING* cm, CHANNEL_MAPPING* cm,
INT codeBits) INT codeBits)
{ {
...@@ -610,7 +610,7 @@ static AAC_ENCODER_ERROR FDKaacEnc_prepareBitDistribution(QC_STATE* h ...@@ -610,7 +610,7 @@ static AAC_ENCODER_ERROR FDKaacEnc_prepareBitDistribution(QC_STATE* h
PSY_OUT** psyOut, PSY_OUT** psyOut,
QC_OUT** qcOut, QC_OUT** qcOut,
CHANNEL_MAPPING* cm, CHANNEL_MAPPING* cm,
QC_OUT_ELEMENT* qcElement[(1)][(6)], QC_OUT_ELEMENT* qcElement[(1)][(8)],
INT avgTotalBits, INT avgTotalBits,
INT *totalAvailableBits, INT *totalAvailableBits,
INT *avgTotalDynBits) INT *avgTotalDynBits)
...@@ -677,7 +677,7 @@ static AAC_ENCODER_ERROR FDKaacEnc_prepareBitDistribution(QC_STATE* h ...@@ -677,7 +677,7 @@ static AAC_ENCODER_ERROR FDKaacEnc_prepareBitDistribution(QC_STATE* h
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
static AAC_ENCODER_ERROR FDKaacEnc_updateUsedDynBits(INT* sumDynBitsConsumed, static AAC_ENCODER_ERROR FDKaacEnc_updateUsedDynBits(INT* sumDynBitsConsumed,
QC_OUT_ELEMENT* qcElement[(6)], QC_OUT_ELEMENT* qcElement[(8)],
CHANNEL_MAPPING* cm) CHANNEL_MAPPING* cm)
{ {
INT i; INT i;
...@@ -720,7 +720,7 @@ static INT FDKaacEnc_getTotalConsumedDynBits(QC_OUT** qcOut, ...@@ -720,7 +720,7 @@ static INT FDKaacEnc_getTotalConsumedDynBits(QC_OUT** qcOut,
} }
static INT FDKaacEnc_getTotalConsumedBits(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, CHANNEL_MAPPING* cm,
INT globHdrBits, INT globHdrBits,
INT nSubFrames) INT nSubFrames)
...@@ -820,7 +820,7 @@ AAC_ENCODER_ERROR FDKaacEnc_QCMain(QC_STATE* RESTRICT hQC, ...@@ -820,7 +820,7 @@ AAC_ENCODER_ERROR FDKaacEnc_QCMain(QC_STATE* RESTRICT hQC,
/*-------------------------------------------- */ /*-------------------------------------------- */
/* helper pointer */ /* helper pointer */
QC_OUT_ELEMENT* qcElement[(1)][(6)]; QC_OUT_ELEMENT* qcElement[(1)][(8)];
/* work on a copy of qcChannel and qcElement */ /* work on a copy of qcChannel and qcElement */
for (i=0; i<cm->nElements; i++) for (i=0; i<cm->nElements; i++)
...@@ -897,10 +897,10 @@ AAC_ENCODER_ERROR FDKaacEnc_QCMain(QC_STATE* RESTRICT hQC, ...@@ -897,10 +897,10 @@ AAC_ENCODER_ERROR FDKaacEnc_QCMain(QC_STATE* RESTRICT hQC,
} /* -end- sub frame counter */ } /* -end- sub frame counter */
/*-------------------------------------------- */ /*-------------------------------------------- */
INT iterations[(1)][(6)]; INT iterations[(1)][(8)];
INT chConstraintsFulfilled[(1)][(6)][(2)]; INT chConstraintsFulfilled[(1)][(8)][(2)];
INT calculateQuant[(1)][(6)][(2)]; INT calculateQuant[(1)][(8)][(2)];
INT constraintsFulfilled[(1)][(6)]; INT constraintsFulfilled[(1)][(8)];
/*-------------------------------------------- */ /*-------------------------------------------- */
...@@ -1247,7 +1247,7 @@ static AAC_ENCODER_ERROR FDKaacEnc_reduceBitConsumption(int* iterati ...@@ -1247,7 +1247,7 @@ static AAC_ENCODER_ERROR FDKaacEnc_reduceBitConsumption(int* iterati
AAC_ENCODER_ERROR FDKaacEnc_updateFillBits(CHANNEL_MAPPING* cm, AAC_ENCODER_ERROR FDKaacEnc_updateFillBits(CHANNEL_MAPPING* cm,
QC_STATE* qcKernel, QC_STATE* qcKernel,
ELEMENT_BITS* RESTRICT elBits[(6)], ELEMENT_BITS* RESTRICT elBits[(8)],
QC_OUT** qcOut) QC_OUT** qcOut)
{ {
switch (qcKernel->bitrateMode) { switch (qcKernel->bitrateMode) {
...@@ -1603,10 +1603,10 @@ void FDKaacEnc_QCClose (QC_STATE **phQCstate, QC_OUT **phQC) ...@@ -1603,10 +1603,10 @@ void FDKaacEnc_QCClose (QC_STATE **phQCstate, QC_OUT **phQC)
for (n=0;n<(1);n++) { for (n=0;n<(1);n++) {
if (phQC[n] != NULL) { if (phQC[n] != NULL) {
QC_OUT *hQC = phQC[n]; 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]) if (hQC->qcElement[i])
FreeRam_aacEnc_QCelement(&hQC->qcElement[i]); FreeRam_aacEnc_QCelement(&hQC->qcElement[i]);
} }
...@@ -1626,7 +1626,7 @@ void FDKaacEnc_QCClose (QC_STATE **phQCstate, QC_OUT **phQC) ...@@ -1626,7 +1626,7 @@ void FDKaacEnc_QCClose (QC_STATE **phQCstate, QC_OUT **phQC)
if (hQCstate->hBitCounter != NULL) if (hQCstate->hBitCounter != NULL)
FDKaacEnc_BCClose(&hQCstate->hBitCounter); FDKaacEnc_BCClose(&hQCstate->hBitCounter);
for (i=0; i<(6); i++) { for (i=0; i<(8); i++) {
if (hQCstate->elementBits[i]!=NULL) { if (hQCstate->elementBits[i]!=NULL) {
FreeRam_aacEnc_ElementBits(&hQCstate->elementBits[i]); FreeRam_aacEnc_ElementBits(&hQCstate->elementBits[i]);
} }
......
...@@ -140,7 +140,7 @@ AAC_ENCODER_ERROR FDKaacEnc_QCMain(QC_STATE* RESTRICT hQC, ...@@ -140,7 +140,7 @@ AAC_ENCODER_ERROR FDKaacEnc_QCMain(QC_STATE* RESTRICT hQC,
AAC_ENCODER_ERROR FDKaacEnc_updateFillBits(CHANNEL_MAPPING* cm, AAC_ENCODER_ERROR FDKaacEnc_updateFillBits(CHANNEL_MAPPING* cm,
QC_STATE* qcKernel, QC_STATE* qcKernel,
ELEMENT_BITS* RESTRICT elBits[(6)], ELEMENT_BITS* RESTRICT elBits[(8)],
QC_OUT** qcOut); QC_OUT** qcOut);
......
...@@ -127,8 +127,7 @@ typedef struct { ...@@ -127,8 +127,7 @@ typedef struct {
* *
* The number of channel element parameter describes the kind of consecutively elements. * The number of channel element parameter describes the kind of consecutively elements.
* E.g. MODE_1_2_2_2_1 means: * E.g. MODE_1_2_2_2_1 means:
* - First 2 elements (SCE,CPE) are front channel elements. * - First 3 elements (SCE,CPE,CPE) are front channel elements.
* - Following element (CPE) is a side channel element.
* - Next element (CPE) is a back channel element. * - Next element (CPE) is a back channel element.
* - Last element (LFE) is a lfe channel element. * - Last element (LFE) is a lfe channel element.
*/ */
...@@ -140,7 +139,8 @@ static const CHANNEL_CONFIGURATION pceConfigTab[] = ...@@ -140,7 +139,8 @@ static const CHANNEL_CONFIGURATION pceConfigTab[] =
{ MODE_1_2_1, { 2, 0, 1, 0, { ID_SCE, ID_CPE, ID_SCE, ID_NONE, ID_NONE, ID_NONE, ID_NONE, ID_NONE } } }, { MODE_1_2_1, { 2, 0, 1, 0, { ID_SCE, ID_CPE, ID_SCE, ID_NONE, ID_NONE, ID_NONE, ID_NONE, ID_NONE } } },
{ MODE_1_2_2, { 2, 0, 1, 0, { ID_SCE, ID_CPE, ID_CPE, ID_NONE, ID_NONE, ID_NONE, ID_NONE, ID_NONE } } }, { MODE_1_2_2, { 2, 0, 1, 0, { ID_SCE, ID_CPE, ID_CPE, ID_NONE, ID_NONE, ID_NONE, ID_NONE, ID_NONE } } },
{ MODE_1_2_2_1, { 2, 0, 1, 1, { ID_SCE, ID_CPE, ID_CPE, ID_LFE, ID_NONE, ID_NONE, ID_NONE, ID_NONE } } }, { MODE_1_2_2_1, { 2, 0, 1, 1, { ID_SCE, ID_CPE, ID_CPE, ID_LFE, ID_NONE, ID_NONE, ID_NONE, ID_NONE } } },
{ MODE_1_2_2_2_1, { 2, 1, 1, 1, { ID_SCE, ID_CPE, ID_CPE, ID_CPE, ID_LFE, ID_NONE, ID_NONE, ID_NONE } } }, { MODE_1_2_2_2_1, { 3, 0, 1, 1, { ID_SCE, ID_CPE, ID_CPE, ID_CPE, ID_LFE, ID_NONE, ID_NONE, ID_NONE } } },
{ MODE_1_1, { 2, 0, 0, 0, { ID_SCE, ID_SCE, ID_NONE, ID_NONE, ID_NONE, ID_NONE, ID_NONE, ID_NONE } } }, { MODE_1_1, { 2, 0, 0, 0, { ID_SCE, ID_SCE, ID_NONE, ID_NONE, ID_NONE, ID_NONE, ID_NONE, ID_NONE } } },
{ MODE_1_1_1_1, { 2, 2, 0, 0, { ID_SCE, ID_SCE, ID_SCE, ID_SCE, ID_NONE, ID_NONE, ID_NONE, ID_NONE } } }, { MODE_1_1_1_1, { 2, 2, 0, 0, { ID_SCE, ID_SCE, ID_SCE, ID_SCE, ID_NONE, ID_NONE, ID_NONE, ID_NONE } } },
...@@ -151,7 +151,11 @@ static const CHANNEL_CONFIGURATION pceConfigTab[] = ...@@ -151,7 +151,11 @@ static const CHANNEL_CONFIGURATION pceConfigTab[] =
{ MODE_2_2_2, { 1, 1, 1, 0, { ID_CPE, ID_CPE, ID_CPE, ID_NONE, ID_NONE, ID_NONE, ID_NONE, ID_NONE } } }, { MODE_2_2_2, { 1, 1, 1, 0, { ID_CPE, ID_CPE, ID_CPE, ID_NONE, ID_NONE, ID_NONE, ID_NONE, ID_NONE } } },
{ MODE_2_2_2_2, { 4, 0, 0, 0, { ID_CPE, ID_CPE, ID_CPE, ID_CPE, ID_NONE, ID_NONE, ID_NONE, ID_NONE } } }, { MODE_2_2_2_2, { 4, 0, 0, 0, { ID_CPE, ID_CPE, ID_CPE, ID_CPE, ID_NONE, ID_NONE, ID_NONE, ID_NONE } } },
{ MODE_2_1, { 1, 0, 1, 0, { ID_CPE, ID_SCE, ID_NONE, ID_NONE, ID_NONE, ID_NONE, ID_NONE, ID_NONE } } } { MODE_2_1, { 1, 0, 1, 0, { ID_CPE, ID_SCE, ID_NONE, ID_NONE, ID_NONE, ID_NONE, ID_NONE, ID_NONE } } },
{ MODE_7_1_REAR_SURROUND, { 2, 0, 2, 1, { ID_SCE, ID_CPE, ID_CPE, ID_CPE, ID_LFE, ID_NONE, ID_NONE, ID_NONE } } },
{ MODE_7_1_FRONT_CENTER, { 3, 0, 1, 1, { ID_SCE, ID_CPE, ID_CPE, ID_CPE, ID_LFE, ID_NONE, ID_NONE, ID_NONE } } },
}; };
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
/* library info */ /* library info */
#define TP_LIB_VL0 2 #define TP_LIB_VL0 2
#define TP_LIB_VL1 3 #define TP_LIB_VL1 3
#define TP_LIB_VL2 2 #define TP_LIB_VL2 3
#define TP_LIB_TITLE "MPEG Transport" #define TP_LIB_TITLE "MPEG Transport"
#define TP_LIB_BUILD_DATE __DATE__ #define TP_LIB_BUILD_DATE __DATE__
#define TP_LIB_BUILD_TIME __TIME__ #define TP_LIB_BUILD_TIME __TIME__
...@@ -324,7 +324,7 @@ UINT sbrEncoder_IsSingleRatePossible(AUDIO_OBJECT_TYPE aot); ...@@ -324,7 +324,7 @@ UINT sbrEncoder_IsSingleRatePossible(AUDIO_OBJECT_TYPE aot);
*/ */
INT sbrEncoder_Init( INT sbrEncoder_Init(
HANDLE_SBR_ENCODER hSbrEncoder, HANDLE_SBR_ENCODER hSbrEncoder,
SBR_ELEMENT_INFO elInfo[(6)], SBR_ELEMENT_INFO elInfo[(8)],
int noElements, int noElements,
INT_PCM *inputBuffer, INT_PCM *inputBuffer,
INT *coreBandwidth, INT *coreBandwidth,
...@@ -369,8 +369,8 @@ void sbrEncoder_Close(HANDLE_SBR_ENCODER *phEbrEncoder); ...@@ -369,8 +369,8 @@ void sbrEncoder_Close(HANDLE_SBR_ENCODER *phEbrEncoder);
INT sbrEncoder_EncodeFrame(HANDLE_SBR_ENCODER hEnvEncoder, INT sbrEncoder_EncodeFrame(HANDLE_SBR_ENCODER hEnvEncoder,
INT_PCM *samples, INT_PCM *samples,
UINT timeInStride, UINT timeInStride,
UINT sbrDataBits[(6)], UINT sbrDataBits[(8)],
UCHAR sbrData[(6)][MAX_PAYLOAD_SIZE] UCHAR sbrData[(8)][MAX_PAYLOAD_SIZE]
); );
/** /**
......
...@@ -131,9 +131,9 @@ typedef struct SBR_ELEMENT { ...@@ -131,9 +131,9 @@ typedef struct SBR_ELEMENT {
typedef struct SBR_ENCODER typedef struct SBR_ENCODER
{ {
HANDLE_SBR_ELEMENT sbrElement[(6)]; HANDLE_SBR_ELEMENT sbrElement[(8)];
HANDLE_SBR_CHANNEL pSbrChannel[(6)]; HANDLE_SBR_CHANNEL pSbrChannel[(8)];
QMF_FILTER_BANK QmfAnalysis[(6)]; QMF_FILTER_BANK QmfAnalysis[(8)];
DOWNSAMPLER lfeDownSampler; DOWNSAMPLER lfeDownSampler;
int lfeChIdx; /* -1 default for no lfe, else assign channel index */ int lfeChIdx; /* -1 default for no lfe, else assign channel index */
int noElements; /* Number of elements */ int noElements; /* Number of elements */
......
...@@ -103,7 +103,7 @@ amm-info@iis.fraunhofer.de ...@@ -103,7 +103,7 @@ amm-info@iis.fraunhofer.de
#define SBRENCODER_LIB_VL0 3 #define SBRENCODER_LIB_VL0 3
#define SBRENCODER_LIB_VL1 3 #define SBRENCODER_LIB_VL1 3
#define SBRENCODER_LIB_VL2 3 #define SBRENCODER_LIB_VL2 4
...@@ -653,7 +653,7 @@ void sbrEncoder_Close (HANDLE_SBR_ENCODER *phSbrEncoder) ...@@ -653,7 +653,7 @@ void sbrEncoder_Close (HANDLE_SBR_ENCODER *phSbrEncoder)
{ {
int el, ch; int el, ch;
for (el=0; el<(6); el++) for (el=0; el<(8); el++)
{ {
if (hSbrEncoder->sbrElement[el]!=NULL) { if (hSbrEncoder->sbrElement[el]!=NULL) {
sbrEncoder_ElementClose(&hSbrEncoder->sbrElement[el]); sbrEncoder_ElementClose(&hSbrEncoder->sbrElement[el]);
...@@ -661,7 +661,7 @@ void sbrEncoder_Close (HANDLE_SBR_ENCODER *phSbrEncoder) ...@@ -661,7 +661,7 @@ void sbrEncoder_Close (HANDLE_SBR_ENCODER *phSbrEncoder)
} }
/* Close sbr Channels */ /* Close sbr Channels */
for (ch=0; ch<(6); ch++) for (ch=0; ch<(8); ch++)
{ {
if (hSbrEncoder->pSbrChannel[ch]) { if (hSbrEncoder->pSbrChannel[ch]) {
sbrEncoder_ChannelClose(hSbrEncoder->pSbrChannel[ch]); sbrEncoder_ChannelClose(hSbrEncoder->pSbrChannel[ch]);
...@@ -1468,7 +1468,7 @@ bail: ...@@ -1468,7 +1468,7 @@ bail:
static static
INT FDKsbrEnc_Reallocate( INT FDKsbrEnc_Reallocate(
HANDLE_SBR_ENCODER hSbrEncoder, HANDLE_SBR_ENCODER hSbrEncoder,
SBR_ELEMENT_INFO elInfo[(6)], SBR_ELEMENT_INFO elInfo[(8)],
const INT noElements) const INT noElements)
{ {
INT totalCh = 0; INT totalCh = 0;
...@@ -1806,7 +1806,7 @@ UINT sbrEncoder_IsSingleRatePossible(AUDIO_OBJECT_TYPE aot) ...@@ -1806,7 +1806,7 @@ UINT sbrEncoder_IsSingleRatePossible(AUDIO_OBJECT_TYPE aot)
INT sbrEncoder_Init( INT sbrEncoder_Init(
HANDLE_SBR_ENCODER hSbrEncoder, HANDLE_SBR_ENCODER hSbrEncoder,
SBR_ELEMENT_INFO elInfo[(6)], SBR_ELEMENT_INFO elInfo[(8)],
int noElements, int noElements,
INT_PCM *inputBuffer, INT_PCM *inputBuffer,
INT *coreBandwidth, INT *coreBandwidth,
...@@ -1823,7 +1823,7 @@ INT sbrEncoder_Init( ...@@ -1823,7 +1823,7 @@ INT sbrEncoder_Init(
) )
{ {
HANDLE_ERROR_INFO errorInfo = noError; HANDLE_ERROR_INFO errorInfo = noError;
sbrConfiguration sbrConfig[(6)]; sbrConfiguration sbrConfig[(8)];
INT error = 0; INT error = 0;
INT lowestBandwidth; INT lowestBandwidth;
/* Save input parameters */ /* Save input parameters */
...@@ -2211,8 +2211,8 @@ INT ...@@ -2211,8 +2211,8 @@ INT
sbrEncoder_EncodeFrame( HANDLE_SBR_ENCODER hSbrEncoder, sbrEncoder_EncodeFrame( HANDLE_SBR_ENCODER hSbrEncoder,
INT_PCM *samples, INT_PCM *samples,
UINT timeInStride, UINT timeInStride,
UINT sbrDataBits[(6)], UINT sbrDataBits[(8)],
UCHAR sbrData[(6)][MAX_PAYLOAD_SIZE] UCHAR sbrData[(8)][MAX_PAYLOAD_SIZE]
) )
{ {
INT error; INT error;
......
...@@ -107,39 +107,39 @@ C_ALLOC_MEM (Ram_SbrDynamic_RAM, FIXP_DBL, ((SBR_ENC_DYN_RAM_SIZE)/sizeof(FIXP_D ...@@ -107,39 +107,39 @@ C_ALLOC_MEM (Ram_SbrDynamic_RAM, FIXP_DBL, ((SBR_ENC_DYN_RAM_SIZE)/sizeof(FIXP_D
in module sbr_ram and sbr rom in module sbr_ram and sbr rom
*/ */
C_ALLOC_MEM (Ram_SbrEncoder, SBR_ENCODER, 1) C_ALLOC_MEM (Ram_SbrEncoder, SBR_ENCODER, 1)
C_ALLOC_MEM2(Ram_SbrChannel, SBR_CHANNEL, 1, (6)) C_ALLOC_MEM2(Ram_SbrChannel, SBR_CHANNEL, 1, (8))
C_ALLOC_MEM2(Ram_SbrElement, SBR_ELEMENT, 1, (6)) C_ALLOC_MEM2(Ram_SbrElement, SBR_ELEMENT, 1, (8))
/*! Filter states for QMF-analysis. <br> /*! Filter states for QMF-analysis. <br>
Dimension: #MAXNRSBRCHANNELS * #SBR_QMF_FILTER_LENGTH Dimension: #MAXNRSBRCHANNELS * #SBR_QMF_FILTER_LENGTH
*/ */
C_AALLOC_MEM2_L (Ram_Sbr_QmfStatesAnalysis, FIXP_QAS, QMF_FILTER_LENGTH, (6), SECT_DATA_L1) C_AALLOC_MEM2_L (Ram_Sbr_QmfStatesAnalysis, FIXP_QAS, QMF_FILTER_LENGTH, (8), SECT_DATA_L1)
/*! Matrix holding the quota values for all estimates, all channels /*! Matrix holding the quota values for all estimates, all channels
Dimension #MAXNRSBRCHANNELS * +#SBR_QMF_CHANNELS* #MAX_NO_OF_ESTIMATES Dimension #MAXNRSBRCHANNELS * +#SBR_QMF_CHANNELS* #MAX_NO_OF_ESTIMATES
*/ */
C_ALLOC_MEM2_L (Ram_Sbr_quotaMatrix, FIXP_DBL, (MAX_NO_OF_ESTIMATES*QMF_CHANNELS), (6), SECT_DATA_L1) C_ALLOC_MEM2_L (Ram_Sbr_quotaMatrix, FIXP_DBL, (MAX_NO_OF_ESTIMATES*QMF_CHANNELS), (8), SECT_DATA_L1)
/*! Matrix holding the sign values for all estimates, all channels /*! Matrix holding the sign values for all estimates, all channels
Dimension #MAXNRSBRCHANNELS * +#SBR_QMF_CHANNELS* #MAX_NO_OF_ESTIMATES Dimension #MAXNRSBRCHANNELS * +#SBR_QMF_CHANNELS* #MAX_NO_OF_ESTIMATES
*/ */
C_ALLOC_MEM2 (Ram_Sbr_signMatrix, INT, (MAX_NO_OF_ESTIMATES*QMF_CHANNELS), (6)) C_ALLOC_MEM2 (Ram_Sbr_signMatrix, INT, (MAX_NO_OF_ESTIMATES*QMF_CHANNELS), (8))
/*! Frequency band table (low res) <br> /*! Frequency band table (low res) <br>
Dimension #MAX_FREQ_COEFFS/2+1 Dimension #MAX_FREQ_COEFFS/2+1
*/ */
C_ALLOC_MEM2 (Ram_Sbr_freqBandTableLO, UCHAR, (MAX_FREQ_COEFFS/2+1), (6)) C_ALLOC_MEM2 (Ram_Sbr_freqBandTableLO, UCHAR, (MAX_FREQ_COEFFS/2+1), (8))
/*! Frequency band table (high res) <br> /*! Frequency band table (high res) <br>
Dimension #MAX_FREQ_COEFFS +1 Dimension #MAX_FREQ_COEFFS +1
*/ */
C_ALLOC_MEM2 (Ram_Sbr_freqBandTableHI, UCHAR, (MAX_FREQ_COEFFS+1), (6)) C_ALLOC_MEM2 (Ram_Sbr_freqBandTableHI, UCHAR, (MAX_FREQ_COEFFS+1), (8))
/*! vk matser table <br> /*! vk matser table <br>
Dimension #MAX_FREQ_COEFFS +1 Dimension #MAX_FREQ_COEFFS +1
*/ */
C_ALLOC_MEM2 (Ram_Sbr_v_k_master, UCHAR, (MAX_FREQ_COEFFS+1), (6)) C_ALLOC_MEM2 (Ram_Sbr_v_k_master, UCHAR, (MAX_FREQ_COEFFS+1), (8))
/* /*
...@@ -149,23 +149,23 @@ C_ALLOC_MEM2 (Ram_Sbr_v_k_master, UCHAR, (MAX_FREQ_COEFFS+1), (6)) ...@@ -149,23 +149,23 @@ C_ALLOC_MEM2 (Ram_Sbr_v_k_master, UCHAR, (MAX_FREQ_COEFFS+1), (6))
/*! sbr_detectionVectors <br> /*! sbr_detectionVectors <br>
Dimension #MAX_NUM_CHANNELS*#MAX_NO_OF_ESTIMATES*#MAX_FREQ_COEFFS] Dimension #MAX_NUM_CHANNELS*#MAX_NO_OF_ESTIMATES*#MAX_FREQ_COEFFS]
*/ */
C_ALLOC_MEM2 (Ram_Sbr_detectionVectors, UCHAR, (MAX_NO_OF_ESTIMATES*MAX_FREQ_COEFFS), (6)) C_ALLOC_MEM2 (Ram_Sbr_detectionVectors, UCHAR, (MAX_NO_OF_ESTIMATES*MAX_FREQ_COEFFS), (8))
/*! sbr_prevCompVec[ <br> /*! sbr_prevCompVec[ <br>
Dimension #MAX_NUM_CHANNELS*#MAX_FREQ_COEFFS] Dimension #MAX_NUM_CHANNELS*#MAX_FREQ_COEFFS]
*/ */
C_ALLOC_MEM2 (Ram_Sbr_prevEnvelopeCompensation, UCHAR, MAX_FREQ_COEFFS, (6)) C_ALLOC_MEM2 (Ram_Sbr_prevEnvelopeCompensation, UCHAR, MAX_FREQ_COEFFS, (8))
/*! sbr_guideScfb[ <br> /*! sbr_guideScfb[ <br>
Dimension #MAX_NUM_CHANNELS*#MAX_FREQ_COEFFS] Dimension #MAX_NUM_CHANNELS*#MAX_FREQ_COEFFS]
*/ */
C_ALLOC_MEM2 (Ram_Sbr_guideScfb, UCHAR, MAX_FREQ_COEFFS, (6)) C_ALLOC_MEM2 (Ram_Sbr_guideScfb, UCHAR, MAX_FREQ_COEFFS, (8))
/*! sbr_guideVectorDetected <br> /*! sbr_guideVectorDetected <br>
Dimension #MAX_NUM_CHANNELS*#MAX_NO_OF_ESTIMATES*#MAX_FREQ_COEFFS] Dimension #MAX_NUM_CHANNELS*#MAX_NO_OF_ESTIMATES*#MAX_FREQ_COEFFS]
*/ */
C_ALLOC_MEM2 (Ram_Sbr_guideVectorDetected, UCHAR, (MAX_NO_OF_ESTIMATES*MAX_FREQ_COEFFS), (6)) C_ALLOC_MEM2 (Ram_Sbr_guideVectorDetected, UCHAR, (MAX_NO_OF_ESTIMATES*MAX_FREQ_COEFFS), (8))
C_ALLOC_MEM2 (Ram_Sbr_guideVectorDiff, FIXP_DBL, (MAX_NO_OF_ESTIMATES*MAX_FREQ_COEFFS), (6)) C_ALLOC_MEM2 (Ram_Sbr_guideVectorDiff, FIXP_DBL, (MAX_NO_OF_ESTIMATES*MAX_FREQ_COEFFS), (8))
C_ALLOC_MEM2 (Ram_Sbr_guideVectorOrig, FIXP_DBL, (MAX_NO_OF_ESTIMATES*MAX_FREQ_COEFFS), (6)) C_ALLOC_MEM2 (Ram_Sbr_guideVectorOrig, FIXP_DBL, (MAX_NO_OF_ESTIMATES*MAX_FREQ_COEFFS), (8))
/* /*
Static Parametric Stereo memory Static Parametric Stereo memory
...@@ -191,7 +191,7 @@ C_ALLOC_MEM (Ram_ParamStereo, PARAMETRIC_STEREO, 1) ...@@ -191,7 +191,7 @@ C_ALLOC_MEM (Ram_ParamStereo, PARAMETRIC_STEREO, 1)
/*! Energy buffer for envelope extraction <br> /*! Energy buffer for envelope extraction <br>
Dimension #MAXNRSBRCHANNELS * +#SBR_QMF_SLOTS * #SBR_QMF_CHANNELS Dimension #MAXNRSBRCHANNELS * +#SBR_QMF_SLOTS * #SBR_QMF_CHANNELS
*/ */
C_ALLOC_MEM2 (Ram_Sbr_envYBuffer, FIXP_DBL, (QMF_MAX_TIME_SLOTS/2 * QMF_CHANNELS), (6)) C_ALLOC_MEM2 (Ram_Sbr_envYBuffer, FIXP_DBL, (QMF_MAX_TIME_SLOTS/2 * QMF_CHANNELS), (8))
FIXP_DBL* GetRam_Sbr_envYBuffer (int n, UCHAR* dynamic_RAM) { FIXP_DBL* GetRam_Sbr_envYBuffer (int n, UCHAR* dynamic_RAM) {
FDK_ASSERT(dynamic_RAM!=0); FDK_ASSERT(dynamic_RAM!=0);
......
...@@ -234,28 +234,32 @@ typedef enum ...@@ -234,28 +234,32 @@ typedef enum
/** Channel Mode ( 1-7 equals MPEG channel configurations, others are arbitrary). */ /** Channel Mode ( 1-7 equals MPEG channel configurations, others are arbitrary). */
typedef enum { typedef enum {
MODE_INVALID = -1, MODE_INVALID = -1,
MODE_UNKNOWN = 0, MODE_UNKNOWN = 0,
MODE_1 = 1, /**< SCE */ MODE_1 = 1, /**< C */
MODE_2 = 2, /**< CPE */ MODE_2 = 2, /**< L+R */
MODE_1_2 = 3, /**< SCE,CPE */ MODE_1_2 = 3, /**< C, L+R */
MODE_1_2_1 = 4, /**< SCE,CPE,SCE */ MODE_1_2_1 = 4, /**< C, L+R, Rear */
MODE_1_2_2 = 5, /**< SCE,CPE,CPE */ MODE_1_2_2 = 5, /**< C, L+R, LS+RS */
MODE_1_2_2_1 = 6, /**< SCE,CPE,CPE,LFE */ MODE_1_2_2_1 = 6, /**< C, L+R, LS+RS, LFE */
MODE_1_2_2_2_1 = 7, /**< SCE,CPE,CPE,CPE,LFE */ MODE_1_2_2_2_1 = 7, /**< C, LC+RC, L+R, LS+RS, LFE */
MODE_1_1 = 16, /**< 2 SCEs (dual mono) */
MODE_1_1_1_1 = 17, /**< 4 SCEs */ MODE_1_1 = 16, /**< 2 SCEs (dual mono) */
MODE_1_1_1_1_1_1 = 18, /**< 6 SCEs */ MODE_1_1_1_1 = 17, /**< 4 SCEs */
MODE_1_1_1_1_1_1_1_1 = 19, /**< 8 SCEs */ MODE_1_1_1_1_1_1 = 18, /**< 6 SCEs */
MODE_1_1_1_1_1_1_1_1_1_1_1_1 = 20, /**< 12 SCEs */ MODE_1_1_1_1_1_1_1_1 = 19, /**< 8 SCEs */
MODE_1_1_1_1_1_1_1_1_1_1_1_1 = 20, /**< 12 SCEs */
MODE_2_2 = 21, /**< 2 CPEs */
MODE_2_2_2 = 22, /**< 3 CPEs */ MODE_2_2 = 21, /**< 2 CPEs */
MODE_2_2_2_2 = 23, /**< 4 CPEs */ MODE_2_2_2 = 22, /**< 3 CPEs */
MODE_2_2_2_2_2_2 = 24, /**< 6 CPEs */ MODE_2_2_2_2 = 23, /**< 4 CPEs */
MODE_2_2_2_2_2_2 = 24, /**< 6 CPEs */
MODE_2_1 = 30 /**< CPE,SCE (ARIB standard) */
MODE_2_1 = 30, /**< CPE,SCE (ARIB standard B32) */
MODE_7_1_REAR_SURROUND = 33, /**< C, L+R, LS+RS, Lrear+Rrear, LFE */
MODE_7_1_FRONT_CENTER = 34 /**< C, LC+RC, L+R, LS+RS, LFE */
} CHANNEL_MODE; } CHANNEL_MODE;
......
...@@ -99,7 +99,7 @@ amm-info@iis.fraunhofer.de ...@@ -99,7 +99,7 @@ amm-info@iis.fraunhofer.de
/* library info */ /* library info */
#define SYS_LIB_VL0 1 #define SYS_LIB_VL0 1
#define SYS_LIB_VL1 3 #define SYS_LIB_VL1 3
#define SYS_LIB_VL2 3 #define SYS_LIB_VL2 4
#define SYS_LIB_TITLE "System Integration Library" #define SYS_LIB_TITLE "System Integration Library"
#define SYS_LIB_BUILD_DATE __DATE__ #define SYS_LIB_BUILD_DATE __DATE__
#define SYS_LIB_BUILD_TIME __TIME__ #define SYS_LIB_BUILD_TIME __TIME__
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment