diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-07-22 03:23:54 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-07-22 03:23:54 +0200 |
commit | e2b718464e92fcde3d21c6653c88ddec2ab21c3f (patch) | |
tree | c69eae690667f39c9f0b2ecd0e064a4a02bf4174 /libswresample/rematrix.c | |
parent | 5169111145bc1d08861a059346ac8900b9aee716 (diff) |
swresample: Make rematrix maxvalue user settable
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libswresample/rematrix.c')
-rw-r--r-- | libswresample/rematrix.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/libswresample/rematrix.c b/libswresample/rematrix.c index 48aff3be7f..33e2966fd3 100644 --- a/libswresample/rematrix.c +++ b/libswresample/rematrix.c @@ -120,6 +120,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)){ @@ -304,8 +305,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; |