FFmpeg
Data Structures | Macros | Functions | Variables
af_aiir.c File Reference
#include <float.h>
#include "libavutil/avassert.h"
#include "libavutil/avstring.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/opt.h"
#include "libavutil/xga_font_data.h"
#include "audio.h"
#include "avfilter.h"
#include "internal.h"

Go to the source code of this file.

Data Structures

struct  ThreadData
 Used for passing data between threads. More...
 
struct  Pair
 
struct  BiquadContext
 
struct  IIRChannel
 
struct  AudioIIRContext
 

Macros

#define IIR_CH(name, type, min, max, need_clipping)
 
#define SERIAL_IIR_CH(name, type, min, max, need_clipping)
 
#define OFFSET(x)   offsetof(AudioIIRContext, x)
 
#define AF   AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
 
#define VF   AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
 

Functions

static int query_formats (AVFilterContext *ctx)
 
static void count_coefficients (char *item_str, int *nb_items)
 
static int read_gains (AVFilterContext *ctx, char *item_str, int nb_items)
 
static int read_tf_coefficients (AVFilterContext *ctx, char *item_str, int nb_items, double *dst)
 
static int read_zp_coefficients (AVFilterContext *ctx, char *item_str, int nb_items, double *dst, const char *format)
 
static int read_channels (AVFilterContext *ctx, int channels, uint8_t *item_str, int ab)
 
static void multiply (double wre, double wim, int npz, double *coeffs)
 
static int expand (AVFilterContext *ctx, double *pz, int nb, double *coeffs)
 
static int convert_zp2tf (AVFilterContext *ctx, int channels)
 
static int decompose_zp2biquads (AVFilterContext *ctx, int channels)
 
static void convert_pr2zp (AVFilterContext *ctx, int channels)
 
static void convert_pd2zp (AVFilterContext *ctx, int channels)
 
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 config_output (AVFilterLink *outlink)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *in)
 
static int config_video (AVFilterLink *outlink)
 
static av_cold int init (AVFilterContext *ctx)
 
static av_cold void uninit (AVFilterContext *ctx)
 
 AVFILTER_DEFINE_CLASS (aiir)
 

Variables

static const char * format [] = { "%lf", "%lf %lfi", "%lf %lfr", "%lf %lfd" }
 
static const AVFilterPad inputs []
 
static const AVOption aiir_options []
 
AVFilter ff_af_aiir
 

Macro Definition Documentation

#define IIR_CH (   name,
  type,
  min,
  max,
  need_clipping 
)

Definition at line 122 of file af_aiir.c.

#define SERIAL_IIR_CH (   name,
  type,
  min,
  max,
  need_clipping 
)

Definition at line 178 of file af_aiir.c.

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

Definition at line 1088 of file af_aiir.c.

Definition at line 1089 of file af_aiir.c.

Definition at line 1090 of file af_aiir.c.

Function Documentation

static int query_formats ( AVFilterContext ctx)
static

Definition at line 78 of file af_aiir.c.

static void count_coefficients ( char *  item_str,
int nb_items 
)
static

Definition at line 241 of file af_aiir.c.

Referenced by read_channels().

static int read_gains ( AVFilterContext ctx,
char *  item_str,
int  nb_items 
)
static

Definition at line 255 of file af_aiir.c.

Referenced by config_output().

static int read_tf_coefficients ( AVFilterContext ctx,
char *  item_str,
int  nb_items,
double *  dst 
)
static

Definition at line 288 of file af_aiir.c.

Referenced by read_channels().

static int read_zp_coefficients ( AVFilterContext ctx,
char *  item_str,
int  nb_items,
double *  dst,
const char *  format 
)
static

Definition at line 313 of file af_aiir.c.

Referenced by read_channels().

static int read_channels ( AVFilterContext ctx,
int  channels,
uint8_t item_str,
int  ab 
)
static

Definition at line 340 of file af_aiir.c.

Referenced by config_output().

static void multiply ( double  wre,
double  wim,
int  npz,
double *  coeffs 
)
static

Definition at line 387 of file af_aiir.c.

Referenced by expand().

static int expand ( AVFilterContext ctx,
double *  pz,
int  nb,
double *  coeffs 
)
static

Definition at line 407 of file af_aiir.c.

Referenced by convert_zp2tf(), and decompose_zp2biquads().

static int convert_zp2tf ( AVFilterContext ctx,
int  channels 
)
static

Definition at line 433 of file af_aiir.c.

Referenced by config_output().

static int decompose_zp2biquads ( AVFilterContext ctx,
int  channels 
)
static

Definition at line 479 of file af_aiir.c.

Referenced by config_output().

static void convert_pr2zp ( AVFilterContext ctx,
int  channels 
)
static

Definition at line 618 of file af_aiir.c.

Referenced by config_output().

static void convert_pd2zp ( AVFilterContext ctx,
int  channels 
)
static

Definition at line 645 of file af_aiir.c.

Referenced by config_output().

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

Definition at line 672 of file af_aiir.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 695 of file af_aiir.c.

Referenced by draw_response().

static void draw_response ( AVFilterContext ctx,
AVFrame out 
)
static

Definition at line 721 of file af_aiir.c.

Referenced by config_output().

static int config_output ( AVFilterLink outlink)
static

Definition at line 859 of file af_aiir.c.

Referenced by init().

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 941 of file af_aiir.c.

static int config_video ( AVFilterLink outlink)
static

Definition at line 991 of file af_aiir.c.

Referenced by init().

static av_cold int init ( AVFilterContext ctx)
static

Definition at line 1005 of file af_aiir.c.

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 1056 of file af_aiir.c.

AVFILTER_DEFINE_CLASS ( aiir  )

Variable Documentation

const char* format[] = { "%lf", "%lf %lfi", "%lf %lfr", "%lf %lfd" }
static

Definition at line 338 of file af_aiir.c.

const AVFilterPad inputs[]
static
Initial value:
= {
{
.name = "default",
.filter_frame = filter_frame,
},
{ NULL }
}
#define NULL
Definition: coverity.c:32
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: af_aiir.c:941

Definition at line 1079 of file af_aiir.c.

const AVOption aiir_options[]
static
Initial value:
= {
{ "z", "set B/numerator/zeros coefficients", OFFSET(b_str), AV_OPT_TYPE_STRING, {.str="1+0i 1-0i"}, 0, 0, AF },
{ "p", "set A/denominator/poles coefficients", OFFSET(a_str), AV_OPT_TYPE_STRING, {.str="1+0i 1-0i"}, 0, 0, AF },
{ "k", "set channels gains", OFFSET(g_str), AV_OPT_TYPE_STRING, {.str="1|1"}, 0, 0, AF },
{ "dry", "set dry gain", OFFSET(dry_gain), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0, 1, AF },
{ "wet", "set wet gain", OFFSET(wet_gain), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0, 1, AF },
{ "f", "set coefficients format", OFFSET(format), AV_OPT_TYPE_INT, {.i64=1}, 0, 3, AF, "format" },
{ "tf", "transfer function", 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, AF, "format" },
{ "zp", "Z-plane zeros/poles", 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, AF, "format" },
{ "pr", "Z-plane zeros/poles (polar radians)", 0, AV_OPT_TYPE_CONST, {.i64=2}, 0, 0, AF, "format" },
{ "pd", "Z-plane zeros/poles (polar degrees)", 0, AV_OPT_TYPE_CONST, {.i64=3}, 0, 0, AF, "format" },
{ "r", "set kind of processing", OFFSET(process), AV_OPT_TYPE_INT, {.i64=1}, 0, 1, AF, "process" },
{ "d", "direct", 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, AF, "process" },
{ "s", "serial cascading", 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, AF, "process" },
{ "e", "set precision", OFFSET(precision),AV_OPT_TYPE_INT, {.i64=0}, 0, 3, AF, "precision" },
{ "dbl", "double-precision floating-point", 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, AF, "precision" },
{ "flt", "single-precision floating-point", 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, AF, "precision" },
{ "i32", "32-bit integers", 0, AV_OPT_TYPE_CONST, {.i64=2}, 0, 0, AF, "precision" },
{ "i16", "16-bit integers", 0, AV_OPT_TYPE_CONST, {.i64=3}, 0, 0, AF, "precision" },
{ "mix", "set mix", OFFSET(mix), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0, 1, 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(rate), AV_OPT_TYPE_VIDEO_RATE, {.str = "25"}, 0, INT32_MAX, VF },
{ NULL },
}
#define NULL
Definition: coverity.c:32
static const char * format[]
Definition: af_aiir.c:338
static int process(struct ResampleContext *c, AudioData *dst, int dst_size, AudioData *src, int src_size, int *consumed)
Definition: soxr_resample.c:84
#define AF
Definition: af_aiir.c:1089
uint8_t w
Definition: llviddspenc.c:38
#define VF
Definition: af_aiir.c:1090
static int mix(int c0, int c1)
Definition: 4xm.c:714
offset must point to AVRational
Definition: opt.h:236
offset must point to two consecutive integers
Definition: opt.h:233
#define OFFSET(x)
Definition: af_aiir.c:1088

Definition at line 1092 of file af_aiir.c.

AVFilter ff_af_aiir
Initial value:
= {
.name = "aiir",
.description = NULL_IF_CONFIG_SMALL("Apply Infinite Impulse Response filter with supplied coefficients."),
.priv_size = sizeof(AudioIIRContext),
.priv_class = &aiir_class,
.init = init,
}
static av_cold int init(AVFilterContext *ctx)
Definition: af_aiir.c:1005
#define AVFILTER_FLAG_DYNAMIC_OUTPUTS
The number of the filter outputs is not determined just by AVFilter.outputs.
Definition: avfilter.h:111
static int query_formats(AVFilterContext *ctx)
Definition: af_aiir.c:78
#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 av_cold void uninit(AVFilterContext *ctx)
Definition: af_aiir.c:1056
static const AVFilterPad inputs[]
Definition: af_aiir.c:1079
#define flags(name, subs,...)
Definition: cbs_av1.c:561

Definition at line 1121 of file af_aiir.c.