From 2bd940425413c735ea78f931250ee1da8ad6691b Mon Sep 17 00:00:00 2001 From: Fraunhofer IIS FDK Date: Thu, 20 Dec 2018 15:52:46 +0100 Subject: Always call startSelectionProcess() independent on an error in FDK_drcDec_ReadUniDrc() Test: atest DecoderTestXheAac ; atest DecoderTestAacDrc Change-Id: Ie7fdb69ea7a6d68b14b9fa06e68c86496cb01a02 --- libDRCdec/src/FDK_drcDecLib.cpp | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) (limited to 'libDRCdec/src/FDK_drcDecLib.cpp') diff --git a/libDRCdec/src/FDK_drcDecLib.cpp b/libDRCdec/src/FDK_drcDecLib.cpp index b29b79d..16b8152 100644 --- a/libDRCdec/src/FDK_drcDecLib.cpp +++ b/libDRCdec/src/FDK_drcDecLib.cpp @@ -173,13 +173,11 @@ static int isResetNeeded(HANDLE_DRC_DECODER hDrcDec, return resetNeeded; } -static DRC_DEC_ERROR startSelectionProcess(HANDLE_DRC_DECODER hDrcDec) { - DRC_ERROR dErr = DE_OK; - DRCDEC_SELECTION_PROCESS_RETURN sErr = DRCDEC_SELECTION_PROCESS_NO_ERROR; +static void startSelectionProcess(HANDLE_DRC_DECODER hDrcDec) { int uniDrcConfigHasChanged = 0; SEL_PROC_OUTPUT oldSelProcOutput = hDrcDec->selProcOutput; - if (!hDrcDec->status) return DRC_DEC_NOT_READY; + if (!hDrcDec->status) return; if (hDrcDec->functionalRange & DRC_DEC_SELECTION) { uniDrcConfigHasChanged = hDrcDec->uniDrcConfig.diff; @@ -189,10 +187,9 @@ static DRC_DEC_ERROR startSelectionProcess(HANDLE_DRC_DECODER hDrcDec) { */ hDrcDec->selProcOutput.numSelectedDrcSets = 0; - sErr = drcDec_SelectionProcess_Process( + drcDec_SelectionProcess_Process( hDrcDec->hSelectionProc, &(hDrcDec->uniDrcConfig), &(hDrcDec->loudnessInfoSet), &(hDrcDec->selProcOutput)); - if (sErr) return DRC_DEC_OK; hDrcDec->selProcInputDiff = 0; hDrcDec->uniDrcConfig.diff = 0; @@ -202,15 +199,12 @@ static DRC_DEC_ERROR startSelectionProcess(HANDLE_DRC_DECODER hDrcDec) { if (hDrcDec->functionalRange & DRC_DEC_GAIN) { if (isResetNeeded(hDrcDec, oldSelProcOutput) || uniDrcConfigHasChanged) { - dErr = - drcDec_GainDecoder_Config(hDrcDec->hGainDec, &(hDrcDec->uniDrcConfig), - hDrcDec->selProcOutput.numSelectedDrcSets, - hDrcDec->selProcOutput.selectedDrcSetIds, - hDrcDec->selProcOutput.selectedDownmixIds); - if (dErr) return DRC_DEC_OK; + drcDec_GainDecoder_Config(hDrcDec->hGainDec, &(hDrcDec->uniDrcConfig), + hDrcDec->selProcOutput.numSelectedDrcSets, + hDrcDec->selProcOutput.selectedDrcSetIds, + hDrcDec->selProcOutput.selectedDownmixIds); } } - return DRC_DEC_OK; } DRC_DEC_ERROR @@ -721,9 +715,9 @@ FDK_drcDec_ReadUniDrc(HANDLE_DRC_DECODER hDrcDec, drcDec_GainDecoder_GetFrameSize(hDrcDec->hGainDec), drcDec_GainDecoder_GetDeltaTminDefault(hDrcDec->hGainDec), &(hDrcDec->uniDrcGain)); - if (dErr) return DRC_DEC_NOT_OK; startSelectionProcess(hDrcDec); + if (dErr) return DRC_DEC_NOT_OK; hDrcDec->status = DRC_DEC_NEW_GAIN_PAYLOAD; -- cgit v1.2.3 From 37972d5a1f175173c2747c043ae6f3d1a142d28a Mon Sep 17 00:00:00 2001 From: Fraunhofer IIS FDK Date: Fri, 8 Mar 2019 16:01:59 +0100 Subject: Add support for Album Mode (FDKdec v3.1.0). Bug: 131255165 Test: atest DecoderTestXheAac ; atest DecoderTestAacDrc Change-Id: I6b4b176ec497587238537bddd89889341733d4e2 --- documentation/aacDecoder.pdf | Bin 500827 -> 487685 bytes libAACdec/include/aacdecoder_lib.h | 8 +++++++- libAACdec/src/aacdecoder_lib.cpp | 9 +++++++-- libDRCdec/include/FDK_drcDecLib.h | 3 ++- libDRCdec/src/FDK_drcDecLib.cpp | 8 +++++++- libDRCdec/src/drcDec_selectionProcess.cpp | 7 ++++++- libDRCdec/src/drcDec_selectionProcess.h | 3 ++- 7 files changed, 31 insertions(+), 7 deletions(-) (limited to 'libDRCdec/src/FDK_drcDecLib.cpp') diff --git a/documentation/aacDecoder.pdf b/documentation/aacDecoder.pdf index 1dec334..5c4ef5e 100644 Binary files a/documentation/aacDecoder.pdf and b/documentation/aacDecoder.pdf differ diff --git a/libAACdec/include/aacdecoder_lib.h b/libAACdec/include/aacdecoder_lib.h index 3a9b910..ee34b22 100644 --- a/libAACdec/include/aacdecoder_lib.h +++ b/libAACdec/include/aacdecoder_lib.h @@ -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 @@ -781,6 +781,12 @@ typedef enum { to 127 (31.75 dB below full-scale). This parameter is used only with ::AAC_DRC_PARAMETER_HANDLING_ENABLED and ignored otherwise.\n Default: 127 (worst-case assumption).\n */ + AAC_UNIDRC_ALBUM_MODE = + 0x0207, /*!< MPEG-D DRC: Enable album mode. 0: Disabled (default), 1: + Enabled.\n Disabled album mode leads to application of gain + sequences for fading in and out, if provided in the + bitstream.\n Enabled album mode makes use of dedicated album + loudness information, if provided in the bitstream.\n */ AAC_QMF_LOWPOWER = 0x0300, /*!< Quadrature Mirror Filter (QMF) Bank processing mode. \n -1: Use internal default. Implies MPEG Surround partially complex accordingly. \n 0: diff --git a/libAACdec/src/aacdecoder_lib.cpp b/libAACdec/src/aacdecoder_lib.cpp index c214ba1..d0e4ebc 100644 --- a/libAACdec/src/aacdecoder_lib.cpp +++ b/libAACdec/src/aacdecoder_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 @@ -119,7 +119,7 @@ amm-info@iis.fraunhofer.de /* Decoder library info */ #define AACDECODER_LIB_VL0 3 -#define AACDECODER_LIB_VL1 0 +#define AACDECODER_LIB_VL1 1 #define AACDECODER_LIB_VL2 0 #define AACDECODER_LIB_TITLE "AAC Decoder Lib" #ifdef __ANDROID__ @@ -871,6 +871,11 @@ LINKSPEC_CPP AAC_DECODER_ERROR aacDecoder_SetParam( uniDrcErr = FDK_drcDec_SetParam(self->hUniDrcDecoder, DRC_DEC_EFFECT_TYPE, (FIXP_DBL)value); break; + case AAC_UNIDRC_ALBUM_MODE: + uniDrcErr = FDK_drcDec_SetParam(self->hUniDrcDecoder, DRC_DEC_ALBUM_MODE, + (FIXP_DBL)value); + break; + case AAC_TPDEC_CLEAR_BUFFER: errTp = transportDec_SetParam(hTpDec, TPDEC_PARAM_RESET, 1); self->streamInfo.numLostAccessUnits = 0; diff --git a/libDRCdec/include/FDK_drcDecLib.h b/libDRCdec/include/FDK_drcDecLib.h index e187e18..9a99ed1 100644 --- a/libDRCdec/include/FDK_drcDecLib.h +++ b/libDRCdec/include/FDK_drcDecLib.h @@ -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 @@ -134,6 +134,7 @@ typedef enum { DRC_DEC_EFFECT_TYPE, DRC_DEC_EFFECT_TYPE_FALLBACK_CODE, DRC_DEC_LOUDNESS_MEASUREMENT_METHOD, + DRC_DEC_ALBUM_MODE, /* set only system (not user) parameters */ DRC_DEC_DOWNMIX_ID, DRC_DEC_TARGET_CHANNEL_COUNT_REQUESTED, /**< number of output channels diff --git a/libDRCdec/src/FDK_drcDecLib.cpp b/libDRCdec/src/FDK_drcDecLib.cpp index 16b8152..8f3faa0 100644 --- a/libDRCdec/src/FDK_drcDecLib.cpp +++ b/libDRCdec/src/FDK_drcDecLib.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 @@ -440,6 +440,12 @@ FDK_drcDec_SetParam(HANDLE_DRC_DECODER hDrcDec, requestValue, &(hDrcDec->selProcInputDiff)); if (sErr) return DRC_DEC_PARAM_OUT_OF_RANGE; break; + case DRC_DEC_ALBUM_MODE: + sErr = drcDec_SelectionProcess_SetParam(hDrcDec->hSelectionProc, + SEL_PROC_ALBUM_MODE, requestValue, + &(hDrcDec->selProcInputDiff)); + if (sErr) return DRC_DEC_PARAM_OUT_OF_RANGE; + break; default: return DRC_DEC_INVALID_PARAM; } diff --git a/libDRCdec/src/drcDec_selectionProcess.cpp b/libDRCdec/src/drcDec_selectionProcess.cpp index 5653e22..37f5722 100644 --- a/libDRCdec/src/drcDec_selectionProcess.cpp +++ b/libDRCdec/src/drcDec_selectionProcess.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 @@ -555,6 +555,11 @@ drcDec_SelectionProcess_SetParam(HANDLE_DRC_SELECTION_PROCESS hInstance, diff |= _compAssign(&pSelProcInput->loudnessMeasurementMethod, requestValueInt); break; + case SEL_PROC_ALBUM_MODE: + if ((requestValueInt < 0) || (requestValueInt > 1)) + return DRCDEC_SELECTION_PROCESS_PARAM_OUT_OF_RANGE; + diff |= _compAssign(&pSelProcInput->albumMode, requestValueInt); + break; case SEL_PROC_DOWNMIX_ID: diff |= _compAssign(&pSelProcInput->targetConfigRequestType, TCRT_DOWNMIX_ID); diff --git a/libDRCdec/src/drcDec_selectionProcess.h b/libDRCdec/src/drcDec_selectionProcess.h index 9e0e3fb..420bae6 100644 --- a/libDRCdec/src/drcDec_selectionProcess.h +++ b/libDRCdec/src/drcDec_selectionProcess.h @@ -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 @@ -146,6 +146,7 @@ typedef enum { SEL_PROC_EFFECT_TYPE, SEL_PROC_EFFECT_TYPE_FALLBACK_CODE, SEL_PROC_LOUDNESS_MEASUREMENT_METHOD, + SEL_PROC_ALBUM_MODE, SEL_PROC_DOWNMIX_ID, SEL_PROC_TARGET_LAYOUT, SEL_PROC_TARGET_CHANNEL_COUNT, -- cgit v1.2.3 From e970ac4c95e2e1016c72caa5218fc8f1bafe58fe Mon Sep 17 00:00:00 2001 From: Fraunhofer IIS FDK Date: Fri, 8 Mar 2019 16:08:07 +0100 Subject: Fix HE-AAC using MPEG-D DRC with implicit SBR signaling. Bug: 132641988 Test: atest DecoderTestXheAac ; atest DecoderTestAacDrc Change-Id: I97c5d3972528092f627153ad3127c7db977a0e5d --- libAACdec/src/aacdecoder_lib.cpp | 7 ++ libDRCdec/include/FDK_drcDecLib.h | 2 + libDRCdec/src/FDK_drcDecLib.cpp | 160 ++++++++++++++++++++--------------- libDRCdec/src/drcDec_gainDecoder.cpp | 26 +++++- libDRCdec/src/drcDec_gainDecoder.h | 12 ++- libDRCdec/src/drcGainDec_init.cpp | 21 +---- libDRCdec/src/drcGainDec_init.h | 5 +- 7 files changed, 139 insertions(+), 94 deletions(-) (limited to 'libDRCdec/src/FDK_drcDecLib.cpp') diff --git a/libAACdec/src/aacdecoder_lib.cpp b/libAACdec/src/aacdecoder_lib.cpp index 4046d66..86ec899 100644 --- a/libAACdec/src/aacdecoder_lib.cpp +++ b/libAACdec/src/aacdecoder_lib.cpp @@ -1676,6 +1676,13 @@ aacDecoder_DecodeFrame(HANDLE_AACDECODER self, INT_PCM *pTimeData_extern, reverseOutChannelMap[ch] = ch; } + /* Update sampleRate and frameSize. This may be necessary in case of + * implicit SBR signaling */ + FDK_drcDec_SetParam(self->hUniDrcDecoder, DRC_DEC_SAMPLE_RATE, + self->streamInfo.sampleRate); + FDK_drcDec_SetParam(self->hUniDrcDecoder, DRC_DEC_FRAME_SIZE, + self->streamInfo.frameSize); + /* If SBR and/or MPS is active, the DRC gains are aligned to the QMF domain signal before the QMF synthesis. Therefore the DRC gains need to be delayed by the QMF synthesis delay. */ diff --git a/libDRCdec/include/FDK_drcDecLib.h b/libDRCdec/include/FDK_drcDecLib.h index 9a99ed1..2d28d23 100644 --- a/libDRCdec/include/FDK_drcDecLib.h +++ b/libDRCdec/include/FDK_drcDecLib.h @@ -142,6 +142,8 @@ typedef enum { choosing an appropriate downmixInstruction */ DRC_DEC_BASE_CHANNEL_COUNT, + DRC_DEC_FRAME_SIZE, + DRC_DEC_SAMPLE_RATE, /* get only system parameters */ DRC_DEC_IS_MULTIBAND_DRC_1, DRC_DEC_IS_MULTIBAND_DRC_2, diff --git a/libDRCdec/src/FDK_drcDecLib.cpp b/libDRCdec/src/FDK_drcDecLib.cpp index 8f3faa0..4f8ebc7 100644 --- a/libDRCdec/src/FDK_drcDecLib.cpp +++ b/libDRCdec/src/FDK_drcDecLib.cpp @@ -336,7 +336,13 @@ FDK_drcDec_Init(HANDLE_DRC_DECODER hDrcDec, const int frameSize, } if (hDrcDec->functionalRange & DRC_DEC_GAIN) { - dErr = drcDec_GainDecoder_Init(hDrcDec->hGainDec, frameSize, sampleRate); + dErr = drcDec_GainDecoder_SetParam(hDrcDec->hGainDec, GAIN_DEC_FRAME_SIZE, + frameSize); + if (dErr) return DRC_DEC_NOT_OK; + dErr = drcDec_GainDecoder_SetParam(hDrcDec->hGainDec, GAIN_DEC_SAMPLE_RATE, + sampleRate); + if (dErr) return DRC_DEC_NOT_OK; + dErr = drcDec_GainDecoder_Init(hDrcDec->hGainDec); if (dErr) return DRC_DEC_NOT_OK; } @@ -377,79 +383,99 @@ DRC_DEC_ERROR FDK_drcDec_SetParam(HANDLE_DRC_DECODER hDrcDec, const DRC_DEC_USERPARAM requestType, const FIXP_DBL requestValue) { + DRC_ERROR dErr = DE_OK; DRCDEC_SELECTION_PROCESS_RETURN sErr = DRCDEC_SELECTION_PROCESS_NO_ERROR; + int invalidParameter = 0; if (hDrcDec == NULL) return DRC_DEC_NOT_OPENED; - if (hDrcDec->functionalRange == DRC_DEC_GAIN) - return DRC_DEC_NOT_OK; /* not supported for DRC_DEC_GAIN. All parameters are - handed over to selection process lib. */ + if (hDrcDec->functionalRange & DRC_DEC_GAIN) { + switch (requestType) { + case DRC_DEC_SAMPLE_RATE: + dErr = drcDec_GainDecoder_SetParam( + hDrcDec->hGainDec, GAIN_DEC_SAMPLE_RATE, (int)requestValue); + if (dErr) return DRC_DEC_PARAM_OUT_OF_RANGE; + break; + case DRC_DEC_FRAME_SIZE: + dErr = drcDec_GainDecoder_SetParam( + hDrcDec->hGainDec, GAIN_DEC_FRAME_SIZE, (int)requestValue); + if (dErr) return DRC_DEC_PARAM_OUT_OF_RANGE; + break; + default: + invalidParameter |= DRC_DEC_GAIN; + } + } - switch (requestType) { - case DRC_DEC_BOOST: - sErr = drcDec_SelectionProcess_SetParam(hDrcDec->hSelectionProc, - SEL_PROC_BOOST, requestValue, - &(hDrcDec->selProcInputDiff)); - if (sErr) return DRC_DEC_PARAM_OUT_OF_RANGE; - break; - case DRC_DEC_COMPRESS: - sErr = drcDec_SelectionProcess_SetParam(hDrcDec->hSelectionProc, - SEL_PROC_COMPRESS, requestValue, - &(hDrcDec->selProcInputDiff)); - if (sErr) return DRC_DEC_PARAM_OUT_OF_RANGE; - break; - case DRC_DEC_LOUDNESS_NORMALIZATION_ON: - sErr = drcDec_SelectionProcess_SetParam( - hDrcDec->hSelectionProc, SEL_PROC_LOUDNESS_NORMALIZATION_ON, - requestValue, &(hDrcDec->selProcInputDiff)); - if (sErr) return DRC_DEC_PARAM_OUT_OF_RANGE; - break; - case DRC_DEC_TARGET_LOUDNESS: - sErr = drcDec_SelectionProcess_SetParam( - hDrcDec->hSelectionProc, SEL_PROC_TARGET_LOUDNESS, requestValue, - &(hDrcDec->selProcInputDiff)); - if (sErr) return DRC_DEC_PARAM_OUT_OF_RANGE; - break; - case DRC_DEC_EFFECT_TYPE: - sErr = drcDec_SelectionProcess_SetParam( - hDrcDec->hSelectionProc, SEL_PROC_EFFECT_TYPE, requestValue, - &(hDrcDec->selProcInputDiff)); - if (sErr) return DRC_DEC_PARAM_OUT_OF_RANGE; - break; - case DRC_DEC_DOWNMIX_ID: - sErr = drcDec_SelectionProcess_SetParam(hDrcDec->hSelectionProc, - SEL_PROC_DOWNMIX_ID, requestValue, - &(hDrcDec->selProcInputDiff)); - if (sErr) return DRC_DEC_PARAM_OUT_OF_RANGE; - break; - case DRC_DEC_TARGET_CHANNEL_COUNT_REQUESTED: - sErr = drcDec_SelectionProcess_SetParam( - hDrcDec->hSelectionProc, SEL_PROC_TARGET_CHANNEL_COUNT, requestValue, - &(hDrcDec->selProcInputDiff)); - if (sErr) return DRC_DEC_PARAM_OUT_OF_RANGE; - break; - case DRC_DEC_BASE_CHANNEL_COUNT: - sErr = drcDec_SelectionProcess_SetParam( - hDrcDec->hSelectionProc, SEL_PROC_BASE_CHANNEL_COUNT, requestValue, - &(hDrcDec->selProcInputDiff)); - if (sErr) return DRC_DEC_NOT_OK; - break; - case DRC_DEC_LOUDNESS_MEASUREMENT_METHOD: - sErr = drcDec_SelectionProcess_SetParam( - hDrcDec->hSelectionProc, SEL_PROC_LOUDNESS_MEASUREMENT_METHOD, - requestValue, &(hDrcDec->selProcInputDiff)); - if (sErr) return DRC_DEC_PARAM_OUT_OF_RANGE; - break; - case DRC_DEC_ALBUM_MODE: - sErr = drcDec_SelectionProcess_SetParam(hDrcDec->hSelectionProc, - SEL_PROC_ALBUM_MODE, requestValue, - &(hDrcDec->selProcInputDiff)); - if (sErr) return DRC_DEC_PARAM_OUT_OF_RANGE; - break; - default: - return DRC_DEC_INVALID_PARAM; + if (hDrcDec->functionalRange & DRC_DEC_SELECTION) { + switch (requestType) { + case DRC_DEC_BOOST: + sErr = drcDec_SelectionProcess_SetParam(hDrcDec->hSelectionProc, + SEL_PROC_BOOST, requestValue, + &(hDrcDec->selProcInputDiff)); + if (sErr) return DRC_DEC_PARAM_OUT_OF_RANGE; + break; + case DRC_DEC_COMPRESS: + sErr = drcDec_SelectionProcess_SetParam(hDrcDec->hSelectionProc, + SEL_PROC_COMPRESS, requestValue, + &(hDrcDec->selProcInputDiff)); + if (sErr) return DRC_DEC_PARAM_OUT_OF_RANGE; + break; + case DRC_DEC_LOUDNESS_NORMALIZATION_ON: + sErr = drcDec_SelectionProcess_SetParam( + hDrcDec->hSelectionProc, SEL_PROC_LOUDNESS_NORMALIZATION_ON, + requestValue, &(hDrcDec->selProcInputDiff)); + if (sErr) return DRC_DEC_PARAM_OUT_OF_RANGE; + break; + case DRC_DEC_TARGET_LOUDNESS: + sErr = drcDec_SelectionProcess_SetParam( + hDrcDec->hSelectionProc, SEL_PROC_TARGET_LOUDNESS, requestValue, + &(hDrcDec->selProcInputDiff)); + if (sErr) return DRC_DEC_PARAM_OUT_OF_RANGE; + break; + case DRC_DEC_EFFECT_TYPE: + sErr = drcDec_SelectionProcess_SetParam( + hDrcDec->hSelectionProc, SEL_PROC_EFFECT_TYPE, requestValue, + &(hDrcDec->selProcInputDiff)); + if (sErr) return DRC_DEC_PARAM_OUT_OF_RANGE; + break; + case DRC_DEC_DOWNMIX_ID: + sErr = drcDec_SelectionProcess_SetParam( + hDrcDec->hSelectionProc, SEL_PROC_DOWNMIX_ID, requestValue, + &(hDrcDec->selProcInputDiff)); + if (sErr) return DRC_DEC_PARAM_OUT_OF_RANGE; + break; + case DRC_DEC_TARGET_CHANNEL_COUNT_REQUESTED: + sErr = drcDec_SelectionProcess_SetParam( + hDrcDec->hSelectionProc, SEL_PROC_TARGET_CHANNEL_COUNT, + requestValue, &(hDrcDec->selProcInputDiff)); + if (sErr) return DRC_DEC_PARAM_OUT_OF_RANGE; + break; + case DRC_DEC_BASE_CHANNEL_COUNT: + sErr = drcDec_SelectionProcess_SetParam( + hDrcDec->hSelectionProc, SEL_PROC_BASE_CHANNEL_COUNT, requestValue, + &(hDrcDec->selProcInputDiff)); + if (sErr) return DRC_DEC_NOT_OK; + break; + case DRC_DEC_LOUDNESS_MEASUREMENT_METHOD: + sErr = drcDec_SelectionProcess_SetParam( + hDrcDec->hSelectionProc, SEL_PROC_LOUDNESS_MEASUREMENT_METHOD, + requestValue, &(hDrcDec->selProcInputDiff)); + if (sErr) return DRC_DEC_PARAM_OUT_OF_RANGE; + break; + case DRC_DEC_ALBUM_MODE: + sErr = drcDec_SelectionProcess_SetParam( + hDrcDec->hSelectionProc, SEL_PROC_ALBUM_MODE, requestValue, + &(hDrcDec->selProcInputDiff)); + if (sErr) return DRC_DEC_PARAM_OUT_OF_RANGE; + break; + default: + invalidParameter |= DRC_DEC_SELECTION; + } } + if (invalidParameter == hDrcDec->functionalRange) + return DRC_DEC_INVALID_PARAM; + /* All parameters need a new start of the selection process */ startSelectionProcess(hDrcDec); diff --git a/libDRCdec/src/drcDec_gainDecoder.cpp b/libDRCdec/src/drcDec_gainDecoder.cpp index ca81fad..9d91267 100644 --- a/libDRCdec/src/drcDec_gainDecoder.cpp +++ b/libDRCdec/src/drcDec_gainDecoder.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 @@ -170,11 +170,10 @@ drcDec_GainDecoder_Open(HANDLE_DRC_GAIN_DECODER* phGainDec) { } DRC_ERROR -drcDec_GainDecoder_Init(HANDLE_DRC_GAIN_DECODER hGainDec, const int frameSize, - const int sampleRate) { +drcDec_GainDecoder_Init(HANDLE_DRC_GAIN_DECODER hGainDec) { DRC_ERROR err = DE_OK; - err = initGainDec(hGainDec, frameSize, sampleRate); + err = initGainDec(hGainDec); if (err) return err; initDrcGainBuffers(hGainDec->frameSize, &hGainDec->drcGainBuffers); @@ -182,6 +181,25 @@ drcDec_GainDecoder_Init(HANDLE_DRC_GAIN_DECODER hGainDec, const int frameSize, return err; } +DRC_ERROR +drcDec_GainDecoder_SetParam(HANDLE_DRC_GAIN_DECODER hGainDec, + const GAIN_DEC_PARAM paramType, + const int paramValue) { + switch (paramType) { + case GAIN_DEC_FRAME_SIZE: + if (paramValue < 0) return DE_PARAM_OUT_OF_RANGE; + hGainDec->frameSize = paramValue; + break; + case GAIN_DEC_SAMPLE_RATE: + if (paramValue < 0) return DE_PARAM_OUT_OF_RANGE; + hGainDec->deltaTminDefault = getDeltaTmin(paramValue); + break; + default: + return DE_PARAM_INVALID; + } + return DE_OK; +} + DRC_ERROR drcDec_GainDecoder_SetCodecDependentParameters( HANDLE_DRC_GAIN_DECODER hGainDec, const DELAY_MODE delayMode, diff --git a/libDRCdec/src/drcDec_gainDecoder.h b/libDRCdec/src/drcDec_gainDecoder.h index 2f4df4c..394b455 100644 --- a/libDRCdec/src/drcDec_gainDecoder.h +++ b/libDRCdec/src/drcDec_gainDecoder.h @@ -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 @@ -134,6 +134,8 @@ typedef enum { GAIN_DEC_DRC2_DRC3 } GAIN_DEC_LOCATION; +typedef enum { GAIN_DEC_FRAME_SIZE, GAIN_DEC_SAMPLE_RATE } GAIN_DEC_PARAM; + typedef struct { FIXP_DBL gainLin; /* e = 7 */ SHORT time; @@ -195,8 +197,12 @@ DRC_ERROR drcDec_GainDecoder_Open(HANDLE_DRC_GAIN_DECODER* phGainDec); DRC_ERROR -drcDec_GainDecoder_Init(HANDLE_DRC_GAIN_DECODER hGainDec, const int frameSize, - const int sampleRate); +drcDec_GainDecoder_Init(HANDLE_DRC_GAIN_DECODER hGainDec); + +DRC_ERROR +drcDec_GainDecoder_SetParam(HANDLE_DRC_GAIN_DECODER hGainDec, + const GAIN_DEC_PARAM paramType, + const int paramValue); DRC_ERROR drcDec_GainDecoder_SetCodecDependentParameters( diff --git a/libDRCdec/src/drcGainDec_init.cpp b/libDRCdec/src/drcGainDec_init.cpp index c9f87d7..89d0f55 100644 --- a/libDRCdec/src/drcGainDec_init.cpp +++ b/libDRCdec/src/drcGainDec_init.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 @@ -184,24 +184,11 @@ static DRC_ERROR _generateDrcInstructionsDerivedData( } DRC_ERROR -initGainDec(HANDLE_DRC_GAIN_DECODER hGainDec, const int frameSize, - const int sampleRate) { +initGainDec(HANDLE_DRC_GAIN_DECODER hGainDec) { int i, j, k; - if (frameSize < 1) { - return DE_NOT_OK; - } - - hGainDec->frameSize = frameSize; - - if (hGainDec->frameSize * 1000 < sampleRate) { - return DE_NOT_OK; - } - - hGainDec->deltaTminDefault = getDeltaTmin(sampleRate); - if (hGainDec->deltaTminDefault > hGainDec->frameSize) { - return DE_NOT_OK; - } + /* sanity check */ + if (hGainDec->deltaTminDefault > hGainDec->frameSize) return DE_NOT_OK; for (i = 0; i < MAX_ACTIVE_DRCS; i++) { for (j = 0; j < 8; j++) { diff --git a/libDRCdec/src/drcGainDec_init.h b/libDRCdec/src/drcGainDec_init.h index 9215bc3..c0b9853 100644 --- a/libDRCdec/src/drcGainDec_init.h +++ b/libDRCdec/src/drcGainDec_init.h @@ -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 @@ -104,8 +104,7 @@ amm-info@iis.fraunhofer.de #define DRCGAINDEC_INIT_H DRC_ERROR -initGainDec(HANDLE_DRC_GAIN_DECODER hGainDec, const int frameSize, - const int sampleRate); +initGainDec(HANDLE_DRC_GAIN_DECODER hGainDec); void initDrcGainBuffers(const int frameSize, DRC_GAIN_BUFFERS* drcGainBuffers); -- cgit v1.2.3