FFmpeg
Data Structures | Macros | Functions | Variables
af_aiir.c File Reference
#include <float.h>
#include "libavutil/avstring.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "libavutil/xga_font_data.h"
#include "audio.h"
#include "avfilter.h"
#include "formats.h"
#include "internal.h"
#include "video.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 PARALLEL_IIR_CH(name, type, min, max, need_clipping)
 
#define LATTICE_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 cmul (double re, double im, double re2, double im2, double *RE, double *IM)
 
static int expand (AVFilterContext *ctx, double *pz, int n, double *coefs)
 
static void normalize_coeffs (AVFilterContext *ctx, int ch)
 
static int convert_zp2tf (AVFilterContext *ctx, int channels)
 
static int decompose_zp2biquads (AVFilterContext *ctx, int channels)
 
static void biquad_process (double *x, double *y, int length, double b0, double b1, double b2, double a1, double a2)
 
static void solve (double *matrix, double *vector, int n, double *y, double *x, double *lu)
 
static int convert_serial2parallel (AVFilterContext *ctx, int channels)
 
static void convert_pr2zp (AVFilterContext *ctx, int channels)
 
static void convert_sp2zp (AVFilterContext *ctx, int channels)
 
static double fact (double i)
 
static double coef_sf2zf (double *a, int N, int n)
 
static void convert_sf2tf (AVFilterContext *ctx, int channels)
 
static void convert_pd2zp (AVFilterContext *ctx, int channels)
 
static void check_stability (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 double distance (double x0, double x1, double y0, double y1)
 
static void get_response (int channel, int format, double w, const double *b, const double *a, int nb_b, int nb_a, double *magnitude, double *phase)
 
static void draw_response (AVFilterContext *ctx, AVFrame *out, int sample_rate)
 
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 *const format [] = { "%lf", "%lf %lfi", "%lf %lfr", "%lf %lfd", "%lf %lfi" }
 
static const AVFilterPad inputs []
 
static const AVOption aiir_options []
 
const AVFilter ff_af_aiir
 

Macro Definition Documentation

◆ IIR_CH

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

Definition at line 115 of file af_aiir.c.

◆ SERIAL_IIR_CH

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

Definition at line 171 of file af_aiir.c.

◆ PARALLEL_IIR_CH

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

Definition at line 230 of file af_aiir.c.

◆ LATTICE_IIR_CH

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

Definition at line 294 of file af_aiir.c.

◆ OFFSET

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

Definition at line 1526 of file af_aiir.c.

◆ AF

Definition at line 1527 of file af_aiir.c.

◆ VF

Definition at line 1528 of file af_aiir.c.

Function Documentation

◆ query_formats()

static int query_formats ( AVFilterContext ctx)
static

Definition at line 81 of file af_aiir.c.

◆ count_coefficients()

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

Definition at line 351 of file af_aiir.c.

Referenced by read_channels().

◆ read_gains()

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

Definition at line 365 of file af_aiir.c.

Referenced by config_output().

◆ read_tf_coefficients()

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

Definition at line 398 of file af_aiir.c.

Referenced by read_channels().

◆ read_zp_coefficients()

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

Definition at line 423 of file af_aiir.c.

Referenced by read_channels().

◆ read_channels()

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

Definition at line 450 of file af_aiir.c.

Referenced by config_output().

◆ cmul()

static void cmul ( double  re,
double  im,
double  re2,
double  im2,
double RE,
double IM 
)
static

Definition at line 497 of file af_aiir.c.

Referenced by expand().

◆ expand()

static int expand ( AVFilterContext ctx,
double pz,
int  n,
double coefs 
)
static

Definition at line 503 of file af_aiir.c.

Referenced by convert_zp2tf(), and decompose_zp2biquads().

◆ normalize_coeffs()

static void normalize_coeffs ( AVFilterContext ctx,
int  ch 
)
static

Definition at line 530 of file af_aiir.c.

Referenced by config_output(), and convert_zp2tf().

◆ convert_zp2tf()

static int convert_zp2tf ( AVFilterContext ctx,
int  channels 
)
static

Definition at line 558 of file af_aiir.c.

Referenced by config_output().

◆ decompose_zp2biquads()

static int decompose_zp2biquads ( AVFilterContext ctx,
int  channels 
)
static

Definition at line 606 of file af_aiir.c.

Referenced by config_output().

◆ biquad_process()

static void biquad_process ( double x,
double y,
int  length,
double  b0,
double  b1,
double  b2,
double  a1,
double  a2 
)
static

Definition at line 768 of file af_aiir.c.

Referenced by convert_serial2parallel().

◆ solve()

static void solve ( double matrix,
double vector,
int  n,
double y,
double x,
double lu 
)
static

Definition at line 786 of file af_aiir.c.

Referenced by convert_serial2parallel().

◆ convert_serial2parallel()

static int convert_serial2parallel ( AVFilterContext ctx,
int  channels 
)
static

Definition at line 820 of file af_aiir.c.

Referenced by config_output().

◆ convert_pr2zp()

static void convert_pr2zp ( AVFilterContext ctx,
int  channels 
)
static

Definition at line 890 of file af_aiir.c.

Referenced by config_output().

◆ convert_sp2zp()

static void convert_sp2zp ( AVFilterContext ctx,
int  channels 
)
static

Definition at line 917 of file af_aiir.c.

Referenced by config_output().

◆ fact()

static double fact ( double  i)
static

◆ coef_sf2zf()

static double coef_sf2zf ( double a,
int  N,
int  n 
)
static

Definition at line 951 of file af_aiir.c.

Referenced by convert_sf2tf().

◆ convert_sf2tf()

static void convert_sf2tf ( AVFilterContext ctx,
int  channels 
)
static

Definition at line 970 of file af_aiir.c.

Referenced by config_output().

◆ convert_pd2zp()

static void convert_pd2zp ( AVFilterContext ctx,
int  channels 
)
static

Definition at line 998 of file af_aiir.c.

Referenced by config_output().

◆ check_stability()

static void check_stability ( AVFilterContext ctx,
int  channels 
)
static

Definition at line 1025 of file af_aiir.c.

Referenced by config_output().

◆ drawtext()

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

Definition at line 1044 of file af_aiir.c.

Referenced by draw_response().

◆ draw_line()

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

Definition at line 1067 of file af_aiir.c.

Referenced by draw_response().

◆ distance()

static double distance ( double  x0,
double  x1,
double  y0,
double  y1 
)
static

Definition at line 1093 of file af_aiir.c.

Referenced by decompose_zp2biquads(), and get_response().

◆ get_response()

static void get_response ( int  channel,
int  format,
double  w,
const double b,
const double a,
int  nb_b,
int  nb_a,
double magnitude,
double phase 
)
static

Definition at line 1098 of file af_aiir.c.

Referenced by draw_response().

◆ draw_response()

static void draw_response ( AVFilterContext ctx,
AVFrame out,
int  sample_rate 
)
static

Definition at line 1145 of file af_aiir.c.

Referenced by config_output().

◆ config_output()

static int config_output ( AVFilterLink outlink)
static

Definition at line 1262 of file af_aiir.c.

Referenced by init().

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 1385 of file af_aiir.c.

◆ config_video()

static int config_video ( AVFilterLink outlink)
static

Definition at line 1440 of file af_aiir.c.

Referenced by init().

◆ init()

static av_cold int init ( AVFilterContext ctx)
static

Definition at line 1454 of file af_aiir.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 1498 of file af_aiir.c.

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( aiir  )

Variable Documentation

◆ format

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

Definition at line 448 of file af_aiir.c.

Referenced by get_response(), read_channels(), and read_zp_coefficients().

◆ inputs

const AVFilterPad inputs[]
static
Initial value:
= {
{
.name = "default",
.filter_frame = filter_frame,
},
}

Definition at line 1518 of file af_aiir.c.

◆ aiir_options

const AVOption aiir_options[]
static

Definition at line 1530 of file af_aiir.c.

◆ ff_af_aiir

const 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,
}

Definition at line 1571 of file af_aiir.c.

inputs
static const AVFilterPad inputs[]
Definition: af_aiir.c:1518
FILTER_QUERY_FUNC
#define FILTER_QUERY_FUNC(func)
Definition: internal.h:159
query_formats
static int query_formats(AVFilterContext *ctx)
Definition: af_aiir.c:81
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: af_aiir.c:1385
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:182
init
static av_cold int init(AVFilterContext *ctx)
Definition: af_aiir.c:1454
AVFILTER_FLAG_DYNAMIC_OUTPUTS
#define AVFILTER_FLAG_DYNAMIC_OUTPUTS
The number of the filter outputs is not determined just by AVFilter.outputs.
Definition: avfilter.h:112
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:94
AVFILTER_FLAG_SLICE_THREADS
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
Definition: avfilter.h:117
AudioIIRContext
Definition: af_aiir.c:58
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: af_aiir.c:1498