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 /libAACenc/src/channel_map.cpp | |
parent | 9f455bea1c38f7275a65ab79be2d41a34428fb8b (diff) | |
download | fdk-aac-fa3eba16446cc8f2f5e2dfc20d86a49dbd37299e.tar.gz fdk-aac-fa3eba16446cc8f2f5e2dfc20d86a49dbd37299e.tar.bz2 fdk-aac-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
Diffstat (limited to 'libAACenc/src/channel_map.cpp')
-rw-r--r-- | libAACenc/src/channel_map.cpp | 51 |
1 files changed, 29 insertions, 22 deletions
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 */ |