diff options
Diffstat (limited to 'libAACenc')
-rw-r--r-- | libAACenc/src/aacEnc_ram.cpp | 2 | ||||
-rw-r--r-- | libAACenc/src/aacenc.h | 3 | ||||
-rw-r--r-- | libAACenc/src/aacenc_lib.cpp | 7 | ||||
-rw-r--r-- | libAACenc/src/channel_map.cpp | 16 | ||||
-rw-r--r-- | libAACenc/src/quantize.cpp | 10 |
5 files changed, 32 insertions, 6 deletions
diff --git a/libAACenc/src/aacEnc_ram.cpp b/libAACenc/src/aacEnc_ram.cpp index 9366235..45bca93 100644 --- a/libAACenc/src/aacEnc_ram.cpp +++ b/libAACenc/src/aacEnc_ram.cpp @@ -95,7 +95,7 @@ amm-info@iis.fraunhofer.de #include "aacEnc_ram.h" - C_ALLOC_MEM (AACdynamic_RAM, FIXP_DBL, AAC_ENC_DYN_RAM_SIZE/sizeof(FIXP_DBL)) + C_AALLOC_MEM (AACdynamic_RAM, FIXP_DBL, AAC_ENC_DYN_RAM_SIZE/sizeof(FIXP_DBL)) /* Static memory areas, must not be overwritten in other sections of the decoder ! diff --git a/libAACenc/src/aacenc.h b/libAACenc/src/aacenc.h index 942f686..517b0dc 100644 --- a/libAACenc/src/aacenc.h +++ b/libAACenc/src/aacenc.h @@ -173,7 +173,8 @@ typedef enum { typedef enum { CH_ORDER_MPEG = 0, /*!< MPEG channel ordering (e. g. 5.1: C, L, R, SL, SR, LFE) */ - CH_ORDER_WAV /*!< WAV fileformat channel ordering (e. g. 5.1: L, R, C, LFE, SL, SR) */ + CH_ORDER_WAV, /*!< WAV fileformat channel ordering (e. g. 5.1: L, R, C, LFE, SL, SR) */ + CH_ORDER_WG4 /*!< WG4 fileformat channel ordering (e. g. 5.1: L, R, SL, SR, C, LFE) */ } CHANNEL_ORDER; diff --git a/libAACenc/src/aacenc_lib.cpp b/libAACenc/src/aacenc_lib.cpp index 07cfddc..a4291d5 100644 --- a/libAACenc/src/aacenc_lib.cpp +++ b/libAACenc/src/aacenc_lib.cpp @@ -1599,6 +1599,11 @@ AACENC_ERROR aacEncoder_SetParam( if (settings->userBitrateMode != value) { switch ( value ) { case 0: + case 1: + case 2: + case 3: + case 4: + case 5: case 8: settings->userBitrateMode = value; hAacEncoder->InitFlags |= AACENC_INIT_CONFIG | AACENC_INIT_TRANSPORT; @@ -1652,7 +1657,7 @@ AACENC_ERROR aacEncoder_SetParam( break; case AACENC_CHANNELORDER: if (hAacEncoder->aacConfig.channelOrder != (CHANNEL_ORDER)value) { - if (! ((value==0) || (value==1)) ) { + if (! ((value==0) || (value==1) || (value==2)) ) { err = AACENC_INVALID_CONFIG; break; } diff --git a/libAACenc/src/channel_map.cpp b/libAACenc/src/channel_map.cpp index 687ed83..6eddd47 100644 --- a/libAACenc/src/channel_map.cpp +++ b/libAACenc/src/channel_map.cpp @@ -153,6 +153,18 @@ static const CHANNEL_ASSIGNMENT_INFO_TAB assignmentInfoTabWav[] = { MODE_1_2_2_2_1, { 2, 0, 1, 6, 7, 4, 5, 3,-1,-1,-1,-1} }, /* 7.1ch */ }; +static const CHANNEL_ASSIGNMENT_INFO_TAB assignmentInfoTabWg4[] = +{ + { MODE_INVALID, {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1} }, /* invalid */ + { MODE_1, { 0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1} }, /* mono */ + { MODE_2, { 0, 1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1} }, /* stereo */ + { MODE_1_2, { 2, 0, 1,-1,-1,-1,-1,-1,-1,-1,-1,-1} }, /* 3ch */ + { MODE_1_2_1, { 3, 0, 1, 2,-1,-1,-1,-1,-1,-1,-1,-1} }, /* 4ch */ + { MODE_1_2_2, { 4, 0, 1, 2, 3,-1,-1,-1,-1,-1,-1,-1} }, /* 5ch */ + { MODE_1_2_2_1, { 4, 0, 1, 2, 3, 5,-1,-1,-1,-1,-1,-1} }, /* 5.1ch */ + { MODE_1_2_2_2_1, { 6, 0, 1, 2, 3, 4, 5, 7,-1,-1,-1,-1} }, /* 7.1ch */ +}; + /* Channel mode configuration tab provides, corresponding number of channels and elements */ @@ -176,8 +188,10 @@ const INT* FDKaacEnc_getChannelAssignment(CHANNEL_MODE encMode, CHANNEL_ORDER co if (co == CH_ORDER_MPEG) pTab = assignmentInfoTabMpeg; - else + else if (co == CH_ORDER_WAV) pTab = assignmentInfoTabWav; + else + pTab = assignmentInfoTabWg4; for(i=MAX_MODES-1; i>0; i--) { if (encMode== pTab[i].encoderMode) { diff --git a/libAACenc/src/quantize.cpp b/libAACenc/src/quantize.cpp index a1698a8..1f7402b 100644 --- a/libAACenc/src/quantize.cpp +++ b/libAACenc/src/quantize.cpp @@ -127,7 +127,10 @@ static void FDKaacEnc_quantizeLines(INT gain, accu = fMultDiv2(FDKaacEnc_mTab_3_4[tabIndex],FDKaacEnc_quantTableE[totalShift&3]); totalShift = (16-4)-(3*(totalShift>>2)); FDK_ASSERT(totalShift >=0); /* MAX_QUANT_VIOLATION */ - accu>>=totalShift; + if (totalShift < 32) + accu>>=totalShift; + else + accu = 0; quaSpectrum[line] = (SHORT)(-((LONG)(k + accu) >> (DFRACT_BITS-1-16))); } else if(accu > FL2FXCONST_DBL(0.0f)) @@ -140,7 +143,10 @@ static void FDKaacEnc_quantizeLines(INT gain, accu = fMultDiv2(FDKaacEnc_mTab_3_4[tabIndex],FDKaacEnc_quantTableE[totalShift&3]); totalShift = (16-4)-(3*(totalShift>>2)); FDK_ASSERT(totalShift >=0); /* MAX_QUANT_VIOLATION */ - accu>>=totalShift; + if (totalShift < 32) + accu>>=totalShift; + else + accu = 0; quaSpectrum[line] = (SHORT)((LONG)(k + accu) >> (DFRACT_BITS-1-16)); } else |