Opened 9 years ago

Closed 9 years ago

#1607 closed enhancement (fixed)

support for ffmpeg's drc_scale option [patch]

Reported by: peter@… Owned by: reimar
Priority: normal Component: ad
Version: HEAD Severity: minor
Keywords: Cc:
Blocked By: Blocking:
Reproduced by developer: Analyzed by developer:


I added support for drc_scale ([e]ac3 decoder dynamic range compression factor) in lavdopts. All the other lavdopts apply to video, so I had to make the variable extern instead of static like all the others.
(that's until's DNS record updates...)

Index: libmpcodecs/ad_ffmpeg.c
--- libmpcodecs/ad_ffmpeg.c (revision 29972)
+++ libmpcodecs/ad_ffmpeg.c (working copy)
@@ -71,6 +71,11 @@

lavc_context->codec_type = CODEC_TYPE_AUDIO;
lavc_context->codec_id = lavc_codec->id; not sure if required, imho not --A'rpi

+ {
+ extern float lavc_param_drc_scale; parsed from lavdopts in vd_ffmpeg.c
+ lavc_context->drc_scale = lavc_param_drc_scale;
+ }

/* alloc extra data */
if (sh_audio->wf && sh_audio->wf->cbSize > 0) {

lavc_context->extradata = av_mallocz(sh_audio->wf->cbSize + FF_INPUT_BUFFER_PADDING_SIZE);

Index: libmpcodecs/vd_ffmpeg.c
--- libmpcodecs/vd_ffmpeg.c (revision 29972)
+++ libmpcodecs/vd_ffmpeg.c (working copy)
@@ -79,6 +79,7 @@

static char *lavc_param_skip_frame_str = NULL;
static int lavc_param_threads=1;
static int lavc_param_bitexact=0;

+ float lavc_param_drc_scale=0.0; audio param, for ad_ffmpeg.c

static char *lavc_avopt = NULL;

const m_option_t lavc_decode_opts_conf[]={

@@ -99,6 +100,7 @@

{"skipframe", &lavc_param_skip_frame_str, CONF_TYPE_STRING, 0, 0, 0, NULL},
{"threads", &lavc_param_threads, CONF_TYPE_INT, CONF_RANGE, 1, 8, NULL},
{"bitexact", &lavc_param_bitexact, CONF_TYPE_FLAG, 0, 0, CODEC_FLAG_BITEXACT, NULL},

+ {"drc_scale", &lavc_param_drc_scale, CONF_TYPE_FLOAT, CONF_RANGE, 0, 2.0, NULL},

{"o", &lavc_avopt, CONF_TYPE_STRING, 0, 0, 0, NULL},
{NULL, NULL, 0, 0, 0, 0, NULL}


I made the allowed range for drc_scale 0 - 2.0, so curious people could hear what it sounds like with more than the full amount of dynamic range compression scaling applied. The code in libavcodec/ac3dec.c that uses drc_scale doesn't have a problem with that.

Attachments (1)

drc_scale.txt (1.6 KB) - added by peter@… 9 years ago.
the tiny patch

Download all attachments as: .zip

Change History (5)

Changed 9 years ago by peter@…

the tiny patch

comment:1 Changed 9 years ago by peter@…

comment:2 Changed 9 years ago by compn

i'm pretty sure patch rejected because of putting audio option in video code.

comment:3 Changed 9 years ago by reimar

  • Owner changed from r_togni@… to reimar

The -a52drc option was extended to apply to both decoders, so you do not have to care about which one is actually used.
It is not well tested, so report if you have issues with it.

comment:4 Changed 9 years ago by reimar

  • Resolution set to fixed
  • Status changed from new to closed


Note: See TracTickets for help on using tickets.