Merge remote-tracking branch 'aosp/main'

This commit is contained in:
Martin Storsjo 2023-10-06 15:19:55 +03:00
commit 0f91e9ba60
13 changed files with 45 additions and 95 deletions

View File

@ -94,7 +94,7 @@ cc_library_static {
apex_available: [ apex_available: [
"//apex_available:platform", "//apex_available:platform",
"com.android.bluetooth", "com.android.btservices",
"com.android.media.swcodec", "com.android.media.swcodec",
], ],
min_sdk_version: "29", min_sdk_version: "29",

View File

@ -1,3 +1,7 @@
# *** THIS PACKAGE HAS SPECIAL LICENSING CONDITIONS. PLEASE
# CONSULT THE OWNERS AND opensource-licensing@google.com BEFORE
# DEPENDING ON IT IN YOUR PROJECT. ***
third_party { third_party {
license_note: "Software License for The Fraunhofer FDK AAC Codec Library for Android"
license_type: BY_EXCEPTION_ONLY license_type: BY_EXCEPTION_ONLY
} }

View File

@ -46,6 +46,14 @@ cc_defaults {
"android-media-fuzzing-reports@google.com", "android-media-fuzzing-reports@google.com",
], ],
componentid: 155276, componentid: 155276,
hotlists: [
"4593311",
],
description: "The fuzzer targets the APIs of libFraunhoferAAC",
vector: "remote",
service_privilege: "privileged",
users: "multi_user",
fuzzed_code_usage: "shipped",
}, },
} }

View File

@ -431,6 +431,10 @@ Where N equals to CStreamInfo::frameSize .
#include "machine_type.h" #include "machine_type.h"
#include "FDK_audio.h" #include "FDK_audio.h"
#define AACDECODER_LIB_VL0 3
#define AACDECODER_LIB_VL1 2
#define AACDECODER_LIB_VL2 0
#include "genericStds.h" #include "genericStds.h"
#define AACDECODER_LIB_VL0 3 #define AACDECODER_LIB_VL0 3

View File

@ -1,7 +1,7 @@
/* ----------------------------------------------------------------------------- /* -----------------------------------------------------------------------------
Software License for The Fraunhofer FDK AAC Codec Library for Android 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. Forschung e.V. All rights reserved.
1. INTRODUCTION 1. INTRODUCTION
@ -217,7 +217,6 @@ void aacDecoder_drcInit(HANDLE_AAC_DRC self) {
self->progRefLevel = pParams->targetRefLevel; self->progRefLevel = pParams->targetRefLevel;
self->progRefLevelPresent = 0; self->progRefLevelPresent = 0;
self->presMode = -1; self->presMode = -1;
self->uniDrcPrecedence = 0;
aacDecoder_drcReset(self); aacDecoder_drcReset(self);
} }
@ -353,12 +352,6 @@ AAC_DECODER_ERROR aacDecoder_drcSetParam(HANDLE_AAC_DRC self,
self->numOutChannels = (INT)value; self->numOutChannels = (INT)value;
self->update = 1; self->update = 1;
break; break;
case UNIDRC_PRECEDENCE:
if (self == NULL) {
return AAC_DEC_INVALID_HANDLE;
}
self->uniDrcPrecedence = (UCHAR)value;
break;
default: default:
return AAC_DEC_SET_PARAM_FAIL; return AAC_DEC_SET_PARAM_FAIL;
} /* switch(param) */ } /* switch(param) */
@ -1258,7 +1251,6 @@ static void aacDecoder_drcParameterHandling(HANDLE_AAC_DRC self,
/* switch on/off processing */ /* switch on/off processing */
self->enable = ((p->boost > (FIXP_DBL)0) || (p->cut > (FIXP_DBL)0) || self->enable = ((p->boost > (FIXP_DBL)0) || (p->cut > (FIXP_DBL)0) ||
(p->applyHeavyCompression == ON) || (p->targetRefLevel >= 0)); (p->applyHeavyCompression == ON) || (p->targetRefLevel >= 0));
self->enable = (self->enable && !self->uniDrcPrecedence);
self->prevAacNumChannels = aacNumChannels; self->prevAacNumChannels = aacNumChannels;
self->update = 0; self->update = 0;

View File

@ -1,7 +1,7 @@
/* ----------------------------------------------------------------------------- /* -----------------------------------------------------------------------------
Software License for The Fraunhofer FDK AAC Codec Library for Android 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. Forschung e.V. All rights reserved.
1. INTRODUCTION 1. INTRODUCTION
@ -133,8 +133,7 @@ typedef enum {
APPLY_HEAVY_COMPRESSION, APPLY_HEAVY_COMPRESSION,
DEFAULT_PRESENTATION_MODE, DEFAULT_PRESENTATION_MODE,
ENCODER_TARGET_LEVEL, ENCODER_TARGET_LEVEL,
MAX_OUTPUT_CHANNELS, MAX_OUTPUT_CHANNELS
UNIDRC_PRECEDENCE
} AACDEC_DRC_PARAM; } AACDEC_DRC_PARAM;
/** /**

View File

@ -1,7 +1,7 @@
/* ----------------------------------------------------------------------------- /* -----------------------------------------------------------------------------
Software License for The Fraunhofer FDK AAC Codec Library for Android 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. Forschung e.V. All rights reserved.
1. INTRODUCTION 1. INTRODUCTION
@ -207,11 +207,6 @@ typedef struct {
position in the bitstream (only one per frame) */ position in the bitstream (only one per frame) */
UINT drcPayloadPosition[MAX_DRC_THREADS]; /* Used to store the DRC payload UINT drcPayloadPosition[MAX_DRC_THREADS]; /* Used to store the DRC payload
positions in the bitstream */ 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. */ 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 FIXP_DBL additionalGainPrev; /* Gain of previous frame to be applied to the

View File

@ -1,7 +1,7 @@
/* ----------------------------------------------------------------------------- /* -----------------------------------------------------------------------------
Software License for The Fraunhofer FDK AAC Codec Library for Android 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. Forschung e.V. All rights reserved.
1. INTRODUCTION 1. INTRODUCTION
@ -912,43 +912,6 @@ static AAC_DECODER_ERROR CAacDecoder_ExtPayloadParse(
} }
*count -= readBits; *count -= readBits;
} break; } 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_LDSAC_DATA:
case EXT_SAC_DATA: case EXT_SAC_DATA:
/* Read MPEG Surround Extension payload */ /* Read MPEG Surround Extension payload */
@ -3310,12 +3273,6 @@ LINKSPEC_CPP AAC_DECODER_ERROR CAacDecoder_DecodeFrame(
FDKmemcpy(drcChMap, self->chMapping, (8) * sizeof(UCHAR)); 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) /* Extract DRC control data and map it to channels (without bitstream delay)
*/ */
mapped = aacDecoder_drcProlog( mapped = aacDecoder_drcProlog(

View File

@ -1,7 +1,7 @@
/* ----------------------------------------------------------------------------- /* -----------------------------------------------------------------------------
Software License for The Fraunhofer FDK AAC Codec Library for Android 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. Forschung e.V. All rights reserved.
1. INTRODUCTION 1. INTRODUCTION
@ -1683,7 +1683,7 @@ LINKSPEC_CPP AAC_DECODER_ERROR aacDecoder_DecodeFrame(HANDLE_AACDECODER self,
{ {
if ((FDK_drcDec_GetParam(self->hUniDrcDecoder, DRC_DEC_IS_ACTIVE)) && if ((FDK_drcDec_GetParam(self->hUniDrcDecoder, DRC_DEC_IS_ACTIVE)) &&
!(self->flags[0] & AC_RSV603DA)) { (self->flags[0] & AC_USAC)) {
/* Apply DRC gains*/ /* Apply DRC gains*/
int ch, drcDelay = 0; int ch, drcDelay = 0;
int needsDeinterleaving = 0; int needsDeinterleaving = 0;
@ -1691,8 +1691,6 @@ LINKSPEC_CPP AAC_DECODER_ERROR aacDecoder_DecodeFrame(HANDLE_AACDECODER self,
FIXP_DBL channelGain[(8)]; FIXP_DBL channelGain[(8)];
int reverseInChannelMap[(8)]; int reverseInChannelMap[(8)];
int reverseOutChannelMap[(8)]; int reverseOutChannelMap[(8)];
int numDrcOutChannels = FDK_drcDec_GetParam(
self->hUniDrcDecoder, DRC_DEC_TARGET_CHANNEL_COUNT_SELECTED);
FDKmemclear(channelGain, sizeof(channelGain)); FDKmemclear(channelGain, sizeof(channelGain));
for (ch = 0; ch < (8); ch++) { for (ch = 0; ch < (8); ch++) {
reverseInChannelMap[ch] = ch; reverseInChannelMap[ch] = ch;
@ -1715,17 +1713,6 @@ LINKSPEC_CPP AAC_DECODER_ERROR aacDecoder_DecodeFrame(HANDLE_AACDECODER self,
drcDelay += CConcealment_GetDelay(&self->concealCommonData) * drcDelay += CConcealment_GetDelay(&self->concealCommonData) *
self->streamInfo.frameSize; 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 /* The output of SBR and MPS is interleaved. Deinterleaving may be
* necessary for FDK_drcDec_ProcessTime, which accepts deinterleaved * necessary for FDK_drcDec_ProcessTime, which accepts deinterleaved
* audio only. */ * audio only. */
@ -1760,11 +1747,9 @@ LINKSPEC_CPP AAC_DECODER_ERROR aacDecoder_DecodeFrame(HANDLE_AACDECODER self,
FDK_drcDec_Preprocess(self->hUniDrcDecoder); FDK_drcDec_Preprocess(self->hUniDrcDecoder);
/* apply DRC1 gain sequence */ /* apply DRC1 gain sequence */
for (ch = 0; ch < self->streamInfo.numChannels; ch++) { FDK_drcDec_ProcessTime(self->hUniDrcDecoder, drcDelay, DRC_DEC_DRC1,
FDK_drcDec_ProcessTime(self->hUniDrcDecoder, drcDelay, DRC_DEC_DRC1, 0, 0, self->streamInfo.numChannels,
ch, reverseInChannelMap[ch] - ch, 1, drcWorkBuffer, self->streamInfo.frameSize);
drcWorkBuffer, self->streamInfo.frameSize);
}
/* apply downmix */ /* apply downmix */
FDK_drcDec_ApplyDownmix( FDK_drcDec_ApplyDownmix(
self->hUniDrcDecoder, reverseInChannelMap, reverseOutChannelMap, self->hUniDrcDecoder, reverseInChannelMap, reverseOutChannelMap,
@ -1772,12 +1757,10 @@ LINKSPEC_CPP AAC_DECODER_ERROR aacDecoder_DecodeFrame(HANDLE_AACDECODER self,
&self->streamInfo.numChannels); /* self->streamInfo.numChannels &self->streamInfo.numChannels); /* self->streamInfo.numChannels
may change here */ may change here */
/* apply DRC2/3 gain sequence */ /* apply DRC2/3 gain sequence */
for (ch = 0; ch < self->streamInfo.numChannels; ch++) { FDK_drcDec_ProcessTime(self->hUniDrcDecoder, drcDelay,
FDK_drcDec_ProcessTime(self->hUniDrcDecoder, drcDelay, DRC_DEC_DRC2_DRC3, 0, 0,
DRC_DEC_DRC2_DRC3, ch, self->streamInfo.numChannels, drcWorkBuffer,
reverseOutChannelMap[ch] - ch, 1, self->streamInfo.frameSize);
drcWorkBuffer, self->streamInfo.frameSize);
}
if (needsDeinterleaving) { if (needsDeinterleaving) {
FDK_interleave( FDK_interleave(

View File

@ -1090,7 +1090,7 @@ typedef struct {
write edit lists for gapless playback. The decoder may not write edit lists for gapless playback. The decoder may not
know how much delay is introdcued by SBR, since it may not know how much delay is introdcued by SBR, since it may not
know if SBR is active at all (implicit signaling), know if SBR is active at all (implicit signaling),
therefore the deocder must take into account any delay therefore the decoder must take into account any delay
caused by the SBR module. */ caused by the SBR module. */
UCHAR confBuf[64]; /*!< Configuration buffer in binary format as an UCHAR confBuf[64]; /*!< Configuration buffer in binary format as an

View File

@ -222,14 +222,16 @@ amm-info@iis.fraunhofer.de
#define POW2COEFF_16BIT #define POW2COEFF_16BIT
#define LDCOEFF_16BIT #define LDCOEFF_16BIT
#elif defined(__powerpc__) #elif defined(__riscv)
#define ARCH_PREFER_MULT_32x32
#define ARCH_PREFER_MULT_32x16 #define ARCH_PREFER_MULT_32x16
#define SINETABLE_16BIT #define SINETABLE_16BIT
#define POW2COEFF_16BIT #define POW2COEFF_16BIT
#define LDCOEFF_16BIT #define LDCOEFF_16BIT
#define WINDOWTABLE_16BIT #define WINDOWTABLE_16BIT
#elif defined(__powerpc__)
#define ARCH_PREFER_MULT_32x32
#else #else
#warning >>>> Please set architecture characterization defines for your platform (FDK_HIGH_PERFORMANCE)! <<<< #warning >>>> Please set architecture characterization defines for your platform (FDK_HIGH_PERFORMANCE)! <<<<

View File

@ -1,7 +1,7 @@
/* ----------------------------------------------------------------------------- /* -----------------------------------------------------------------------------
Software License for The Fraunhofer FDK AAC Codec Library for Android Software License for The Fraunhofer FDK AAC Codec Library for Android
© Copyright 1995 - 2019 Fraunhofer-Gesellschaft zur Förderung der angewandten © Copyright 1995 - 2022 Fraunhofer-Gesellschaft zur Förderung der angewandten
Forschung e.V. All rights reserved. Forschung e.V. All rights reserved.
1. INTRODUCTION 1. INTRODUCTION
@ -351,6 +351,12 @@ TRANSPORTDEC_ERROR transportDec_OutOfBandConfig(HANDLE_TRANSPORTDEC hTp,
} }
} }
} }
/* if an error is detected terminate config parsing to avoid that an invalid
* config is accepted in the second pass */
if (err != TRANSPORTDEC_OK) {
break;
}
} }
if (err == TRANSPORTDEC_OK && fConfigFound) { if (err == TRANSPORTDEC_OK && fConfigFound) {

View File

@ -1,7 +1,7 @@
/* ----------------------------------------------------------------------------- /* -----------------------------------------------------------------------------
Software License for The Fraunhofer FDK AAC Codec Library for Android Software License for The Fraunhofer FDK AAC Codec Library for Android
© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten © Copyright 1995 - 2023 Fraunhofer-Gesellschaft zur Förderung der angewandten
Forschung e.V. All rights reserved. Forschung e.V. All rights reserved.
1. INTRODUCTION 1. INTRODUCTION
@ -207,7 +207,7 @@ typedef struct {
inverse filtering levels */ inverse filtering levels */
PATCH_PARAM PATCH_PARAM
patchParam[MAX_NUM_PATCHES]; /*!< new parameter set for patching */ patchParam[MAX_NUM_PATCHES + 1]; /*!< new parameter set for patching */
WHITENING_FACTORS WHITENING_FACTORS
whFactors; /*!< the pole moving factors for certain whFactors; /*!< the pole moving factors for certain
whitening levels as indicated in the bitstream whitening levels as indicated in the bitstream