summaryrefslogtreecommitdiff
path: root/libswresample/rematrix.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-10-26 00:44:35 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-10-26 00:46:46 +0200
commit2f86566a31e4c20816e1fc70ca747aa1fddc09c3 (patch)
treed6d9d9bf2be14f589161cb8f08e2836ad4cec320 /libswresample/rematrix.c
parentb1470d7a60636c7f2a2ea9e3c926ca57f10d0651 (diff)
rematrix: add parameter to tune volume
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libswresample/rematrix.c')
-rw-r--r--libswresample/rematrix.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/libswresample/rematrix.c b/libswresample/rematrix.c
index 9dcfecbd80..130bb7416a 100644
--- a/libswresample/rematrix.c
+++ b/libswresample/rematrix.c
@@ -210,6 +210,9 @@ int swr_rematrix_init(SwrContext *s){
if(s->out_ch_layout & (1ULL<<i))
out_i++;
}
+ if(s->rematrix_volume < 0)
+ maxcoef = -s->rematrix_volume;
+
if(( s->out_sample_fmt < AV_SAMPLE_FMT_FLT
|| s->int_sample_fmt < AV_SAMPLE_FMT_FLT) && maxcoef > 1.0){
for(i=0; i<SWR_CH_MAX; i++)
@@ -218,6 +221,15 @@ int swr_rematrix_init(SwrContext *s){
s->matrix32[i][j]= lrintf(s->matrix[i][j] * 32768);
}
}
+
+ if(s->rematrix_volume > 0){
+ for(i=0; i<SWR_CH_MAX; i++)
+ for(j=0; j<SWR_CH_MAX; j++){
+ s->matrix[i][j] *= s->rematrix_volume;
+ s->matrix32[i][j]= lrintf(s->matrix[i][j] * 32768);
+ }
+ }
+
for(i=0; i<av_get_channel_layout_nb_channels(s->out_ch_layout); i++){
for(j=0; j<av_get_channel_layout_nb_channels(s->in_ch_layout); j++){
av_log(NULL, AV_LOG_DEBUG, "%f ", s->matrix[i][j]);