Merge changes from topic "aac_drc"

* changes:
  AAC decoder: support album mode
  AAC decoder: implement support for output loudness query
  AAC decoder: fix boost/attenuation defaults, loudness norm off
  AAC decoder: enable set/get of DRC parameters during decoding
gugelfrei
Jean-Michel Trivi 4 years ago committed by Android (Google) Code Review
commit d0be0a5588

@ -40,6 +40,8 @@
#define DRC_DEFAULT_MOBILE_DRC_BOOST 1.0 /* maximum compression of dynamic range for mobile conf */
#define DRC_DEFAULT_MOBILE_DRC_HEAVY C2Config::DRC_COMPRESSION_HEAVY /* switch for heavy compression for mobile conf */
#define DRC_DEFAULT_MOBILE_DRC_EFFECT 3 /* MPEG-D DRC effect type; 3 => Limited playback range */
#define DRC_DEFAULT_MOBILE_DRC_ALBUM 0 /* MPEG-D DRC album mode; 0 => album mode is disabled, 1 => album mode is enabled */
#define DRC_DEFAULT_MOBILE_OUTPUT_LOUDNESS (0.25) /* decoder output loudness; -1 => the value is unknown, otherwise dB step value (e.g. 64 for -16 dB) */
#define DRC_DEFAULT_MOBILE_ENC_LEVEL (0.25) /* encoder target level; -1 => the value is unknown, otherwise dB step value (e.g. 64 for -16 dB) */
#define MAX_CHANNEL_COUNT 8 /* maximum number of audio channels that can be decoded */
// names of properties that can be used to override the default DRC settings
@ -190,6 +192,24 @@ public:
})
.withSetter(Setter<decltype(*mDrcEffectType)>::StrictValueWithNoDeps)
.build());
addParameter(
DefineParam(mDrcAlbumMode, C2_PARAMKEY_DRC_ALBUM_MODE)
.withDefault(new C2StreamDrcAlbumModeTuning::input(0u, C2Config::DRC_ALBUM_MODE_OFF))
.withFields({
C2F(mDrcAlbumMode, value).oneOf({
C2Config::DRC_ALBUM_MODE_OFF,
C2Config::DRC_ALBUM_MODE_ON})
})
.withSetter(Setter<decltype(*mDrcAlbumMode)>::StrictValueWithNoDeps)
.build());
addParameter(
DefineParam(mDrcOutputLoudness, C2_PARAMKEY_DRC_OUTPUT_LOUDNESS)
.withDefault(new C2StreamDrcOutputLoudnessTuning::output(0u, DRC_DEFAULT_MOBILE_OUTPUT_LOUDNESS))
.withFields({C2F(mDrcOutputLoudness, value).inRange(-57.75, 0.25)})
.withSetter(Setter<decltype(*mDrcOutputLoudness)>::StrictValueWithNoDeps)
.build());
}
bool isAdts() const { return mAacFormat->value == C2Config::AAC_PACKAGING_ADTS; }
@ -204,6 +224,8 @@ public:
int32_t getDrcBoostFactor() const { return mDrcBoostFactor->value * 127. + 0.5; }
int32_t getDrcAttenuationFactor() const { return mDrcAttenuationFactor->value * 127. + 0.5; }
int32_t getDrcEffectType() const { return mDrcEffectType->value; }
int32_t getDrcAlbumMode() const { return mDrcAlbumMode->value; }
int32_t getDrcOutputLoudness() const { return (mDrcOutputLoudness->value <= 0 ? -mDrcOutputLoudness->value * 4. + 0.5 : -1); }
private:
std::shared_ptr<C2StreamSampleRateInfo::output> mSampleRate;
@ -218,6 +240,8 @@ private:
std::shared_ptr<C2StreamDrcBoostFactorTuning::input> mDrcBoostFactor;
std::shared_ptr<C2StreamDrcAttenuationFactorTuning::input> mDrcAttenuationFactor;
std::shared_ptr<C2StreamDrcEffectTypeTuning::input> mDrcEffectType;
std::shared_ptr<C2StreamDrcAlbumModeTuning::input> mDrcAlbumMode;
std::shared_ptr<C2StreamDrcOutputLoudnessTuning::output> mDrcOutputLoudness;
// TODO Add : C2StreamAacSbrModeTuning
};
@ -324,7 +348,7 @@ status_t C2SoftAacDec::initDecoder() {
// DRC_PRES_MODE_WRAP_DESIRED_HEAVY
int32_t compressMode = mIntf->getDrcCompressMode();
ALOGV("AAC decoder using desried DRC heavy compression switch of %d", compressMode);
ALOGV("AAC decoder using desired DRC heavy compression switch of %d", compressMode);
mDrcWrap.setParam(DRC_PRES_MODE_WRAP_DESIRED_HEAVY, (unsigned)compressMode);
// DRC_PRES_MODE_WRAP_ENCODER_TARGET
@ -337,6 +361,11 @@ status_t C2SoftAacDec::initDecoder() {
ALOGV("AAC decoder using MPEG-D DRC effect type %d", effectType);
aacDecoder_SetParam(mAACDecoder, AAC_UNIDRC_SET_EFFECT, effectType);
// AAC_UNIDRC_ALBUM_MODE
int32_t albumMode = mIntf->getDrcAlbumMode();
ALOGV("AAC decoder using MPEG-D DRC album mode %d", albumMode);
aacDecoder_SetParam(mAACDecoder, AAC_UNIDRC_ALBUM_MODE, albumMode);
// By default, the decoder creates a 5.1 channel downmix signal.
// For seven and eight channel input streams, enable 6.1 and 7.1 channel output
aacDecoder_SetParam(mAACDecoder, AAC_PCM_MAX_OUTPUT_CHANNELS, -1);
@ -632,6 +661,7 @@ void C2SoftAacDec::process(
INT prevSampleRate = mStreamInfo->sampleRate;
INT prevNumChannels = mStreamInfo->numChannels;
INT prevOutLoudness = mStreamInfo->outputLoudness;
aacDecoder_Fill(mAACDecoder,
inBuffer,
@ -640,6 +670,43 @@ void C2SoftAacDec::process(
// run DRC check
mDrcWrap.submitStreamData(mStreamInfo);
// apply runtime updates
// DRC_PRES_MODE_WRAP_DESIRED_TARGET
int32_t targetRefLevel = mIntf->getDrcTargetRefLevel();
ALOGV("AAC decoder using desired DRC target reference level of %d", targetRefLevel);
mDrcWrap.setParam(DRC_PRES_MODE_WRAP_DESIRED_TARGET, (unsigned)targetRefLevel);
// DRC_PRES_MODE_WRAP_DESIRED_ATT_FACTOR
int32_t attenuationFactor = mIntf->getDrcAttenuationFactor();
ALOGV("AAC decoder using desired DRC attenuation factor of %d", attenuationFactor);
mDrcWrap.setParam(DRC_PRES_MODE_WRAP_DESIRED_ATT_FACTOR, (unsigned)attenuationFactor);
// DRC_PRES_MODE_WRAP_DESIRED_BOOST_FACTOR
int32_t boostFactor = mIntf->getDrcBoostFactor();
ALOGV("AAC decoder using desired DRC boost factor of %d", boostFactor);
mDrcWrap.setParam(DRC_PRES_MODE_WRAP_DESIRED_BOOST_FACTOR, (unsigned)boostFactor);
// DRC_PRES_MODE_WRAP_DESIRED_HEAVY
int32_t compressMode = mIntf->getDrcCompressMode();
ALOGV("AAC decoder using desried DRC heavy compression switch of %d", compressMode);
mDrcWrap.setParam(DRC_PRES_MODE_WRAP_DESIRED_HEAVY, (unsigned)compressMode);
// DRC_PRES_MODE_WRAP_ENCODER_TARGET
int32_t encTargetLevel = mIntf->getDrcEncTargetLevel();
ALOGV("AAC decoder using encoder-side DRC reference level of %d", encTargetLevel);
mDrcWrap.setParam(DRC_PRES_MODE_WRAP_ENCODER_TARGET, (unsigned)encTargetLevel);
// AAC_UNIDRC_SET_EFFECT
int32_t effectType = mIntf->getDrcEffectType();
ALOGV("AAC decoder using MPEG-D DRC effect type %d", effectType);
aacDecoder_SetParam(mAACDecoder, AAC_UNIDRC_SET_EFFECT, effectType);
// AAC_UNIDRC_ALBUM_MODE
int32_t albumMode = mIntf->getDrcAlbumMode();
ALOGV("AAC decoder using MPEG-D DRC album mode %d", albumMode);
aacDecoder_SetParam(mAACDecoder, AAC_UNIDRC_ALBUM_MODE, albumMode);
mDrcWrap.update();
UINT inBufferUsedLength = inBufferLength[0] - bytesValid[0];
@ -763,6 +830,23 @@ void C2SoftAacDec::process(
}
}
ALOGV("size = %zu", size);
if (mStreamInfo->outputLoudness != prevOutLoudness) {
C2StreamDrcOutputLoudnessTuning::output
drcOutLoudness(0u, (float) (mStreamInfo->outputLoudness*-0.25));
std::vector<std::unique_ptr<C2SettingResult>> failures;
c2_status_t err = mIntf->config(
{ &drcOutLoudness },
C2_MAY_BLOCK,
&failures);
if (err == OK) {
work->worklets.front()->output.configUpdate.push_back(
C2Param::Copy(drcOutLoudness));
} else {
ALOGE("Getting output loudness failed");
}
}
} while (decoderErr == AAC_DEC_OK);
}

@ -47,10 +47,9 @@ CDrcPresModeWrapper::CDrcPresModeWrapper()
mEncoderTarget = -1;
/* Values from last time. */
/* Initialized to the same values as the desired values */
mLastTarget = -1;
mLastAttFactor = 0;
mLastBoostFactor = 0;
mLastTarget = -2;
mLastAttFactor = -1;
mLastBoostFactor = -1;
mLastHeavy = 0;
}
@ -163,7 +162,7 @@ CDrcPresModeWrapper::update()
if (mDataUpdate) {
// sanity check
if (mDesTarget < MAX_TARGET_LEVEL){
if ((mDesTarget < MAX_TARGET_LEVEL) && (mDesTarget != -1)){
mDesTarget = MAX_TARGET_LEVEL; // limit target level to -10 dB or below
newTarget = MAX_TARGET_LEVEL;
}

@ -58,6 +58,8 @@ struct C2Config {
enum bitrate_mode_t : uint32_t; ///< bitrate control mode
enum drc_compression_mode_t : int32_t; ///< DRC compression mode
enum drc_effect_type_t : int32_t; ///< DRC effect type
enum drc_album_mode_t : int32_t; ///< DRC album mode
enum drc_output_loudness : int32_t; ///< DRC output loudness
enum intra_refresh_mode_t : uint32_t; ///< intra refresh modes
enum level_t : uint32_t; ///< coding level
enum ordinal_key_t : uint32_t; ///< work ordering keys
@ -218,6 +220,8 @@ enum C2ParamIndexKind : C2Param::type_index_t {
kParamIndexDrcBoostFactor, // drc, float (0-1)
kParamIndexDrcAttenuationFactor, // drc, float (0-1)
kParamIndexDrcEffectType, // drc, enum
kParamIndexDrcOutputLoudness, // drc, float (dBFS)
kParamIndexDrcAlbumMode, // drc, enum
/* ============================== platform-defined parameters ============================== */
@ -1941,6 +1945,24 @@ typedef C2StreamParam<C2Info, C2SimpleValueStruct<C2Config::drc_effect_type_t>,
C2StreamDrcEffectTypeTuning;
constexpr char C2_PARAMKEY_DRC_EFFECT_TYPE[] = "coding.drc.effect-type";
/**
* DRC album mode. Used during decoding.
*/
C2ENUM(C2Config::drc_album_mode_t, int32_t,
DRC_ALBUM_MODE_OFF = 0,
DRC_ALBUM_MODE_ON = 1
)
typedef C2StreamParam<C2Info, C2SimpleValueStruct<C2Config::drc_album_mode_t>, kParamIndexDrcAlbumMode>
C2StreamDrcAlbumModeTuning;
constexpr char C2_PARAMKEY_DRC_ALBUM_MODE[] = "coding.drc.album-mode";
/**
* DRC output loudness in dBFS. Retrieved during decoding
*/
typedef C2StreamParam<C2Info, C2FloatValue, kParamIndexDrcOutputLoudness>
C2StreamDrcOutputLoudnessTuning;
constexpr char C2_PARAMKEY_DRC_OUTPUT_LOUDNESS[] = "output.drc.output-loudness";
/* --------------------------------------- AAC components --------------------------------------- */
/**

@ -34,6 +34,8 @@
#define DRC_DEFAULT_MOBILE_DRC_BOOST 127 /* maximum compression of dynamic range for mobile conf */
#define DRC_DEFAULT_MOBILE_DRC_HEAVY 1 /* switch for heavy compression for mobile conf */
#define DRC_DEFAULT_MOBILE_DRC_EFFECT 3 /* MPEG-D DRC effect type; 3 => Limited playback range */
#define DRC_DEFAULT_MOBILE_DRC_ALBUM 0 /* MPEG-D DRC album mode; 0 => album mode is disabled, 1 => album mode is enabled */
#define DRC_DEFAULT_MOBILE_OUTPUT_LOUDNESS -1 /* decoder output loudness; -1 => the value is unknown, otherwise dB step value (e.g. 64 for -16 dB) */
#define DRC_DEFAULT_MOBILE_ENC_LEVEL (-1) /* encoder target level; -1 => the value is unknown, otherwise dB step value (e.g. 64 for -16 dB) */
// names of properties that can be used to override the default DRC settings
#define PROP_DRC_OVERRIDE_REF_LEVEL "aac_drc_reference_level"
@ -700,63 +702,101 @@ void CCodecConfig::initializeStandardParams() {
// convert to dBFS and add default
add(ConfigMapper(KEY_AAC_DRC_TARGET_REFERENCE_LEVEL, C2_PARAMKEY_DRC_TARGET_REFERENCE_LEVEL, "value")
.limitTo(D::AUDIO & D::DECODER & D::CONFIG)
.withMapper([](C2Value v) -> C2Value {
.limitTo(D::AUDIO & D::DECODER & (D::CONFIG | D::PARAM | D::READ))
.withMappers([](C2Value v) -> C2Value {
int32_t value;
if (!v.get(&value) || value < 0) {
if (!v.get(&value) || value < -1) {
value = property_get_int32(PROP_DRC_OVERRIDE_REF_LEVEL, DRC_DEFAULT_MOBILE_REF_LEVEL);
}
return float(-0.25 * c2_min(value, 127));
},[](C2Value v) -> C2Value {
float value;
if (v.get(&value)) {
return (int32_t) (-4. * value);
}
return C2Value();
}));
// convert to 0-1 (%) and add default
add(ConfigMapper(KEY_AAC_DRC_ATTENUATION_FACTOR, C2_PARAMKEY_DRC_ATTENUATION_FACTOR, "value")
.limitTo(D::AUDIO & D::DECODER & D::CONFIG)
.withMapper([](C2Value v) -> C2Value {
.limitTo(D::AUDIO & D::DECODER & (D::CONFIG | D::PARAM | D::READ))
.withMappers([](C2Value v) -> C2Value {
int32_t value;
if (!v.get(&value) || value < 0) {
value = property_get_int32(PROP_DRC_OVERRIDE_CUT, DRC_DEFAULT_MOBILE_DRC_CUT);
}
return float(c2_min(value, 127) / 127.);
},[](C2Value v) -> C2Value {
float value;
if (v.get(&value)) {
return (int32_t) (value * 127. + 0.5);
}
else {
return C2Value();
}
}));
// convert to 0-1 (%) and add default
add(ConfigMapper(KEY_AAC_DRC_BOOST_FACTOR, C2_PARAMKEY_DRC_BOOST_FACTOR, "value")
.limitTo(D::AUDIO & D::DECODER & D::CONFIG)
.withMapper([](C2Value v) -> C2Value {
.limitTo(D::AUDIO & D::DECODER & (D::CONFIG | D::PARAM | D::READ))
.withMappers([](C2Value v) -> C2Value {
int32_t value;
if (!v.get(&value) || value < 0) {
value = property_get_int32(PROP_DRC_OVERRIDE_BOOST, DRC_DEFAULT_MOBILE_DRC_BOOST);
}
return float(c2_min(value, 127) / 127.);
},[](C2Value v) -> C2Value {
float value;
if (v.get(&value)) {
return (int32_t) (value * 127. + 0.5);
}
else {
return C2Value();
}
}));
// convert to compression type and add default
add(ConfigMapper(KEY_AAC_DRC_HEAVY_COMPRESSION, C2_PARAMKEY_DRC_COMPRESSION_MODE, "value")
.limitTo(D::AUDIO & D::DECODER & D::CONFIG)
.withMapper([](C2Value v) -> C2Value {
.limitTo(D::AUDIO & D::DECODER & (D::CONFIG | D::PARAM | D::READ))
.withMappers([](C2Value v) -> C2Value {
int32_t value;
if (!v.get(&value) || value < 0) {
value = property_get_int32(PROP_DRC_OVERRIDE_HEAVY, DRC_DEFAULT_MOBILE_DRC_HEAVY);
}
return value == 1 ? C2Config::DRC_COMPRESSION_HEAVY : C2Config::DRC_COMPRESSION_LIGHT;
},[](C2Value v) -> C2Value {
int32_t value;
if (v.get(&value)) {
return value;
}
else {
return C2Value();
}
}));
// convert to dBFS and add default
add(ConfigMapper(KEY_AAC_ENCODED_TARGET_LEVEL, C2_PARAMKEY_DRC_ENCODED_TARGET_LEVEL, "value")
.limitTo(D::AUDIO & D::DECODER & D::CONFIG)
.withMapper([](C2Value v) -> C2Value {
.limitTo(D::AUDIO & D::DECODER & (D::CONFIG | D::PARAM | D::READ))
.withMappers([](C2Value v) -> C2Value {
int32_t value;
if (!v.get(&value) || value < 0) {
value = property_get_int32(PROP_DRC_OVERRIDE_ENC_LEVEL, DRC_DEFAULT_MOBILE_ENC_LEVEL);
}
return float(-0.25 * c2_min(value, 127));
},[](C2Value v) -> C2Value {
float value;
if (v.get(&value)) {
return (int32_t) (-4. * value);
}
else {
return C2Value();
}
}));
// convert to effect type (these map to SDK values) and add default
add(ConfigMapper(KEY_AAC_DRC_EFFECT_TYPE, C2_PARAMKEY_DRC_EFFECT_TYPE, "value")
.limitTo(D::AUDIO & D::DECODER & D::CONFIG)
.withMapper([](C2Value v) -> C2Value {
.limitTo(D::AUDIO & D::DECODER & (D::CONFIG | D::PARAM | D::READ))
.withMappers([](C2Value v) -> C2Value {
int32_t value;
if (!v.get(&value) || value < -1 || value > 8) {
value = property_get_int32(PROP_DRC_OVERRIDE_EFFECT, DRC_DEFAULT_MOBILE_DRC_EFFECT);
@ -766,13 +806,60 @@ void CCodecConfig::initializeStandardParams() {
}
}
return value;
},[](C2Value v) -> C2Value {
int32_t value;
if (v.get(&value)) {
return value;
}
else {
return C2Value();
}
}));
// convert to album mode and add default
add(ConfigMapper(KEY_AAC_DRC_ALBUM_MODE, C2_PARAMKEY_DRC_ALBUM_MODE, "value")
.limitTo(D::AUDIO & D::DECODER & (D::CONFIG | D::PARAM | D::READ))
.withMappers([](C2Value v) -> C2Value {
int32_t value;
if (!v.get(&value) || value < 0 || value > 1) {
value = DRC_DEFAULT_MOBILE_DRC_ALBUM;
// ensure value is within range
if (value < 0 || value > 1) {
value = DRC_DEFAULT_MOBILE_DRC_ALBUM;
}
}
return value;
},[](C2Value v) -> C2Value {
int32_t value;
if (v.get(&value)) {
return value;
}
else {
return C2Value();
}
}));
add(ConfigMapper(KEY_AAC_DRC_OUTPUT_LOUDNESS, C2_PARAMKEY_DRC_OUTPUT_LOUDNESS, "value")
.limitTo(D::OUTPUT & D::DECODER & D::READ)
.withMappers([](C2Value v) -> C2Value {
int32_t value;
if (!v.get(&value) || value < -1) {
value = DRC_DEFAULT_MOBILE_OUTPUT_LOUDNESS;
}
return float(-0.25 * c2_min(value, 127));
},[](C2Value v) -> C2Value {
float value;
if (v.get(&value)) {
return (int32_t) (-4. * value);
}
return C2Value();
}));
add(ConfigMapper(KEY_AAC_MAX_OUTPUT_CHANNEL_COUNT, C2_PARAMKEY_MAX_CHANNEL_COUNT, "value")
.limitTo(D::AUDIO));
.limitTo(D::AUDIO & (D::CONFIG | D::PARAM | D::READ)));
add(ConfigMapper(KEY_AAC_SBR_MODE, C2_PARAMKEY_AAC_SBR_MODE, "value")
.limitTo(D::AUDIO & D::ENCODER & D::CONFIG)
.limitTo(D::AUDIO & D::ENCODER & (D::CONFIG | D::PARAM | D::READ))
.withMapper([](C2Value v) -> C2Value {
int32_t value;
if (!v.get(&value) || value < 0) {

@ -2181,12 +2181,20 @@ status_t ACodec::configureCodec(
}
if (!msg->findInt32("aac-target-ref-level", &drc.targetRefLevel)) {
// value is unknown
drc.targetRefLevel = -1;
drc.targetRefLevel = -2;
}
if (!msg->findInt32("aac-drc-effect-type", &drc.effectType)) {
// value is unknown
drc.effectType = -2; // valid values are -1 and over
}
if (!msg->findInt32("aac-drc-album-mode", &drc.albumMode)) {
// value is unknown
drc.albumMode = -1; // valid values are 0 and 1
}
if (!msg->findInt32("aac-drc-output-loudness", &drc.outputLoudness)) {
// value is unknown
drc.outputLoudness = -1;
}
err = setupAACCodec(
encoder, numChannels, sampleRate, bitrate, aacProfile,
@ -2876,6 +2884,8 @@ status_t ACodec::setupAACCodec(
presentation.nEncodedTargetLevel = drc.encodedTargetLevel;
presentation.nPCMLimiterEnable = pcmLimiterEnable;
presentation.nDrcEffectType = drc.effectType;
presentation.nDrcAlbumMode = drc.albumMode;
presentation.nDrcOutputLoudness = drc.outputLoudness;
status_t res = mOMXNode->setParameter(
OMX_IndexParamAudioAac, &profile, sizeof(profile));

@ -47,10 +47,9 @@ CDrcPresModeWrapper::CDrcPresModeWrapper()
mEncoderTarget = -1;
/* Values from last time. */
/* Initialized to the same values as the desired values */
mLastTarget = -1;
mLastAttFactor = 0;
mLastBoostFactor = 0;
mLastTarget = -2;
mLastAttFactor = -1;
mLastBoostFactor = -1;
mLastHeavy = 0;
}
@ -163,7 +162,7 @@ CDrcPresModeWrapper::update()
if (mDataUpdate) {
// sanity check
if (mDesTarget < MAX_TARGET_LEVEL){
if ((mDesTarget < MAX_TARGET_LEVEL) && (mDesTarget != -1)){
mDesTarget = MAX_TARGET_LEVEL; // limit target level to -10 dB or below
newTarget = MAX_TARGET_LEVEL;
}

@ -37,6 +37,7 @@
#define DRC_DEFAULT_MOBILE_DRC_BOOST 127 /* maximum compression of dynamic range for mobile conf */
#define DRC_DEFAULT_MOBILE_DRC_HEAVY 1 /* switch for heavy compression for mobile conf */
#define DRC_DEFAULT_MOBILE_DRC_EFFECT 3 /* MPEG-D DRC effect type; 3 => Limited playback range */
#define DRC_DEFAULT_MOBILE_DRC_ALBUM 0 /* MPEG-D DRC album mode; 0 => album mode is disabled, 1 => album mode is enabled */
#define DRC_DEFAULT_MOBILE_ENC_LEVEL (-1) /* encoder target level; -1 => the value is unknown, otherwise dB step value (e.g. 64 for -16 dB) */
#define MAX_CHANNEL_COUNT 8 /* maximum number of audio channels that can be decoded */
// names of properties that can be used to override the default DRC settings
@ -219,6 +220,11 @@ status_t SoftAAC2::initDecoder() {
ALOGV("AAC decoder using MPEG-D DRC effect type %d (default=%d)",
effectType, DRC_DEFAULT_MOBILE_DRC_EFFECT);
aacDecoder_SetParam(mAACDecoder, AAC_UNIDRC_SET_EFFECT, effectType);
// AAC_UNIDRC_ALBUM_MODE
int32_t albumMode = DRC_DEFAULT_MOBILE_DRC_ALBUM;
ALOGV("AAC decoder using MPEG-D Album mode value %d (default=%d)", albumMode,
DRC_DEFAULT_MOBILE_DRC_ALBUM);
aacDecoder_SetParam(mAACDecoder, AAC_UNIDRC_ALBUM_MODE, albumMode);
// By default, the decoder creates a 5.1 channel downmix signal.
// For seven and eight channel input streams, enable 6.1 and 7.1 channel output
@ -459,6 +465,11 @@ OMX_ERRORTYPE SoftAAC2::internalSetParameter(
ALOGV("set nDrcEffectType=%d", aacPresParams->nDrcEffectType);
aacDecoder_SetParam(mAACDecoder, AAC_UNIDRC_SET_EFFECT, aacPresParams->nDrcEffectType);
}
if (aacPresParams->nDrcAlbumMode >= -1) {
ALOGV("set nDrcAlbumMode=%d", aacPresParams->nDrcAlbumMode);
aacDecoder_SetParam(mAACDecoder, AAC_UNIDRC_ALBUM_MODE,
aacPresParams->nDrcAlbumMode);
}
bool updateDrcWrapper = false;
if (aacPresParams->nDrcBoost >= 0) {
ALOGV("set nDrcBoost=%d", aacPresParams->nDrcBoost);
@ -477,7 +488,7 @@ OMX_ERRORTYPE SoftAAC2::internalSetParameter(
aacPresParams->nHeavyCompression);
updateDrcWrapper = true;
}
if (aacPresParams->nTargetReferenceLevel >= 0) {
if (aacPresParams->nTargetReferenceLevel >= -1) {
ALOGV("set nTargetReferenceLevel=%d", aacPresParams->nTargetReferenceLevel);
mDrcWrap.setParam(DRC_PRES_MODE_WRAP_DESIRED_TARGET,
aacPresParams->nTargetReferenceLevel);

@ -476,6 +476,8 @@ private:
int32_t targetRefLevel;
int32_t encodedTargetLevel;
int32_t effectType;
int32_t albumMode;
int32_t outputLoudness;
} drcParams_t;
status_t setupAACCodec(

@ -733,10 +733,12 @@ constexpr int32_t COLOR_TRANSFER_LINEAR = 1;
constexpr int32_t COLOR_TRANSFER_SDR_VIDEO = 3;
constexpr int32_t COLOR_TRANSFER_ST2084 = 6;
constexpr char KEY_AAC_DRC_ALBUM_MODE[] = "aac-drc-album-mode";
constexpr char KEY_AAC_DRC_ATTENUATION_FACTOR[] = "aac-drc-cut-level";
constexpr char KEY_AAC_DRC_BOOST_FACTOR[] = "aac-drc-boost-level";
constexpr char KEY_AAC_DRC_EFFECT_TYPE[] = "aac-drc-effect-type";
constexpr char KEY_AAC_DRC_HEAVY_COMPRESSION[] = "aac-drc-heavy-compression";
constexpr char KEY_AAC_DRC_OUTPUT_LOUDNESS[] = "aac-drc-output-loudness";
constexpr char KEY_AAC_DRC_TARGET_REFERENCE_LEVEL[] = "aac-target-ref-level";
constexpr char KEY_AAC_ENCODED_TARGET_LEVEL[] = "aac-encoded-target-level";
constexpr char KEY_AAC_MAX_OUTPUT_CHANNEL_COUNT[] = "aac-max-output-channel_count";

Loading…
Cancel
Save