aboutsummaryrefslogtreecommitdiffstats
path: root/libDRCdec/src/drcDec_reader.cpp
diff options
context:
space:
mode:
authorFraunhofer IIS FDK <audio-fdk@iis.fraunhofer.de>2018-12-20 15:52:47 +0100
committerJean-Michel Trivi <jmtrivi@google.com>2020-01-22 11:11:56 -0800
commit3ce7751a440cafe41ff2eefb105b03096fbe122c (patch)
treea62c4b53e6bfd56c4a9df7b86cb2acc217185b5c /libDRCdec/src/drcDec_reader.cpp
parentcee316ab3ebde92047b5e76d15c00768b92cb890 (diff)
downloadfdk-aac-3ce7751a440cafe41ff2eefb105b03096fbe122c.tar.gz
fdk-aac-3ce7751a440cafe41ff2eefb105b03096fbe122c.tar.bz2
fdk-aac-3ce7751a440cafe41ff2eefb105b03096fbe122c.zip
Perform sanity check on DRC sets and improve the selection process
Bug: 137282770 Bug: 141883493 Test: atest DecoderTestXheAac ; atest DecoderTestAacDrc Change-Id: Ie8e17c82653cb0d9adcdb10ec3f4875b6207ac6f
Diffstat (limited to 'libDRCdec/src/drcDec_reader.cpp')
-rw-r--r--libDRCdec/src/drcDec_reader.cpp23
1 files changed, 13 insertions, 10 deletions
diff --git a/libDRCdec/src/drcDec_reader.cpp b/libDRCdec/src/drcDec_reader.cpp
index 9e37246..367a352 100644
--- a/libDRCdec/src/drcDec_reader.cpp
+++ b/libDRCdec/src/drcDec_reader.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
@@ -199,11 +199,8 @@ drcDec_readUniDrc(HANDLE_FDK_BITSTREAM hBs, HANDLE_UNI_DRC_CONFIG hUniDrcConfig,
}
}
- if (hUniDrcGain != NULL) {
- err = drcDec_readUniDrcGain(hBs, hUniDrcConfig, frameSize, deltaTminDefault,
- hUniDrcGain);
- if (err) return err;
- }
+ err = drcDec_readUniDrcGain(hBs, hUniDrcConfig, frameSize, deltaTminDefault,
+ hUniDrcGain);
return err;
}
@@ -487,10 +484,13 @@ drcDec_readUniDrcGain(HANDLE_FDK_BITSTREAM hBs,
int seq, gainSequenceCount;
DRC_COEFFICIENTS_UNI_DRC* pCoef =
selectDrcCoefficients(hUniDrcConfig, LOCATION_SELECTED);
- if (pCoef == NULL) return DE_OK;
- if (hUniDrcGain == NULL) return DE_OK; /* hUniDrcGain not initialized yet */
-
- gainSequenceCount = fMin(pCoef->gainSequenceCount, (UCHAR)12);
+ if (hUniDrcGain == NULL) return DE_NOT_OK;
+ hUniDrcGain->status = 0;
+ if (pCoef) {
+ gainSequenceCount = fMin(pCoef->gainSequenceCount, (UCHAR)12);
+ } else {
+ gainSequenceCount = 0;
+ }
for (seq = 0; seq < gainSequenceCount; seq++) {
UCHAR index = pCoef->gainSetIndexForGainSequence[seq];
@@ -518,6 +518,9 @@ drcDec_readUniDrcGain(HANDLE_FDK_BITSTREAM hBs,
if (err) return err;
}
+ if (err == DE_OK && gainSequenceCount > 0) {
+ hUniDrcGain->status = 1;
+ }
return err;
}