Discussion:
[PATCH 2/3] libfdk-aacdec: Allow setting the new dynamic range control effect setting
(too old to reply)
Martin Storsjö
2018-09-04 08:48:02 UTC
Permalink
This is a new setting in FDK v2.
---
libavcodec/libfdk-aacdec.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)

diff --git a/libavcodec/libfdk-aacdec.c b/libavcodec/libfdk-aacdec.c
index c3d3b70fc9..ca70a49ad4 100644
--- a/libavcodec/libfdk-aacdec.c
+++ b/libavcodec/libfdk-aacdec.c
@@ -51,6 +51,7 @@ typedef struct FDKAACDecContext {
int drc_level;
int drc_boost;
int drc_heavy;
+ int drc_effect;
int drc_cut;
int level_limit;
} FDKAACDecContext;
@@ -77,6 +78,10 @@ static const AVOption fdk_aac_dec_options[] = {
OFFSET(drc_heavy), AV_OPT_TYPE_INT, { .i64 = -1}, -1, 1, AD, NULL },
#if FDKDEC_VER_AT_LEAST(2, 5) // 2.5.10
{ "level_limit", "Signal level limiting", OFFSET(level_limit), AV_OPT_TYPE_INT, { .i64 = 0 }, -1, 1, AD },
+#endif
+#if FDKDEC_VER_AT_LEAST(3, 0) // 3.0.0
+ { "drc_effect","Dynamic Range Control: effect type, where e.g. [0] is none and [6] is general",
+ OFFSET(drc_effect), AV_OPT_TYPE_INT, { .i64 = -1}, -1, 8, AD, NULL },
#endif
{ NULL }
};
@@ -306,6 +311,15 @@ static av_cold int fdk_aac_decode_init(AVCodecContext *avctx)
}
#endif

+#if FDKDEC_VER_AT_LEAST(3, 0) // 3.0.0
+ if (s->drc_effect != -1) {
+ if (aacDecoder_SetParam(s->handle, AAC_UNIDRC_SET_EFFECT, s->drc_effect) != AAC_DEC_OK) {
+ av_log(avctx, AV_LOG_ERROR, "Unable to set DRC effect type in the decoder\n");
+ return AVERROR_UNKNOWN;
+ }
+ }
+#endif
+
avctx->sample_fmt = AV_SAMPLE_FMT_S16;

s->decoder_buffer_size = DECODER_BUFFSIZE * DECODER_MAX_CHANNELS;
--
2.15.2 (Apple Git-101.1)
Martin Storsjö
2018-09-04 08:48:03 UTC
Permalink
This is a new feature in FDK v2.
---
libavcodec/libfdk-aacenc.c | 27 ++++++++++++++++++++++++++-
1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/libavcodec/libfdk-aacenc.c b/libavcodec/libfdk-aacenc.c
index 92ad1762ae..f71a276403 100644
--- a/libavcodec/libfdk-aacenc.c
+++ b/libavcodec/libfdk-aacenc.c
@@ -36,6 +36,7 @@ typedef struct AACContext {
HANDLE_AACENCODER handle;
int afterburner;
int eld_sbr;
+ int eld_v2;
int signaling;
int latm;
int header_period;
@@ -47,6 +48,9 @@ typedef struct AACContext {
static const AVOption aac_enc_options[] = {
{ "afterburner", "Afterburner (improved quality)", offsetof(AACContext, afterburner), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM },
{ "eld_sbr", "Enable SBR for ELD (for SBR in other configurations, use the -profile parameter)", offsetof(AACContext, eld_sbr), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM },
+#if FDKENC_VER_AT_LEAST(4, 0) // 4.0.0
+ { "eld_v2", "Enable ELDv2 (LD-MPS extension for ELD stereo signals)", offsetof(AACContext, eld_v2), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM },
+#endif
{ "signaling", "SBR/PS signaling style", offsetof(AACContext, signaling), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 2, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM, "signaling" },
{ "default", "Choose signaling implicitly (explicit hierarchical by default, implicit if global header is disabled)", 0, AV_OPT_TYPE_CONST, { .i64 = -1 }, 0, 0, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM, "signaling" },
{ "implicit", "Implicit backwards compatible signaling", 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, 0, 0, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM, "signaling" },
@@ -152,7 +156,28 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)

switch (avctx->channels) {
case 1: mode = MODE_1; sce = 1; cpe = 0; break;
- case 2: mode = MODE_2; sce = 0; cpe = 1; break;
+ case 2:
+#if FDKENC_VER_AT_LEAST(4, 0) // 4.0.0
+ // (profile + 1) to map from profile range to AOT range
+ if (aot == FF_PROFILE_AAC_ELD + 1 && s->eld_v2) {
+ if ((err = aacEncoder_SetParam(s->handle, AACENC_CHANNELMODE,
+ 128)) != AACENC_OK) {
+ av_log(avctx, AV_LOG_ERROR, "Unable to enable ELDv2: %s\n",
+ aac_get_error(err));
+ goto error;
+ } else {
+ mode = MODE_212;
+ sce = 1;
+ cpe = 0;
+ }
+ } else
+#endif
+ {
+ mode = MODE_2;
+ sce = 0;
+ cpe = 1;
+ }
+ break;
case 3: mode = MODE_1_2; sce = 1; cpe = 1; break;
case 4: mode = MODE_1_2_1; sce = 2; cpe = 1; break;
case 5: mode = MODE_1_2_2; sce = 1; cpe = 2; break;
--
2.15.2 (Apple Git-101.1)
Luca Barbato
2018-09-04 12:35:05 UTC
Permalink
Set Ok.

lu

Continue reading on narkive:
Loading...