From 167dcc380a53c0eb69cdfae97d0ba0fdc5af398d Mon Sep 17 00:00:00 2001 From: Jean-Michel Trivi Date: Tue, 25 Apr 2023 17:04:25 +0000 Subject: Remove obsolete uni drc precedence handling Bug: 241391733 Test: see bug (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:4c41b05b6c60275c2a6b28918f40c218a8b818f6) Merged-In: I0ddc479626fb6a89d04bc989256ad1d8ec4275a3 Change-Id: I0ddc479626fb6a89d04bc989256ad1d8ec4275a3 --- libAACdec/src/aacdec_drc.cpp | 10 +--------- libAACdec/src/aacdec_drc.h | 5 ++--- libAACdec/src/aacdec_drc_types.h | 7 +------ libAACdec/src/aacdecoder.cpp | 6 ------ libAACdec/src/aacdecoder_lib.cpp | 31 +++++++------------------------ 5 files changed, 11 insertions(+), 48 deletions(-) (limited to 'libAACdec/src') diff --git a/libAACdec/src/aacdec_drc.cpp b/libAACdec/src/aacdec_drc.cpp index 760a9ba..abb9af7 100644 --- a/libAACdec/src/aacdec_drc.cpp +++ b/libAACdec/src/aacdec_drc.cpp @@ -1,7 +1,7 @@ /* ----------------------------------------------------------------------------- Software License for The Fraunhofer FDK AAC Codec Library for Android -© Copyright 1995 - 2020 Fraunhofer-Gesellschaft zur Förderung der angewandten +© Copyright 1995 - 2023 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. All rights reserved. 1. INTRODUCTION @@ -217,7 +217,6 @@ void aacDecoder_drcInit(HANDLE_AAC_DRC self) { self->progRefLevel = pParams->targetRefLevel; self->progRefLevelPresent = 0; self->presMode = -1; - self->uniDrcPrecedence = 0; aacDecoder_drcReset(self); } @@ -353,12 +352,6 @@ AAC_DECODER_ERROR aacDecoder_drcSetParam(HANDLE_AAC_DRC self, self->numOutChannels = (INT)value; self->update = 1; break; - case UNIDRC_PRECEDENCE: - if (self == NULL) { - return AAC_DEC_INVALID_HANDLE; - } - self->uniDrcPrecedence = (UCHAR)value; - break; default: return AAC_DEC_SET_PARAM_FAIL; } /* switch(param) */ @@ -1258,7 +1251,6 @@ static void aacDecoder_drcParameterHandling(HANDLE_AAC_DRC self, /* switch on/off processing */ self->enable = ((p->boost > (FIXP_DBL)0) || (p->cut > (FIXP_DBL)0) || (p->applyHeavyCompression == ON) || (p->targetRefLevel >= 0)); - self->enable = (self->enable && !self->uniDrcPrecedence); self->prevAacNumChannels = aacNumChannels; self->update = 0; diff --git a/libAACdec/src/aacdec_drc.h b/libAACdec/src/aacdec_drc.h index 2bb945d..f2c1390 100644 --- a/libAACdec/src/aacdec_drc.h +++ b/libAACdec/src/aacdec_drc.h @@ -1,7 +1,7 @@ /* ----------------------------------------------------------------------------- Software License for The Fraunhofer FDK AAC Codec Library for Android -© Copyright 1995 - 2020 Fraunhofer-Gesellschaft zur Förderung der angewandten +© Copyright 1995 - 2023 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. All rights reserved. 1. INTRODUCTION @@ -133,8 +133,7 @@ typedef enum { APPLY_HEAVY_COMPRESSION, DEFAULT_PRESENTATION_MODE, ENCODER_TARGET_LEVEL, - MAX_OUTPUT_CHANNELS, - UNIDRC_PRECEDENCE + MAX_OUTPUT_CHANNELS } AACDEC_DRC_PARAM; /** diff --git a/libAACdec/src/aacdec_drc_types.h b/libAACdec/src/aacdec_drc_types.h index d4393f7..c4c0794 100644 --- a/libAACdec/src/aacdec_drc_types.h +++ b/libAACdec/src/aacdec_drc_types.h @@ -1,7 +1,7 @@ /* ----------------------------------------------------------------------------- Software License for The Fraunhofer FDK AAC Codec Library for Android -© Copyright 1995 - 2019 Fraunhofer-Gesellschaft zur Förderung der angewandten +© Copyright 1995 - 2023 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. All rights reserved. 1. INTRODUCTION @@ -207,11 +207,6 @@ typedef struct { position in the bitstream (only one per frame) */ UINT drcPayloadPosition[MAX_DRC_THREADS]; /* Used to store the DRC payload positions in the bitstream */ - - UCHAR - uniDrcPrecedence; /* Flag for signalling that uniDrc is active and takes - precedence over legacy DRC */ - UCHAR applyExtGain; /* Flag is 1 if extGain has to be applied, otherwise 0. */ FIXP_DBL additionalGainPrev; /* Gain of previous frame to be applied to the diff --git a/libAACdec/src/aacdecoder.cpp b/libAACdec/src/aacdecoder.cpp index d5f0cea..ab8dc79 100644 --- a/libAACdec/src/aacdecoder.cpp +++ b/libAACdec/src/aacdecoder.cpp @@ -3310,12 +3310,6 @@ LINKSPEC_CPP AAC_DECODER_ERROR CAacDecoder_DecodeFrame( FDKmemcpy(drcChMap, self->chMapping, (8) * sizeof(UCHAR)); } - /* deactivate legacy DRC in case uniDrc is active, i.e. uniDrc payload is - * present and one of DRC or Loudness Normalization is switched on */ - aacDecoder_drcSetParam( - self->hDrcInfo, UNIDRC_PRECEDENCE, - FDK_drcDec_GetParam(self->hUniDrcDecoder, DRC_DEC_IS_ACTIVE)); - /* Extract DRC control data and map it to channels (without bitstream delay) */ mapped = aacDecoder_drcProlog( diff --git a/libAACdec/src/aacdecoder_lib.cpp b/libAACdec/src/aacdecoder_lib.cpp index 0c83191..af29366 100644 --- a/libAACdec/src/aacdecoder_lib.cpp +++ b/libAACdec/src/aacdecoder_lib.cpp @@ -1689,8 +1689,6 @@ LINKSPEC_CPP AAC_DECODER_ERROR aacDecoder_DecodeFrame(HANDLE_AACDECODER self, FIXP_DBL channelGain[(8)]; int reverseInChannelMap[(8)]; int reverseOutChannelMap[(8)]; - int numDrcOutChannels = FDK_drcDec_GetParam( - self->hUniDrcDecoder, DRC_DEC_TARGET_CHANNEL_COUNT_SELECTED); FDKmemclear(channelGain, sizeof(channelGain)); for (ch = 0; ch < (8); ch++) { reverseInChannelMap[ch] = ch; @@ -1713,17 +1711,6 @@ LINKSPEC_CPP AAC_DECODER_ERROR aacDecoder_DecodeFrame(HANDLE_AACDECODER self, drcDelay += CConcealment_GetDelay(&self->concealCommonData) * self->streamInfo.frameSize; - for (ch = 0; ch < self->streamInfo.numChannels; ch++) { - UCHAR mapValue = FDK_chMapDescr_getMapValue( - &self->mapDescr, (UCHAR)ch, self->chMapIndex); - if (mapValue < (8)) reverseInChannelMap[mapValue] = ch; - } - for (ch = 0; ch < (int)numDrcOutChannels; ch++) { - UCHAR mapValue = FDK_chMapDescr_getMapValue( - &self->mapDescr, (UCHAR)ch, numDrcOutChannels); - if (mapValue < (8)) reverseOutChannelMap[mapValue] = ch; - } - /* The output of SBR and MPS is interleaved. Deinterleaving may be * necessary for FDK_drcDec_ProcessTime, which accepts deinterleaved * audio only. */ @@ -1758,11 +1745,9 @@ LINKSPEC_CPP AAC_DECODER_ERROR aacDecoder_DecodeFrame(HANDLE_AACDECODER self, FDK_drcDec_Preprocess(self->hUniDrcDecoder); /* apply DRC1 gain sequence */ - for (ch = 0; ch < self->streamInfo.numChannels; ch++) { - FDK_drcDec_ProcessTime(self->hUniDrcDecoder, drcDelay, DRC_DEC_DRC1, - ch, reverseInChannelMap[ch] - ch, 1, - drcWorkBuffer, self->streamInfo.frameSize); - } + FDK_drcDec_ProcessTime(self->hUniDrcDecoder, drcDelay, DRC_DEC_DRC1, + 0, 0, self->streamInfo.numChannels, + drcWorkBuffer, self->streamInfo.frameSize); /* apply downmix */ FDK_drcDec_ApplyDownmix( self->hUniDrcDecoder, reverseInChannelMap, reverseOutChannelMap, @@ -1770,12 +1755,10 @@ LINKSPEC_CPP AAC_DECODER_ERROR aacDecoder_DecodeFrame(HANDLE_AACDECODER self, &self->streamInfo.numChannels); /* self->streamInfo.numChannels may change here */ /* apply DRC2/3 gain sequence */ - for (ch = 0; ch < self->streamInfo.numChannels; ch++) { - FDK_drcDec_ProcessTime(self->hUniDrcDecoder, drcDelay, - DRC_DEC_DRC2_DRC3, ch, - reverseOutChannelMap[ch] - ch, 1, - drcWorkBuffer, self->streamInfo.frameSize); - } + FDK_drcDec_ProcessTime(self->hUniDrcDecoder, drcDelay, + DRC_DEC_DRC2_DRC3, 0, 0, + self->streamInfo.numChannels, drcWorkBuffer, + self->streamInfo.frameSize); if (needsDeinterleaving) { FDK_interleave( -- cgit v1.2.3 From b5b590367af9043aaf5e13b0d573aa7261945880 Mon Sep 17 00:00:00 2001 From: Jean-Michel Trivi Date: Tue, 25 Apr 2023 17:09:22 +0000 Subject: Disable MPEG-D DRC for legacy AOTs Disable MPEG-D DRC metadata for legacy AOTs 2 (AAC-LC), 5 (HE-AAC), and 29 (HE-AAC v2). Bug: 241391733 Test: see bug (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:2f4c595c4abd721967ecb494f5aec3f6b6dafb9e) Merged-In: Ie84badaa24bb4169adfdb1d3243525c32b44d3e9 Change-Id: Ie84badaa24bb4169adfdb1d3243525c32b44d3e9 --- libAACdec/src/aacdecoder.cpp | 39 +-------------------------------------- libAACdec/src/aacdecoder_lib.cpp | 4 ++-- 2 files changed, 3 insertions(+), 40 deletions(-) (limited to 'libAACdec/src') diff --git a/libAACdec/src/aacdecoder.cpp b/libAACdec/src/aacdecoder.cpp index d5f0cea..ee448c3 100644 --- a/libAACdec/src/aacdecoder.cpp +++ b/libAACdec/src/aacdecoder.cpp @@ -1,7 +1,7 @@ /* ----------------------------------------------------------------------------- Software License for The Fraunhofer FDK AAC Codec Library for Android -© Copyright 1995 - 2021 Fraunhofer-Gesellschaft zur Förderung der angewandten +© Copyright 1995 - 2023 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. All rights reserved. 1. INTRODUCTION @@ -912,43 +912,6 @@ static AAC_DECODER_ERROR CAacDecoder_ExtPayloadParse( } *count -= readBits; } break; - case EXT_UNI_DRC: { - DRC_DEC_ERROR drcErr = DRC_DEC_OK; - DRC_DEC_CODEC_MODE drcDecCodecMode = DRC_DEC_CODEC_MODE_UNDEFINED; - INT nBitsRemaining = FDKgetValidBits(hBs); - INT readBits; - - switch (self->streamInfo.aot) { - case AOT_AAC_LC: - case AOT_SBR: - case AOT_PS: - drcDecCodecMode = DRC_DEC_MPEG_4_AAC; - break; - default: - error = AAC_DEC_PARSE_ERROR; - goto bail; - } - - drcErr = FDK_drcDec_SetCodecMode(self->hUniDrcDecoder, drcDecCodecMode); - if (drcErr) { - error = AAC_DEC_PARSE_ERROR; - goto bail; - } - - drcErr = FDK_drcDec_ReadUniDrc(self->hUniDrcDecoder, hBs); - if (drcErr) { - error = AAC_DEC_PARSE_ERROR; - goto bail; - } - readBits = (INT)nBitsRemaining - (INT)FDKgetValidBits(hBs); - if (readBits > *count) { /* Read too much. Something went wrong! */ - error = AAC_DEC_PARSE_ERROR; - } - *count -= readBits; - /* Skip any trailing bits */ - FDKpushFor(hBs, *count); - *count = 0; - } break; case EXT_LDSAC_DATA: case EXT_SAC_DATA: /* Read MPEG Surround Extension payload */ diff --git a/libAACdec/src/aacdecoder_lib.cpp b/libAACdec/src/aacdecoder_lib.cpp index 0c83191..c74ec1a 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 - 2021 Fraunhofer-Gesellschaft zur Förderung der angewandten +© Copyright 1995 - 2023 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. All rights reserved. 1. INTRODUCTION @@ -1681,7 +1681,7 @@ LINKSPEC_CPP AAC_DECODER_ERROR aacDecoder_DecodeFrame(HANDLE_AACDECODER self, { if ((FDK_drcDec_GetParam(self->hUniDrcDecoder, DRC_DEC_IS_ACTIVE)) && - !(self->flags[0] & AC_RSV603DA)) { + (self->flags[0] & AC_USAC)) { /* Apply DRC gains*/ int ch, drcDelay = 0; int needsDeinterleaving = 0; -- cgit v1.2.3