FFmpeg
Loading...
Searching...
No Matches
af_flanger.c File Reference
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "libavutil/samplefmt.h"
#include "avfilter.h"
#include "audio.h"
#include "filters.h"
#include "generate_wave_table.h"

Go to the source code of this file.

Data Structures

struct  FlangerContext
 

Macros

#define INTERPOLATION_LINEAR   0
 
#define INTERPOLATION_QUADRATIC   1
 
#define OFFSET(x)
 
#define A   AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
 

Functions

 AVFILTER_DEFINE_CLASS (flanger)
 
static av_cold int init (AVFilterContext *ctx)
 
static int config_input (AVFilterLink *inlink)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *frame)
 
static av_cold void uninit (AVFilterContext *ctx)
 

Variables

static const AVOption flanger_options []
 
static const AVFilterPad flanger_inputs []
 
const FFFilter ff_af_flanger
 

Macro Definition Documentation

◆ INTERPOLATION_LINEAR

#define INTERPOLATION_LINEAR   0

Definition at line 29 of file af_flanger.c.

Referenced by filter_frame().

◆ INTERPOLATION_QUADRATIC

#define INTERPOLATION_QUADRATIC   1

Definition at line 30 of file af_flanger.c.

◆ OFFSET

#define OFFSET ( x)
Value:

Definition at line 52 of file af_flanger.c.

◆ A

Definition at line 53 of file af_flanger.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( flanger )

◆ init()

static av_cold int init ( AVFilterContext * ctx)
static

Definition at line 75 of file af_flanger.c.

◆ config_input()

static int config_input ( AVFilterLink * inlink)
static

Definition at line 91 of file af_flanger.c.

◆ filter_frame()

static int filter_frame ( AVFilterLink * inlink,
AVFrame * frame )
static

Definition at line 112 of file af_flanger.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext * ctx)
static

Definition at line 177 of file af_flanger.c.

Variable Documentation

◆ flanger_options

const AVOption flanger_options[]
static
Initial value:
= {
{ "delay", "base delay in milliseconds", OFFSET(delay_min), AV_OPT_TYPE_DOUBLE, {.dbl=0}, 0, 30, A },
{ "depth", "added swept delay in milliseconds", OFFSET(delay_depth), AV_OPT_TYPE_DOUBLE, {.dbl=2}, 0, 10, A },
{ "regen", "percentage regeneration (delayed signal feedback)", OFFSET(feedback_gain), AV_OPT_TYPE_DOUBLE, {.dbl=0}, -95, 95, A },
{ "width", "percentage of delayed signal mixed with original", OFFSET(delay_gain), AV_OPT_TYPE_DOUBLE, {.dbl=71}, 0, 100, A },
{ "speed", "sweeps per second (Hz)", OFFSET(speed), AV_OPT_TYPE_DOUBLE, {.dbl=0.5}, 0.1, 10, A },
{ "shape", "swept wave shape", OFFSET(wave_shape), AV_OPT_TYPE_INT, {.i64=WAVE_SIN}, WAVE_SIN, WAVE_NB-1, A, .unit = "type" },
{ "triangular", NULL, 0, AV_OPT_TYPE_CONST, {.i64=WAVE_TRI}, 0, 0, A, .unit = "type" },
{ "t", NULL, 0, AV_OPT_TYPE_CONST, {.i64=WAVE_TRI}, 0, 0, A, .unit = "type" },
{ "sinusoidal", NULL, 0, AV_OPT_TYPE_CONST, {.i64=WAVE_SIN}, 0, 0, A, .unit = "type" },
{ "s", NULL, 0, AV_OPT_TYPE_CONST, {.i64=WAVE_SIN}, 0, 0, A, .unit = "type" },
{ "phase", "swept wave percentage phase-shift for multi-channel", OFFSET(channel_phase), AV_OPT_TYPE_DOUBLE, {.dbl=25}, 0, 100, A },
{ "interp", "delay-line interpolation", OFFSET(interpolation), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, A, .unit = "itype" },
{ "linear", NULL, 0, AV_OPT_TYPE_CONST, {.i64=INTERPOLATION_LINEAR}, 0, 0, A, .unit = "itype" },
{ "quadratic", NULL, 0, AV_OPT_TYPE_CONST, {.i64=INTERPOLATION_QUADRATIC}, 0, 0, A, .unit = "itype" },
{ NULL }
}
static int interpolation(DeclickChannel *c, const double *src, int ar_order, double *acoefficients, int *index, int nb_errors, double *auxiliary, double *interpolated)
#define INTERPOLATION_LINEAR
Definition af_flanger.c:29
#define INTERPOLATION_QUADRATIC
Definition af_flanger.c:30
#define A(x)
Definition vpx_arith.h:28
#define NULL
Definition coverity.c:32
#define OFFSET(x)
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition opt.h:298
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition opt.h:258
@ AV_OPT_TYPE_DOUBLE
Underlying C type is double.
Definition opt.h:266

Definition at line 55 of file af_flanger.c.

◆ flanger_inputs

const AVFilterPad flanger_inputs[]
static
Initial value:
= {
{
.name = "default",
.config_props = config_input,
.filter_frame = filter_frame,
},
}
static int config_input(AVFilterLink *inlink)
static int filter_frame(DBEDecodeContext *s, AVFrame *frame)
Definition dolby_e.c:1067
@ AVMEDIA_TYPE_AUDIO
Definition avutil.h:201

Definition at line 189 of file af_flanger.c.

◆ ff_af_flanger

const FFFilter ff_af_flanger
Initial value:
= {
.p.name = "flanger",
.p.description = NULL_IF_CONFIG_SMALL("Apply a flanging effect to the audio."),
.p.priv_class = &flanger_class,
.priv_size = sizeof(FlangerContext),
.init = init,
}
static const AVFilterPad flanger_inputs[]
Definition af_flanger.c:189
const AVFilterPad ff_audio_default_filterpad[1]
An AVFilterPad array whose only entry has name "default" and is of type AVMEDIA_TYPE_AUDIO.
Definition audio.c:34
int(* init)(AVBSFContext *ctx)
Definition dts2pts.c:608
@ AV_SAMPLE_FMT_DBLP
double, planar
Definition samplefmt.h:67
static av_cold void uninit(AVBitStreamFilterContext *ctx)
#define FILTER_INPUTS(array)
Definition filters.h:264
#define FILTER_OUTPUTS(array)
Definition filters.h:265
#define FILTER_SINGLE_SAMPLEFMT(sample_fmt_)
Definition filters.h:257
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition internal.h:88

Definition at line 198 of file af_flanger.c.