summaryrefslogtreecommitdiff
path: root/libswresample
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2012-05-02 00:25:57 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-05-02 01:12:10 +0200
commit6d5bf67f0475a54282b755ae21add252efc640b1 (patch)
treed61dab1a89d713832d8b9c5ff1651c0a44e22dfa /libswresample
parent9b42653b22d43b89de96a00abe7fd61f9e048eb2 (diff)
swr: add lfe_mix_level
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libswresample')
-rw-r--r--libswresample/rematrix.c11
-rw-r--r--libswresample/swresample.c1
-rw-r--r--libswresample/swresample_internal.h1
3 files changed, 13 insertions, 0 deletions
diff --git a/libswresample/rematrix.c b/libswresample/rematrix.c
index 7728445407..1eeb7173b6 100644
--- a/libswresample/rematrix.c
+++ b/libswresample/rematrix.c
@@ -216,6 +216,17 @@ static int auto_matrix(SwrContext *s)
}else
av_assert0(0);
}
+ /* mix LFE into front left/right or center */
+ if (unaccounted & AV_CH_LOW_FREQUENCY) {
+ if (s->out_ch_layout & AV_CH_FRONT_CENTER) {
+ matrix[FRONT_CENTER][LOW_FREQUENCY] += s->lfe_mix_level;
+ } else if (s->out_ch_layout & AV_CH_FRONT_LEFT) {
+ matrix[FRONT_LEFT ][LOW_FREQUENCY] += s->lfe_mix_level * M_SQRT1_2;
+ matrix[FRONT_RIGHT][LOW_FREQUENCY] += s->lfe_mix_level * M_SQRT1_2;
+ } else
+ av_assert0(0);
+ }
+
for(out_i=i=0; i<64; i++){
double sum=0;
int in_i=0;
diff --git a/libswresample/swresample.c b/libswresample/swresample.c
index 0cdf29d131..ba3d7e3193 100644
--- a/libswresample/swresample.c
+++ b/libswresample/swresample.c
@@ -62,6 +62,7 @@ static const AVOption options[]={
{"center_mix_level" , "Center Mix Level" , OFFSET(clev ), AV_OPT_TYPE_FLOAT, {.dbl=C_30DB }, -32 , 32 , PARAM},
{"slev" , "Sourround Mix Level" , OFFSET(slev ), AV_OPT_TYPE_FLOAT, {.dbl=C_30DB }, -32 , 32 , PARAM},
{"surround_mix_level" , "Sourround Mix Level" , OFFSET(slev ), AV_OPT_TYPE_FLOAT, {.dbl=C_30DB }, -32 , 32 , PARAM},
+{"lfe_mix_level" , "LFE Mix Level" , OFFSET(lfe_mix_level ), AV_OPT_TYPE_FLOAT, {.dbl=0 }, -32 , 32 , PARAM},
{"rmvol" , "Rematrix Volume" , OFFSET(rematrix_volume), AV_OPT_TYPE_FLOAT, {.dbl=1.0 }, -1000 , 1000 , PARAM},
{"rematrix_volume" , "Rematrix Volume" , OFFSET(rematrix_volume), AV_OPT_TYPE_FLOAT, {.dbl=1.0 }, -1000 , 1000 , PARAM},
{"flags" , NULL , OFFSET(flags ), AV_OPT_TYPE_FLAGS, {.dbl=0 }, 0 , UINT_MAX , PARAM, "flags"},
diff --git a/libswresample/swresample_internal.h b/libswresample/swresample_internal.h
index 550d7f0eb2..15687f7865 100644
--- a/libswresample/swresample_internal.h
+++ b/libswresample/swresample_internal.h
@@ -50,6 +50,7 @@ struct SwrContext {
int flags; ///< miscellaneous flags such as SWR_FLAG_RESAMPLE
float slev; ///< surround mixing level
float clev; ///< center mixing level
+ float lfe_mix_level; ///< LFE mixing level
float rematrix_volume; ///< rematrixing volume coefficient
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)