aboutsummaryrefslogtreecommitdiffstats
path: root/libAACenc
diff options
context:
space:
mode:
Diffstat (limited to 'libAACenc')
-rw-r--r--libAACenc/src/aacenc_lib.cpp19
-rw-r--r--libAACenc/src/adj_thr.cpp12
-rw-r--r--libAACenc/src/bitenc.cpp2
-rw-r--r--libAACenc/src/intensity.cpp19
4 files changed, 34 insertions, 18 deletions
diff --git a/libAACenc/src/aacenc_lib.cpp b/libAACenc/src/aacenc_lib.cpp
index 11db3da..0f0094f 100644
--- a/libAACenc/src/aacenc_lib.cpp
+++ b/libAACenc/src/aacenc_lib.cpp
@@ -1,7 +1,7 @@
/* -----------------------------------------------------------------------------
Software License for The Fraunhofer FDK AAC Codec Library for Android
-© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten
+© Copyright 1995 - 2019 Fraunhofer-Gesellschaft zur Förderung der angewandten
Forschung e.V. All rights reserved.
1. INTRODUCTION
@@ -907,6 +907,7 @@ static AACENC_ERROR FDKaacEnc_AdjustEncSettings(HANDLE_AACENCODER hAacEncoder,
case AOT_MP2_AAC_LC:
case AOT_MP2_SBR:
hAacConfig->usePns = 0;
+ FDK_FALLTHROUGH;
case AOT_AAC_LC:
case AOT_SBR:
case AOT_PS:
@@ -1215,7 +1216,8 @@ static INT aacenc_SbrCallback(void *self, HANDLE_FDK_BITSTREAM hBs,
INT aacenc_SscCallback(void *self, HANDLE_FDK_BITSTREAM hBs,
const AUDIO_OBJECT_TYPE coreCodec,
- const INT samplingRate, const INT stereoConfigIndex,
+ const INT samplingRate, const INT frameSize,
+ const INT stereoConfigIndex,
const INT coreSbrFrameLengthIndex, const INT configBytes,
const UCHAR configMode, UCHAR *configChanged) {
HANDLE_AACENCODER hAacEncoder = (HANDLE_AACENCODER)self;
@@ -1733,9 +1735,10 @@ AACENC_ERROR aacEncEncode(const HANDLE_AACENCODER hAacEncoder,
}
/* check if buffer descriptors are filled out properly. */
- if ((AACENC_OK != validateBufDesc(inBufDesc)) ||
- (AACENC_OK != validateBufDesc(outBufDesc)) || (inargs == NULL) ||
- (outargs == NULL)) {
+ if ((inargs == NULL) || (outargs == NULL) ||
+ ((AACENC_OK != validateBufDesc(inBufDesc)) &&
+ (inargs->numInSamples > 0)) ||
+ (AACENC_OK != validateBufDesc(outBufDesc))) {
err = AACENC_UNSUPPORTED_PARAMETER;
goto bail;
}
@@ -1758,6 +1761,10 @@ AACENC_ERROR aacEncEncode(const HANDLE_AACENCODER hAacEncoder,
hAacEncoder->inputBuffer +
(hAacEncoder->inputBufferOffset + hAacEncoder->nSamplesRead) /
hAacEncoder->aacConfig.nChannels;
+ newSamples -=
+ (newSamples %
+ hAacEncoder->extParam
+ .nChannels); /* process multiple samples of input channels */
/* Copy new input samples to internal buffer */
if (inBufDesc->bufElSizes[idx] == (INT)sizeof(INT_PCM)) {
@@ -2090,12 +2097,14 @@ AACENC_ERROR aacEncoder_SetParam(const HANDLE_AACENCODER hAacEncoder,
err = AACENC_INVALID_CONFIG;
goto bail;
}
+ FDK_FALLTHROUGH;
case AOT_SBR:
case AOT_MP2_SBR:
if (!(hAacEncoder->encoder_modis & (ENC_MODE_FLAG_SBR))) {
err = AACENC_INVALID_CONFIG;
goto bail;
}
+ FDK_FALLTHROUGH;
case AOT_AAC_LC:
case AOT_MP2_AAC_LC:
case AOT_ER_AAC_LD:
diff --git a/libAACenc/src/adj_thr.cpp b/libAACenc/src/adj_thr.cpp
index 6e19680..226d003 100644
--- a/libAACenc/src/adj_thr.cpp
+++ b/libAACenc/src/adj_thr.cpp
@@ -1,7 +1,7 @@
/* -----------------------------------------------------------------------------
Software License for The Fraunhofer FDK AAC Codec Library for Android
-© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten
+© Copyright 1995 - 2019 Fraunhofer-Gesellschaft zur Förderung der angewandten
Forschung e.V. All rights reserved.
1. INTRODUCTION
@@ -591,13 +591,11 @@ static void FDKaacEnc_initAvoidHoleFlag(
if (sfbEn > avgEn) {
FIXP_DBL tmpMinSnrLdData;
if (psyOutChannel[ch]->lastWindowSequence == LONG_WINDOW)
- tmpMinSnrLdData =
- fixMax(SnrLdFac + (FIXP_DBL)(avgEnLdData - sfbEnLdData),
- (FIXP_DBL)SnrLdMin1);
+ tmpMinSnrLdData = SnrLdFac + fixMax(avgEnLdData - sfbEnLdData,
+ SnrLdMin1 - SnrLdFac);
else
- tmpMinSnrLdData =
- fixMax(SnrLdFac + (FIXP_DBL)(avgEnLdData - sfbEnLdData),
- (FIXP_DBL)SnrLdMin3);
+ tmpMinSnrLdData = SnrLdFac + fixMax(avgEnLdData - sfbEnLdData,
+ SnrLdMin3 - SnrLdFac);
qcOutChan->sfbMinSnrLdData[sfbGrp + sfb] = fixMin(
qcOutChan->sfbMinSnrLdData[sfbGrp + sfb], tmpMinSnrLdData);
diff --git a/libAACenc/src/bitenc.cpp b/libAACenc/src/bitenc.cpp
index 652d1fd..957e821 100644
--- a/libAACenc/src/bitenc.cpp
+++ b/libAACenc/src/bitenc.cpp
@@ -643,6 +643,7 @@ static INT FDKaacEnc_writeExtensionPayload(HANDLE_FDK_BITSTREAM hBitStream,
FDKwriteBits(hBitStream, *extPayloadData++, 4); /* nibble */
}
extBitsUsed += 4;
+ FDK_FALLTHROUGH;
case EXT_DYNAMIC_RANGE:
case EXT_SBR_DATA:
case EXT_SBR_DATA_CRC:
@@ -690,6 +691,7 @@ static INT FDKaacEnc_writeExtensionPayload(HANDLE_FDK_BITSTREAM hBitStream,
case EXT_FILL_DATA:
fillByte = 0xA5;
+ FDK_FALLTHROUGH;
case EXT_FIL:
default:
if (hBitStream != NULL) {
diff --git a/libAACenc/src/intensity.cpp b/libAACenc/src/intensity.cpp
index a160a4f..0944fa3 100644
--- a/libAACenc/src/intensity.cpp
+++ b/libAACenc/src/intensity.cpp
@@ -1,7 +1,7 @@
/* -----------------------------------------------------------------------------
Software License for The Fraunhofer FDK AAC Codec Library for Android
-© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten
+© Copyright 1995 - 2019 Fraunhofer-Gesellschaft zur Förderung der angewandten
Forschung e.V. All rights reserved.
1. INTRODUCTION
@@ -661,6 +661,7 @@ void FDKaacEnc_IntensityStereoProcessing(
for (sfboffs = 0; sfboffs < maxSfbPerGroup; sfboffs++) {
INT sL, sR;
FIXP_DBL inv_n;
+ INT mdct_spec_sf = MDCT_SPEC_SF;
msMask[sfb + sfboffs] = 0;
if (isMask[sfb + sfboffs] == 0) {
@@ -682,6 +683,12 @@ void FDKaacEnc_IntensityStereoProcessing(
}
}
+ if (sfbOffset[sfb + sfboffs + 1] - sfbOffset[sfb + sfboffs] >
+ 1 << mdct_spec_sf) {
+ mdct_spec_sf++; /* This is for rare cases where the number of bins in a
+ scale factor band is > 64 */
+ }
+
inv_n = GetInvInt(
(sfbOffset[sfb + sfboffs + 1] - sfbOffset[sfb + sfboffs]) >>
1); // scaled with 2 to compensate fMultDiv2() in subsequent loop
@@ -707,11 +714,11 @@ void FDKaacEnc_IntensityStereoProcessing(
j++) {
d = ((mdctSpectrumLeft[j] << s0) >> 1) -
((mdctSpectrumRight[j] << s0) >> 1);
- ed += fMultDiv2(d, d) >> (MDCT_SPEC_SF - 1);
+ ed += fMultDiv2(d, d) >> (mdct_spec_sf - 1);
}
msMask[sfb + sfboffs] = 1;
tmp = fDivNorm(sfbEnergyLeft[sfb + sfboffs], ed, &s1);
- s2 = (s1) + (2 * s0) - 2 - MDCT_SPEC_SF;
+ s2 = (s1) + (2 * s0) - 2 - mdct_spec_sf;
if (s2 & 1) {
tmp = tmp >> 1;
s2 = s2 + 1;
@@ -748,12 +755,12 @@ void FDKaacEnc_IntensityStereoProcessing(
s = ((mdctSpectrumLeft[j] << s0) >> 1) +
((mdctSpectrumRight[j] << s0) >> 1);
es += fMultDiv2(s, s) >>
- (MDCT_SPEC_SF -
- 1); // scaled 2*(mdctScale - s0 + 1) + MDCT_SPEC_SF
+ (mdct_spec_sf -
+ 1); // scaled 2*(mdctScale - s0 + 1) + mdct_spec_sf
}
msMask[sfb + sfboffs] = 0;
tmp = fDivNorm(sfbEnergyLeft[sfb + sfboffs], es, &s1);
- s2 = (s1) + (2 * s0) - 2 - MDCT_SPEC_SF;
+ s2 = (s1) + (2 * s0) - 2 - mdct_spec_sf;
if (s2 & 1) {
tmp = tmp >> 1;
s2 = s2 + 1;