aboutsummaryrefslogtreecommitdiffstats
path: root/libAACenc/src
diff options
context:
space:
mode:
Diffstat (limited to 'libAACenc/src')
-rw-r--r--libAACenc/src/aacenc.h3
-rw-r--r--libAACenc/src/aacenc_lib.cpp2
-rw-r--r--libAACenc/src/aacenc_tns.cpp5
-rw-r--r--libAACenc/src/channel_map.cpp16
-rw-r--r--libAACenc/src/sf_estim.cpp1
5 files changed, 23 insertions, 4 deletions
diff --git a/libAACenc/src/aacenc.h b/libAACenc/src/aacenc.h
index 79524b5..dd09ed9 100644
--- a/libAACenc/src/aacenc.h
+++ b/libAACenc/src/aacenc.h
@@ -178,7 +178,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 64445b9..fc58d6d 100644
--- a/libAACenc/src/aacenc_lib.cpp
+++ b/libAACenc/src/aacenc_lib.cpp
@@ -1865,7 +1865,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/aacenc_tns.cpp b/libAACenc/src/aacenc_tns.cpp
index 9a07e8f..3026d69 100644
--- a/libAACenc/src/aacenc_tns.cpp
+++ b/libAACenc/src/aacenc_tns.cpp
@@ -388,7 +388,7 @@ AAC_ENCODER_ERROR FDKaacEnc_InitTnsConfiguration(INT bitRate,
switch (granuleLength) {
case 1024:
/* TNS start line: skip lower MDCT lines to prevent artifacts due to filter mismatch */
- tC->lpcStartBand[LOFILT] = (blockType == SHORT_WINDOW) ? 0 : ((sampleRate < 18783) ? 4 : 8);
+ tC->lpcStartBand[LOFILT] = (blockType == SHORT_WINDOW) ? 0 : ((sampleRate <= 8000) ? 2 : ((sampleRate < 18783) ? 4 : 8));
tC->lpcStartLine[LOFILT] = pC->sfbOffset[tC->lpcStartBand[LOFILT]];
i = tC->lpcStopBand;
@@ -1147,6 +1147,9 @@ static INT FDKaacEnc_AutoToParcor(
workBuffer++;
}
+ if (input[0] == 0)
+ input[0] = 1;
+
tmp = fMult((FIXP_DBL)((LONG)TNS_PREDGAIN_SCALE<<21), fDivNorm(fAbs(autoCorr_0), fAbs(input[0]), &scale));
if ( fMultDiv2(autoCorr_0, input[0])<FL2FXCONST_DBL(0.0f) ) {
tmp = -tmp;
diff --git a/libAACenc/src/channel_map.cpp b/libAACenc/src/channel_map.cpp
index 559a4ce..99ed2b5 100644
--- a/libAACenc/src/channel_map.cpp
+++ b/libAACenc/src/channel_map.cpp
@@ -157,6 +157,18 @@ static const CHANNEL_ASSIGNMENT_INFO_TAB assignmentInfoTabWav[] =
{ MODE_7_1_FRONT_CENTER, { 2, 6, 7, 0, 1, 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
*/
@@ -182,8 +194,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/sf_estim.cpp b/libAACenc/src/sf_estim.cpp
index 1cb243b..75b8d42 100644
--- a/libAACenc/src/sf_estim.cpp
+++ b/libAACenc/src/sf_estim.cpp
@@ -533,6 +533,7 @@ static void FDKaacEnc_assimilateSingleScf(PSY_OUT_CHANNEL *psyOutChan,
(scfAct > scfMin) &&
(scfAct <= scfMin+MAX_SCF_DELTA) &&
(scfAct >= scfMax-MAX_SCF_DELTA) &&
+ (scfAct <= fixMin(scfMin,fixMin(*scfLast, *scfNext))+MAX_SCF_DELTA) &&
(*scfLast != prevScfLast[sfbAct] ||
*scfNext != prevScfNext[sfbAct] ||
deltaPe < deltaPeLast[sfbAct])) {