Commit bfc61b0f authored by Muhammad Faiz's avatar Muhammad Faiz

avfilter: add firequalizer filter

Reviewed-by: 's avatarPaul B Mahol <onemda@gmail.com>
Signed-off-by: 's avatarMuhammad Faiz <mfcc64@gmail.com>
parent 1387f3a0
......@@ -6,6 +6,7 @@ version <next>:
- fieldhint filter
- loop video filter and aloop audio filter
- Bob Weaver deinterlacing filter
- firequalizer filter
version 3.0:
......
......@@ -353,6 +353,7 @@ Filters:
af_biquads.c Paul B Mahol
af_chorus.c Paul B Mahol
af_compand.c Paul B Mahol
af_firequalizer.c Muhammad Faiz
af_ladspa.c Paul B Mahol
af_pan.c Nicolas George
af_sidechaincompress.c Paul B Mahol
......
......@@ -2861,6 +2861,8 @@ eq_filter_deps="gpl"
fftfilt_filter_deps="avcodec"
fftfilt_filter_select="rdft"
find_rect_filter_deps="avcodec avformat gpl"
firequalizer_filter_deps="avcodec"
firequalizer_filter_select="rdft"
flite_filter_deps="libflite"
frei0r_filter_deps="frei0r dlopen"
frei0r_src_filter_deps="frei0r dlopen"
......
......@@ -2366,6 +2366,115 @@ Sets the difference coefficient (default: 2.5). 0.0 means mono sound
Enable clipping. By default is enabled.
@end table
@section firequalizer
Apply FIR Equalization using arbitrary frequency response.
The filter accepts the following option:
@table @option
@item gain
Set gain curve equation (in dB). The expression can contain variables:
@table @option
@item f
the evaluated frequency
@item sr
sample rate
@item ch
channel number, set to 0 when multichannels evaluation is disabled
@item chid
channel id, see libavutil/channel_layout.h, set to the first channel id when
multichannels evaluation is disabled
@item chs
number of channels
@item chlayout
channel_layout, see libavutil/channel_layout.h
@end table
and functions:
@table @option
@item gain_interpolate(f)
interpolate gain on frequency f based on gain_entry
@end table
This option is also available as command. Default is @code{gain_interpolate(f)}.
@item gain_entry
Set gain entry for gain_interpolate function. The expression can
contain functions:
@table @option
@item entry(f, g)
store gain entry at frequency f with value g
@end table
This option is also available as command.
@item delay
Set filter delay in seconds. Higher value means more accurate.
Default is @code{0.01}.
@item accuracy
Set filter accuracy in Hz. Lower value means more accurate.
Default is @code{5}.
@item wfunc
Set window function. Acceptable values are:
@table @option
@item rectangular
rectangular window, useful when gain curve is already smooth
@item hann
hann window (default)
@item hamming
hamming window
@item blackman
blackman window
@item nuttall3
3-terms continuous 1st derivative nuttall window
@item mnuttall3
minimum 3-terms discontinuous nuttall window
@item nuttall
4-terms continuous 1st derivative nuttall window
@item bnuttall
minimum 4-terms discontinuous nuttall (blackman-nuttall) window
@item bharris
blackman-harris window
@end table
@item fixed
If enabled, use fixed number of audio samples. This improves speed when
filtering with large delay. Default is disabled.
@item multi
Enable multichannels evaluation on gain. Default is disabled.
@end table
@subsection Examples
@itemize
@item
lowpass at 1000 Hz:
@example
firequalizer=gain='if(lt(f,1000), 0, -INF)'
@end example
@item
lowpass at 1000 Hz with gain_entry:
@example
firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
@end example
@item
custom equalization:
@example
firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
@end example
@item
higher delay:
@example
firequalizer=delay=0.1:fixed=on
@end example
@item
lowpass on left channel, highpass on right channel:
@example
firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
:gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
@end example
@end itemize
@section flanger
Apply a flanging effect to the audio.
......
......@@ -80,6 +80,7 @@ OBJS-$(CONFIG_EARWAX_FILTER) += af_earwax.o
OBJS-$(CONFIG_EBUR128_FILTER) += f_ebur128.o
OBJS-$(CONFIG_EQUALIZER_FILTER) += af_biquads.o
OBJS-$(CONFIG_EXTRASTEREO_FILTER) += af_extrastereo.o
OBJS-$(CONFIG_FIREQUALIZER_FILTER) += af_firequalizer.o
OBJS-$(CONFIG_FLANGER_FILTER) += af_flanger.o generate_wave_table.o
OBJS-$(CONFIG_HIGHPASS_FILTER) += af_biquads.o
OBJS-$(CONFIG_JOIN_FILTER) += af_join.o
......
This diff is collapsed.
......@@ -101,6 +101,7 @@ void avfilter_register_all(void)
REGISTER_FILTER(EBUR128, ebur128, af);
REGISTER_FILTER(EQUALIZER, equalizer, af);
REGISTER_FILTER(EXTRASTEREO, extrastereo, af);
REGISTER_FILTER(FIREQUALIZER, firequalizer, af);
REGISTER_FILTER(FLANGER, flanger, af);
REGISTER_FILTER(HIGHPASS, highpass, af);
REGISTER_FILTER(JOIN, join, af);
......
......@@ -30,7 +30,7 @@
#include "libavutil/version.h"
#define LIBAVFILTER_VERSION_MAJOR 6
#define LIBAVFILTER_VERSION_MINOR 34
#define LIBAVFILTER_VERSION_MINOR 35
#define LIBAVFILTER_VERSION_MICRO 100
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment