FFmpeg
Macros | Functions | Variables
af_afir.c File Reference

An arbitrary audio FIR filter. More...

#include <float.h>
#include "libavutil/common.h"
#include "libavutil/float_dsp.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/opt.h"
#include "libavutil/xga_font_data.h"
#include "libavcodec/avfft.h"
#include "audio.h"
#include "avfilter.h"
#include "filters.h"
#include "formats.h"
#include "internal.h"
#include "af_afir.h"

Go to the source code of this file.

Macros

#define AF   AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
 
#define VF   AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
 
#define OFFSET(x)   offsetof(AudioFIRContext, x)
 

Functions

static void fcmul_add_c (float *sum, const float *t, const float *c, ptrdiff_t len)
 
static int fir_quantum (AVFilterContext *ctx, AVFrame *out, int ch, int offset)
 
static int fir_channel (AVFilterContext *ctx, AVFrame *out, int ch)
 
static int fir_channels (AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
 
static int fir_frame (AudioFIRContext *s, AVFrame *in, AVFilterLink *outlink)
 
static void drawtext (AVFrame *pic, int x, int y, const char *txt, uint32_t color)
 
static void draw_line (AVFrame *out, int x0, int y0, int x1, int y1, uint32_t color)
 
static void draw_response (AVFilterContext *ctx, AVFrame *out)
 
static int init_segment (AVFilterContext *ctx, AudioFIRSegment *seg, int offset, int nb_partitions, int part_size)
 
static int convert_coeffs (AVFilterContext *ctx)
 
static int check_ir (AVFilterLink *link, AVFrame *frame)
 
static int activate (AVFilterContext *ctx)
 
static int query_formats (AVFilterContext *ctx)
 
static int config_output (AVFilterLink *outlink)
 
static void uninit_segment (AVFilterContext *ctx, AudioFIRSegment *seg)
 
static av_cold void uninit (AVFilterContext *ctx)
 
static int config_video (AVFilterLink *outlink)
 
void ff_afir_init (AudioFIRDSPContext *dsp)
 
static av_cold int init (AVFilterContext *ctx)
 
 AVFILTER_DEFINE_CLASS (afir)
 

Variables

static const AVFilterPad afir_inputs []
 
static const AVOption afir_options []
 
AVFilter ff_af_afir
 

Detailed Description

An arbitrary audio FIR filter.

Definition in file af_afir.c.

Macro Definition Documentation

Definition at line 823 of file af_afir.c.

Definition at line 824 of file af_afir.c.

#define OFFSET (   x)    offsetof(AudioFIRContext, x)

Definition at line 825 of file af_afir.c.

Function Documentation

static void fcmul_add_c ( float *  sum,
const float *  t,
const float *  c,
ptrdiff_t  len 
)
static

Definition at line 42 of file af_afir.c.

Referenced by ff_afir_init().

static int fir_quantum ( AVFilterContext ctx,
AVFrame out,
int  ch,
int  offset 
)
static

Definition at line 59 of file af_afir.c.

Referenced by fir_channel().

static int fir_channel ( AVFilterContext ctx,
AVFrame out,
int  ch 
)
static

Definition at line 141 of file af_afir.c.

Referenced by fir_channels().

static int fir_channels ( AVFilterContext ctx,
void arg,
int  jobnr,
int  nb_jobs 
)
static

Definition at line 152 of file af_afir.c.

Referenced by fir_frame().

static int fir_frame ( AudioFIRContext s,
AVFrame in,
AVFilterLink outlink 
)
static

Definition at line 165 of file af_afir.c.

Referenced by activate().

static void drawtext ( AVFrame pic,
int  x,
int  y,
const char *  txt,
uint32_t  color 
)
static

Definition at line 192 of file af_afir.c.

Referenced by draw_response().

static void draw_line ( AVFrame out,
int  x0,
int  y0,
int  x1,
int  y1,
uint32_t  color 
)
static

Definition at line 215 of file af_afir.c.

Referenced by draw_response().

static void draw_response ( AVFilterContext ctx,
AVFrame out 
)
static

Definition at line 241 of file af_afir.c.

Referenced by convert_coeffs().

static int init_segment ( AVFilterContext ctx,
AudioFIRSegment seg,
int  offset,
int  nb_partitions,
int  part_size 
)
static

Definition at line 330 of file af_afir.c.

Referenced by convert_coeffs().

static int convert_coeffs ( AVFilterContext ctx)
static

Definition at line 372 of file af_afir.c.

Referenced by activate().

static int check_ir ( AVFilterLink link,
AVFrame frame 
)
static

Definition at line 519 of file af_afir.c.

Referenced by activate().

static int activate ( AVFilterContext ctx)
static

Definition at line 535 of file af_afir.c.

static int query_formats ( AVFilterContext ctx)
static

Definition at line 620 of file af_afir.c.

static int config_output ( AVFilterLink outlink)
static

Definition at line 673 of file af_afir.c.

Referenced by init().

static void uninit_segment ( AVFilterContext ctx,
AudioFIRSegment seg 
)
static

Definition at line 691 of file af_afir.c.

Referenced by uninit().

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 721 of file af_afir.c.

static int config_video ( AVFilterLink outlink)
static

Definition at line 737 of file af_afir.c.

Referenced by init().

void ff_afir_init ( AudioFIRDSPContext dsp)

Definition at line 756 of file af_afir.c.

Referenced by checkasm_check_afir(), and init().

static av_cold int init ( AVFilterContext ctx)
static

Definition at line 764 of file af_afir.c.

AVFILTER_DEFINE_CLASS ( afir  )

Variable Documentation

const AVFilterPad afir_inputs[]
static
Initial value:
= {
{
.name = "main",
},{
.name = "ir",
},
{ NULL }
}
#define NULL
Definition: coverity.c:32

Definition at line 812 of file af_afir.c.

const AVOption afir_options[]
static
Initial value:
= {
{ "dry", "set dry gain", OFFSET(dry_gain), AV_OPT_TYPE_FLOAT, {.dbl=1}, 0, 10, AF },
{ "wet", "set wet gain", OFFSET(wet_gain), AV_OPT_TYPE_FLOAT, {.dbl=1}, 0, 10, AF },
{ "length", "set IR length", OFFSET(length), AV_OPT_TYPE_FLOAT, {.dbl=1}, 0, 1, AF },
{ "gtype", "set IR auto gain type",OFFSET(gtype), AV_OPT_TYPE_INT, {.i64=0}, -1, 2, AF, "gtype" },
{ "none", "without auto gain", 0, AV_OPT_TYPE_CONST, {.i64=-1}, 0, 0, AF, "gtype" },
{ "peak", "peak gain", 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, AF, "gtype" },
{ "dc", "DC gain", 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, AF, "gtype" },
{ "gn", "gain to noise", 0, AV_OPT_TYPE_CONST, {.i64=2}, 0, 0, AF, "gtype" },
{ "irgain", "set IR gain", OFFSET(ir_gain), AV_OPT_TYPE_FLOAT, {.dbl=1}, 0, 1, AF },
{ "irfmt", "set IR format", OFFSET(ir_format), AV_OPT_TYPE_INT, {.i64=1}, 0, 1, AF, "irfmt" },
{ "mono", "single channel", 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, AF, "irfmt" },
{ "input", "same as input", 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, AF, "irfmt" },
{ "maxir", "set max IR length", OFFSET(max_ir_len), AV_OPT_TYPE_FLOAT, {.dbl=30}, 0.1, 60, AF },
{ "response", "show IR frequency response", OFFSET(response), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, VF },
{ "channel", "set IR channel to display frequency response", OFFSET(ir_channel), AV_OPT_TYPE_INT, {.i64=0}, 0, 1024, VF },
{ "size", "set video size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str = "hd720"}, 0, 0, VF },
{ "rate", "set video rate", OFFSET(frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str = "25"}, 0, INT32_MAX, VF },
{ "minp", "set min partition size", OFFSET(minp), AV_OPT_TYPE_INT, {.i64=8192}, 8, 32768, AF },
{ "maxp", "set max partition size", OFFSET(maxp), AV_OPT_TYPE_INT, {.i64=8192}, 8, 32768, AF },
{ NULL }
}
#define NULL
Definition: coverity.c:32
GLsizei GLsizei * length
Definition: opengl_enc.c:114
uint8_t w
Definition: llviddspenc.c:38
offset must point to AVRational
Definition: opt.h:236
offset must point to two consecutive integers
Definition: opt.h:233
#define AF
Definition: af_afir.c:823
#define OFFSET(x)
Definition: af_afir.c:825
#define VF
Definition: af_afir.c:824

Definition at line 827 of file af_afir.c.

AVFilter ff_af_afir
Initial value:
= {
.name = "afir",
.description = NULL_IF_CONFIG_SMALL("Apply Finite Impulse Response filter with supplied coefficients in 2nd stream."),
.priv_size = sizeof(AudioFIRContext),
.priv_class = &afir_class,
.init = init,
}
static av_cold int init(AVFilterContext *ctx)
Definition: af_afir.c:764
static av_cold void uninit(AVFilterContext *ctx)
Definition: af_afir.c:721
#define AVFILTER_FLAG_DYNAMIC_OUTPUTS
The number of the filter outputs is not determined just by AVFilter.outputs.
Definition: avfilter.h:111
static const AVFilterPad afir_inputs[]
Definition: af_afir.c:812
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:186
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
Definition: avfilter.h:116
static int query_formats(AVFilterContext *ctx)
Definition: af_afir.c:620
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several inputs
#define flags(name, subs,...)
Definition: cbs_av1.c:561
static int activate(AVFilterContext *ctx)
Definition: af_afir.c:535

Definition at line 852 of file af_afir.c.