diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-01-30 14:55:03 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-01-30 14:55:03 +0100 |
commit | 3c7195a96933e27c395a617a178f43ef4bc65a92 (patch) | |
tree | c2cdc6eca53b34e1af54b63ac99b908188fbf632 | |
parent | 3f35a31ee9566293eec68c61a93cdbd6b0e349a7 (diff) | |
parent | 23d461fe8714a20ee5e6929f22c61512fdda568e (diff) | |
download | ffmpeg-3c7195a96933e27c395a617a178f43ef4bc65a92.tar.gz |
Merge commit '23d461fe8714a20ee5e6929f22c61512fdda568e'
* commit '23d461fe8714a20ee5e6929f22c61512fdda568e':
ac3dec: Allow asymmetric application of DRC when drc_scale > 1
Conflicts:
libavcodec/ac3dec.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavcodec/ac3dec.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c index 6842e9e207..87b7f183f9 100644 --- a/libavcodec/ac3dec.c +++ b/libavcodec/ac3dec.c @@ -782,8 +782,13 @@ static int decode_audio_block(AC3DecodeContext *s, int blk) i = !s->channel_mode; do { if (get_bits1(gbc)) { - s->dynamic_range[i] = powf(dynamic_range_tab[get_bits(gbc, 8)], - s->drc_scale); + /* Allow asymmetric application of DRC when drc_scale > 1. + Amplification of quiet sounds is enhanced */ + float range = dynamic_range_tab[get_bits(gbc, 8)]; + if (range > 1.0 || s->drc_scale <= 1.0) + s->dynamic_range[i] = powf(range, s->drc_scale); + else + s->dynamic_range[i] = range; } else if (blk == 0) { s->dynamic_range[i] = 1.0f; } @@ -1504,7 +1509,7 @@ static av_cold int ac3_decode_end(AVCodecContext *avctx) #define OFFSET(x) offsetof(AC3DecodeContext, x) #define PAR (AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_AUDIO_PARAM) static const AVOption options[] = { - { "drc_scale", "percentage of dynamic range compression to apply", OFFSET(drc_scale), AV_OPT_TYPE_FLOAT, {.dbl = 1.0}, 0.0, 1.0, PAR }, + { "drc_scale", "percentage of dynamic range compression to apply", OFFSET(drc_scale), AV_OPT_TYPE_FLOAT, {.dbl = 1.0}, 0.0, 6.0, PAR }, {"dmix_mode", "Preferred Stereo Downmix Mode", OFFSET(preferred_stereo_downmix), AV_OPT_TYPE_INT, {.i64 = -1 }, -1, 2, 0, "dmix_mode"}, {"ltrt_cmixlev", "Lt/Rt Center Mix Level", OFFSET(ltrt_center_mix_level), AV_OPT_TYPE_FLOAT, {.dbl = -1.0 }, -1.0, 2.0, 0}, |