[FFmpeg-cvslog] avfilter/af_sofalizer: make lfe gain user configurable

Paul B Mahol git at videolan.org
Fri May 19 00:16:12 EEST 2017


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Thu May 18 23:13:52 2017 +0200| [f5e5c531170f0ce9c37e555e689ffd60694b47cd] | committer: Paul B Mahol

avfilter/af_sofalizer: make lfe gain user configurable

Default settings have it too low.

Signed-off-by: Paul B Mahol <onemda at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f5e5c531170f0ce9c37e555e689ffd60694b47cd
---

 doc/filters.texi           | 3 +++
 libavfilter/af_sofalizer.c | 4 +++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index b684d8dec8..296a8dcd03 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -3606,6 +3606,9 @@ Each virtual loudspeaker description is separated by '|'.
 For example to override front left and front right channel positions use:
 'speakers=FL 45 15|FR 345 15'.
 Descriptions with unrecognised channel names are ignored.
+
+ at item lfegain
+Set custom gain for LFE channels. Value is in dB. Default is 0.
 @end table
 
 @subsection Examples
diff --git a/libavfilter/af_sofalizer.c b/libavfilter/af_sofalizer.c
index 622eac577c..ef723ee2c4 100644
--- a/libavfilter/af_sofalizer.c
+++ b/libavfilter/af_sofalizer.c
@@ -70,6 +70,7 @@ typedef struct SOFAlizerContext {
     float *speaker_azim;        /* azimuth of the virtual loudspeakers */
     float *speaker_elev;        /* elevation of the virtual loudspeakers */
     char *speakers_pos;         /* custom positions of the virtual loudspeakers */
+    float lfe_gain;             /* initial gain for the LFE channel */
     float gain_lfe;             /* gain applied to LFE channel */
     int lfe_channel;            /* LFE channel position in channel layout */
 
@@ -1067,7 +1068,7 @@ static int config_input(AVFilterLink *inlink)
     }
 
     /* gain -3 dB per channel, -6 dB to get LFE on a similar level */
-    s->gain_lfe = expf((s->gain - 3 * inlink->channels - 6) / 20 * M_LN10);
+    s->gain_lfe = expf((s->gain - 3 * inlink->channels - 6 + s->lfe_gain) / 20 * M_LN10);
 
     s->n_conv = nb_input_channels;
 
@@ -1197,6 +1198,7 @@ static const AVOption sofalizer_options[] = {
     { "time",      "time domain",      0,               AV_OPT_TYPE_CONST,  {.i64=0},       0,   0, .flags = FLAGS, "type" },
     { "freq",      "frequency domain", 0,               AV_OPT_TYPE_CONST,  {.i64=1},       0,   0, .flags = FLAGS, "type" },
     { "speakers",  "set speaker custom positions", OFFSET(speakers_pos), AV_OPT_TYPE_STRING,  {.str=0},    0, 0, .flags = FLAGS },
+    { "lfegain",   "set lfe gain",                 OFFSET(lfe_gain),     AV_OPT_TYPE_FLOAT,   {.dbl=0},   -9, 9, .flags = FLAGS },
     { NULL }
 };
 



More information about the ffmpeg-cvslog mailing list