diff options
author | Rainer Hochecker <fernetmenta@online.de> | 2013-09-28 15:56:46 +0200 |
---|---|---|
committer | Rainer Hochecker <fernetmenta@online.de> | 2013-09-28 16:51:09 +0200 |
commit | 6447cbefa0af87479f9a34443f6e6a7c3468ea6c (patch) | |
tree | a72f1b355e84704bb43c6e417902df23c4bc7c51 /lib/ffmpeg | |
parent | fdadf33f71132fbf07ff7e1fb69df64b299e49ea (diff) |
ffmpeg: backport swresample: Make rematrix maxvalue user settable
Diffstat (limited to 'lib/ffmpeg')
-rw-r--r-- | lib/ffmpeg/libswresample/rematrix.c | 13 | ||||
-rw-r--r-- | lib/ffmpeg/libswresample/swresample.c | 1 | ||||
-rw-r--r-- | lib/ffmpeg/libswresample/swresample_internal.h | 1 | ||||
-rw-r--r-- | lib/ffmpeg/libswresample/version.h | 2 |
4 files changed, 14 insertions, 3 deletions
diff --git a/lib/ffmpeg/libswresample/rematrix.c b/lib/ffmpeg/libswresample/rematrix.c index 51658cee21..8ab554cf90 100644 --- a/lib/ffmpeg/libswresample/rematrix.c +++ b/lib/ffmpeg/libswresample/rematrix.c @@ -116,6 +116,7 @@ av_cold static int auto_matrix(SwrContext *s) double maxcoef=0; char buf[128]; const int matrix_encoding = s->matrix_encoding; + float maxval; in_ch_layout = clean_layout(s, s->in_ch_layout); if(!sane_layout(in_ch_layout)){ @@ -300,8 +301,16 @@ av_cold static int auto_matrix(SwrContext *s) if(s->rematrix_volume < 0) maxcoef = -s->rematrix_volume; - if(( av_get_packed_sample_fmt(s->out_sample_fmt) < AV_SAMPLE_FMT_FLT - || av_get_packed_sample_fmt(s->int_sample_fmt) < AV_SAMPLE_FMT_FLT) && maxcoef > 1.0){ + if (s->rematrix_maxval > 0) { + maxval = s->rematrix_maxval; + } else if ( av_get_packed_sample_fmt(s->out_sample_fmt) < AV_SAMPLE_FMT_FLT + || av_get_packed_sample_fmt(s->int_sample_fmt) < AV_SAMPLE_FMT_FLT) { + maxval = 1.0; + } else + maxval = INT_MAX; + + if(maxcoef > maxval){ + maxcoef /= maxval; for(i=0; i<SWR_CH_MAX; i++) for(j=0; j<SWR_CH_MAX; j++){ s->matrix[i][j] /= maxcoef; diff --git a/lib/ffmpeg/libswresample/swresample.c b/lib/ffmpeg/libswresample/swresample.c index 9b71b2e122..b9c652a931 100644 --- a/lib/ffmpeg/libswresample/swresample.c +++ b/lib/ffmpeg/libswresample/swresample.c @@ -68,6 +68,7 @@ static const AVOption options[]={ {"lfe_mix_level" , "set LFE mix level" , OFFSET(lfe_mix_level ), AV_OPT_TYPE_FLOAT, {.dbl=0 }, -32 , 32 , PARAM}, {"rmvol" , "set rematrix volume" , OFFSET(rematrix_volume), AV_OPT_TYPE_FLOAT, {.dbl=1.0 }, -1000 , 1000 , PARAM}, {"rematrix_volume" , "set rematrix volume" , OFFSET(rematrix_volume), AV_OPT_TYPE_FLOAT, {.dbl=1.0 }, -1000 , 1000 , PARAM}, +{"rematrix_maxval" , "set rematrix maxval" , OFFSET(rematrix_maxval), AV_OPT_TYPE_FLOAT, {.dbl=0.0 }, 0 , 1000 , PARAM}, {"flags" , "set flags" , OFFSET(flags ), AV_OPT_TYPE_FLAGS, {.i64=0 }, 0 , UINT_MAX , PARAM, "flags"}, {"swr_flags" , "set flags" , OFFSET(flags ), AV_OPT_TYPE_FLAGS, {.i64=0 }, 0 , UINT_MAX , PARAM, "flags"}, diff --git a/lib/ffmpeg/libswresample/swresample_internal.h b/lib/ffmpeg/libswresample/swresample_internal.h index 17b85d5263..be36ba6802 100644 --- a/lib/ffmpeg/libswresample/swresample_internal.h +++ b/lib/ffmpeg/libswresample/swresample_internal.h @@ -82,6 +82,7 @@ struct SwrContext { float clev; ///< center mixing level float lfe_mix_level; ///< LFE mixing level float rematrix_volume; ///< rematrixing volume coefficient + float rematrix_maxval; ///< maximum value for rematrixing output enum AVMatrixEncoding matrix_encoding; /**< matrixed stereo encoding */ const int *channel_map; ///< channel index (or -1 if muted channel) map int used_ch_count; ///< number of used input channels (mapped channel count if channel_map, otherwise in.ch_count) diff --git a/lib/ffmpeg/libswresample/version.h b/lib/ffmpeg/libswresample/version.h index df9df480c7..8272b763b9 100644 --- a/lib/ffmpeg/libswresample/version.h +++ b/lib/ffmpeg/libswresample/version.h @@ -30,7 +30,7 @@ #define LIBSWRESAMPLE_VERSION_MAJOR 0 #define LIBSWRESAMPLE_VERSION_MINOR 17 -#define LIBSWRESAMPLE_VERSION_MICRO 102 +#define LIBSWRESAMPLE_VERSION_MICRO 103 #define LIBSWRESAMPLE_VERSION_INT AV_VERSION_INT(LIBSWRESAMPLE_VERSION_MAJOR, \ LIBSWRESAMPLE_VERSION_MINOR, \ |