[SCM] libav/experimental: Add option for user to scale the amount of dynamic range compression which is applied by the audio decoder, and use that option in the AC3 decoder.

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Sun Jun 30 16:10:41 UTC 2013


The following commit has been merged in the experimental branch:
commit 1408352ada60d5a174b48d547114bb086812fcdb
Author: Justin Ruggles <justin.ruggles at gmail.com>
Date:   Thu Dec 20 00:55:08 2007 +0000

    Add option for user to scale the amount of dynamic range compression which is
    applied by the audio decoder, and use that option in the AC3 decoder.
    
    Originally committed as revision 11280 to svn://svn.ffmpeg.org/ffmpeg/trunk

diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c
index 468723f..c06edc4 100644
--- a/libavcodec/ac3dec.c
+++ b/libavcodec/ac3dec.c
@@ -792,7 +792,8 @@ static int ac3_parse_audio_block(AC3DecodeContext *ctx, int blk)
     i = !(ctx->channel_mode);
     do {
         if(get_bits1(gb)) {
-            ctx->dynamic_range[i] = dynamic_range_tab[get_bits(gb, 8)];
+            ctx->dynamic_range[i] = ((dynamic_range_tab[get_bits(gb, 8)]-1.0) *
+                                    ctx->avctx->drc_scale)+1.0;
         } else if(blk == 0) {
             ctx->dynamic_range[i] = 1.0f;
         }
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 88d600c..a32f961 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -2154,6 +2154,14 @@ typedef struct AVCodecContext {
      * - decoding: Set by user.
      */
     int request_channels;
+
+    /**
+     * Percentage of dynamic range compression to be applied by the decoder.
+     * The default value is 1.0, corresponding to full compression.
+     * - encoding: unused
+     * - decoding: Set by user.
+     */
+    float drc_scale;
 } AVCodecContext;
 
 /**
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 290814d..3b5ef7a 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -761,6 +761,7 @@ static const AVOption options[]={
 {"drop_frame_timecode", NULL, 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_DROP_FRAME_TIMECODE, INT_MIN, INT_MAX, V|E, "flags2"},
 {"non_linear_q", "use non linear quantizer", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_NON_LINEAR_QUANT, INT_MIN, INT_MAX, V|E, "flags2"},
 {"request_channels", "set desired number of audio channels", OFFSET(request_channels), FF_OPT_TYPE_INT, DEFAULT, 0, INT_MAX, A|D},
+{"drc_scale", "percentage of dynamic range compression to apply", OFFSET(drc_scale), FF_OPT_TYPE_FLOAT, 1.0, 0.0, 1.0, A|D},
 {NULL},
 };
 

-- 
Libav/FFmpeg packaging



More information about the pkg-multimedia-commits mailing list