diff options
author | Jean-Michel Trivi <jmtrivi@google.com> | 2013-08-29 16:05:22 -0700 |
---|---|---|
committer | Jean-Michel Trivi <jmtrivi@google.com> | 2013-09-03 14:19:38 -0700 |
commit | fa3eba16446cc8f2f5e2dfc20d86a49dbd37299e (patch) | |
tree | 287cfbd64295aa61b5e6534d5e28797c0a04ccd8 | |
parent | 9f455bea1c38f7275a65ab79be2d41a34428fb8b (diff) | |
download | ODR-AudioEnc-fa3eba16446cc8f2f5e2dfc20d86a49dbd37299e.tar.gz ODR-AudioEnc-fa3eba16446cc8f2f5e2dfc20d86a49dbd37299e.tar.bz2 ODR-AudioEnc-fa3eba16446cc8f2f5e2dfc20d86a49dbd37299e.zip |
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
27 files changed, 231 insertions, 193 deletions
diff --git a/libAACenc/include/aacenc_lib.h b/libAACenc/include/aacenc_lib.h index f693bf5..8c0e1cd 100644 --- a/libAACenc/include/aacenc_lib.h +++ b/libAACenc/include/aacenc_lib.h @@ -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 extern. The Encoder implementation supports fixed Channel Modes which are mapped to Channel Configuration as follow. \verbatim --------------------------------------------------------------------- - ChannelMode | ChCfg | front_El | side_El | back_El | lfe_El ------------------+--------+----------+----------+----------+-------- -MODE_1 | 1 | SCE | | | -MODE_2 | 2 | CPE | | | -MODE_1_2 | 3 | SCE, CPE | | | -MODE_1_2_1 | 4 | SCE, CPE | | SCE | -MODE_1_2_2 | 5 | SCE, CPE | | CPE | -MODE_1_2_2_1 | 6 | SCE, CPE | | CPE | LFE --------------------------------------------------------------------- +------------------------------------------------------------------------------- + ChannelMode | ChCfg | front_El | side_El | back_El | lfe_El +-----------------------+--------+---------------+----------+----------+-------- +MODE_1 | 1 | SCE | | | +MODE_2 | 2 | CPE | | | +MODE_1_2 | 3 | SCE, CPE | | | +MODE_1_2_1 | 4 | SCE, CPE | | SCE | +MODE_1_2_2 | 5 | SCE, CPE | | CPE | +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. - CPE: Channel Pair. - SCE: Low Frequency Element. @@ -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 Following Table describes the complete channel mapping for both Channel Order configurations. \verbatim ---------------------------------------------------------------------------------- -ChannelMode | MPEG-Channelorder | WAV-Channelorder ------------------+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+--- -MODE_1 | 0 | | | | | | | | 0 | | | | | | | -MODE_2 | 0 | 1 | | | | | | | 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_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 | | ---------------------------------------------------------------------------------- +--------------------------------------------------------------------------------------- +ChannelMode | MPEG-Channelorder | WAV-Channelorder +-----------------------+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+--- +MODE_1 | 0 | | | | | | | | 0 | | | | | | | +MODE_2 | 0 | 1 | | | | | | | 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_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_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 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 - 480: Optional length in LD/ELD configuration. */ 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: - 0: MPEG channel ordering (e. g. 5.1: C, L, R, SL, SR, LFE). (default) 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); diff --git a/libMpegTPEnc/src/tpenc_asc.cpp b/libMpegTPEnc/src/tpenc_asc.cpp index 3f10ca4..bc4302e 100644 --- a/libMpegTPEnc/src/tpenc_asc.cpp +++ b/libMpegTPEnc/src/tpenc_asc.cpp @@ -127,8 +127,7 @@ typedef struct { * * The number of channel element parameter describes the kind of consecutively elements. * E.g. MODE_1_2_2_2_1 means: - * - First 2 elements (SCE,CPE) are front channel elements. - * - Following element (CPE) is a side channel element. + * - First 3 elements (SCE,CPE,CPE) are front channel elements. * - Next element (CPE) is a back channel element. * - Last element (LFE) is a lfe channel element. */ @@ -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_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_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_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[] = { 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_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 } } }, + }; diff --git a/libMpegTPEnc/src/version b/libMpegTPEnc/src/version index 91c4c67..2803347 100644 --- a/libMpegTPEnc/src/version +++ b/libMpegTPEnc/src/version @@ -2,7 +2,7 @@ /* library info */ #define TP_LIB_VL0 2 #define TP_LIB_VL1 3 -#define TP_LIB_VL2 2 +#define TP_LIB_VL2 3 #define TP_LIB_TITLE "MPEG Transport" #define TP_LIB_BUILD_DATE __DATE__ #define TP_LIB_BUILD_TIME __TIME__ diff --git a/libSBRenc/include/sbr_encoder.h b/libSBRenc/include/sbr_encoder.h index 9d59ac7..93dc46d 100644 --- a/libSBRenc/include/sbr_encoder.h +++ b/libSBRenc/include/sbr_encoder.h @@ -324,7 +324,7 @@ UINT sbrEncoder_IsSingleRatePossible(AUDIO_OBJECT_TYPE aot); */ INT sbrEncoder_Init( HANDLE_SBR_ENCODER hSbrEncoder, - SBR_ELEMENT_INFO elInfo[(6)], + SBR_ELEMENT_INFO elInfo[(8)], int noElements, INT_PCM *inputBuffer, INT *coreBandwidth, @@ -369,8 +369,8 @@ void sbrEncoder_Close(HANDLE_SBR_ENCODER *phEbrEncoder); INT sbrEncoder_EncodeFrame(HANDLE_SBR_ENCODER hEnvEncoder, INT_PCM *samples, UINT timeInStride, - UINT sbrDataBits[(6)], - UCHAR sbrData[(6)][MAX_PAYLOAD_SIZE] + UINT sbrDataBits[(8)], + UCHAR sbrData[(8)][MAX_PAYLOAD_SIZE] ); /** diff --git a/libSBRenc/src/sbr.h b/libSBRenc/src/sbr.h index cfc595e..c74ad2a 100644 --- a/libSBRenc/src/sbr.h +++ b/libSBRenc/src/sbr.h @@ -131,9 +131,9 @@ typedef struct SBR_ELEMENT { typedef struct SBR_ENCODER { - HANDLE_SBR_ELEMENT sbrElement[(6)]; - HANDLE_SBR_CHANNEL pSbrChannel[(6)]; - QMF_FILTER_BANK QmfAnalysis[(6)]; + HANDLE_SBR_ELEMENT sbrElement[(8)]; + HANDLE_SBR_CHANNEL pSbrChannel[(8)]; + QMF_FILTER_BANK QmfAnalysis[(8)]; DOWNSAMPLER lfeDownSampler; int lfeChIdx; /* -1 default for no lfe, else assign channel index */ int noElements; /* Number of elements */ diff --git a/libSBRenc/src/sbr_encoder.cpp b/libSBRenc/src/sbr_encoder.cpp index 2d5bce2..3e95d6b 100644 --- a/libSBRenc/src/sbr_encoder.cpp +++ b/libSBRenc/src/sbr_encoder.cpp @@ -103,7 +103,7 @@ amm-info@iis.fraunhofer.de #define SBRENCODER_LIB_VL0 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) { int el, ch; - for (el=0; el<(6); el++) + for (el=0; el<(8); el++) { if (hSbrEncoder->sbrElement[el]!=NULL) { sbrEncoder_ElementClose(&hSbrEncoder->sbrElement[el]); @@ -661,7 +661,7 @@ void sbrEncoder_Close (HANDLE_SBR_ENCODER *phSbrEncoder) } /* Close sbr Channels */ - for (ch=0; ch<(6); ch++) + for (ch=0; ch<(8); ch++) { if (hSbrEncoder->pSbrChannel[ch]) { sbrEncoder_ChannelClose(hSbrEncoder->pSbrChannel[ch]); @@ -1468,7 +1468,7 @@ bail: static INT FDKsbrEnc_Reallocate( HANDLE_SBR_ENCODER hSbrEncoder, - SBR_ELEMENT_INFO elInfo[(6)], + SBR_ELEMENT_INFO elInfo[(8)], const INT noElements) { INT totalCh = 0; @@ -1806,7 +1806,7 @@ UINT sbrEncoder_IsSingleRatePossible(AUDIO_OBJECT_TYPE aot) INT sbrEncoder_Init( HANDLE_SBR_ENCODER hSbrEncoder, - SBR_ELEMENT_INFO elInfo[(6)], + SBR_ELEMENT_INFO elInfo[(8)], int noElements, INT_PCM *inputBuffer, INT *coreBandwidth, @@ -1823,7 +1823,7 @@ INT sbrEncoder_Init( ) { HANDLE_ERROR_INFO errorInfo = noError; - sbrConfiguration sbrConfig[(6)]; + sbrConfiguration sbrConfig[(8)]; INT error = 0; INT lowestBandwidth; /* Save input parameters */ @@ -2211,8 +2211,8 @@ INT sbrEncoder_EncodeFrame( HANDLE_SBR_ENCODER hSbrEncoder, INT_PCM *samples, UINT timeInStride, - UINT sbrDataBits[(6)], - UCHAR sbrData[(6)][MAX_PAYLOAD_SIZE] + UINT sbrDataBits[(8)], + UCHAR sbrData[(8)][MAX_PAYLOAD_SIZE] ) { INT error; diff --git a/libSBRenc/src/sbr_ram.cpp b/libSBRenc/src/sbr_ram.cpp index 3b99d09..ee6c37f 100644 --- a/libSBRenc/src/sbr_ram.cpp +++ b/libSBRenc/src/sbr_ram.cpp @@ -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 */ C_ALLOC_MEM (Ram_SbrEncoder, SBR_ENCODER, 1) -C_ALLOC_MEM2(Ram_SbrChannel, SBR_CHANNEL, 1, (6)) -C_ALLOC_MEM2(Ram_SbrElement, SBR_ELEMENT, 1, (6)) +C_ALLOC_MEM2(Ram_SbrChannel, SBR_CHANNEL, 1, (8)) +C_ALLOC_MEM2(Ram_SbrElement, SBR_ELEMENT, 1, (8)) /*! Filter states for QMF-analysis. <br> 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 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 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> 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> 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> 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)) /*! sbr_detectionVectors <br> 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> 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> 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> 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_guideVectorDiff, 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), (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), (8)) +C_ALLOC_MEM2 (Ram_Sbr_guideVectorOrig, FIXP_DBL, (MAX_NO_OF_ESTIMATES*MAX_FREQ_COEFFS), (8)) /* Static Parametric Stereo memory @@ -191,7 +191,7 @@ C_ALLOC_MEM (Ram_ParamStereo, PARAMETRIC_STEREO, 1) /*! Energy buffer for envelope extraction <br> 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) { FDK_ASSERT(dynamic_RAM!=0); diff --git a/libSYS/include/FDK_audio.h b/libSYS/include/FDK_audio.h index d2c5f9a..c8d9c19 100644 --- a/libSYS/include/FDK_audio.h +++ b/libSYS/include/FDK_audio.h @@ -234,28 +234,32 @@ typedef enum /** Channel Mode ( 1-7 equals MPEG channel configurations, others are arbitrary). */ typedef enum { - MODE_INVALID = -1, - MODE_UNKNOWN = 0, - MODE_1 = 1, /**< SCE */ - MODE_2 = 2, /**< CPE */ - MODE_1_2 = 3, /**< SCE,CPE */ - MODE_1_2_1 = 4, /**< SCE,CPE,SCE */ - MODE_1_2_2 = 5, /**< SCE,CPE,CPE */ - MODE_1_2_2_1 = 6, /**< SCE,CPE,CPE,LFE */ - MODE_1_2_2_2_1 = 7, /**< SCE,CPE,CPE,CPE,LFE */ - - MODE_1_1 = 16, /**< 2 SCEs (dual mono) */ - MODE_1_1_1_1 = 17, /**< 4 SCEs */ - MODE_1_1_1_1_1_1 = 18, /**< 6 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_2_2 = 23, /**< 4 CPEs */ - MODE_2_2_2_2_2_2 = 24, /**< 6 CPEs */ - - MODE_2_1 = 30 /**< CPE,SCE (ARIB standard) */ + MODE_INVALID = -1, + MODE_UNKNOWN = 0, + MODE_1 = 1, /**< C */ + MODE_2 = 2, /**< L+R */ + MODE_1_2 = 3, /**< C, L+R */ + MODE_1_2_1 = 4, /**< C, L+R, Rear */ + MODE_1_2_2 = 5, /**< C, L+R, LS+RS */ + MODE_1_2_2_1 = 6, /**< C, L+R, LS+RS, 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_1_1_1_1 = 18, /**< 6 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_2_2 = 23, /**< 4 CPEs */ + MODE_2_2_2_2_2_2 = 24, /**< 6 CPEs */ + + 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; diff --git a/libSYS/src/genericStds.cpp b/libSYS/src/genericStds.cpp index f293189..f0199fb 100644 --- a/libSYS/src/genericStds.cpp +++ b/libSYS/src/genericStds.cpp @@ -99,7 +99,7 @@ amm-info@iis.fraunhofer.de /* library info */ #define SYS_LIB_VL0 1 #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_BUILD_DATE __DATE__ #define SYS_LIB_BUILD_TIME __TIME__ |