FFmpeg
Loading...
Searching...
No Matches
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 "filters.h"
#include "formats.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)
 
#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 (const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
 
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 FFFilter ff_af_aiir
 

Macro Definition Documentation

◆ IIR_CH

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

Definition at line 111 of file af_aiir.c.

◆ SERIAL_IIR_CH

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

Definition at line 167 of file af_aiir.c.

◆ PARALLEL_IIR_CH

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

Definition at line 226 of file af_aiir.c.

◆ LATTICE_IIR_CH

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

Definition at line 290 of file af_aiir.c.

◆ OFFSET

#define OFFSET ( x)
Value:

Definition at line 1518 of file af_aiir.c.

◆ AF

Definition at line 1519 of file af_aiir.c.

◆ VF

Definition at line 1520 of file af_aiir.c.

Function Documentation

◆ query_formats()

static int query_formats ( const AVFilterContext * ctx,
AVFilterFormatsConfig ** cfg_in,
AVFilterFormatsConfig ** cfg_out )
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 347 of file af_aiir.c.

Referenced by count_coefficients(), and read_channels().

◆ read_gains()

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

Definition at line 361 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 394 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 419 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 446 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 493 of file af_aiir.c.

Referenced by expand().

◆ expand()

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

Definition at line 499 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 526 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 554 of file af_aiir.c.

Referenced by config_output().

◆ decompose_zp2biquads()

static int decompose_zp2biquads ( AVFilterContext * ctx,
int channels )
static

Definition at line 602 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 764 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 782 of file af_aiir.c.

Referenced by convert_serial2parallel().

◆ convert_serial2parallel()

static int convert_serial2parallel ( AVFilterContext * ctx,
int channels )
static

Definition at line 816 of file af_aiir.c.

Referenced by config_output().

◆ convert_pr2zp()

static void convert_pr2zp ( AVFilterContext * ctx,
int channels )
static

Definition at line 881 of file af_aiir.c.

Referenced by config_output().

◆ convert_sp2zp()

static void convert_sp2zp ( AVFilterContext * ctx,
int channels )
static

Definition at line 908 of file af_aiir.c.

Referenced by config_output().

◆ fact()

◆ coef_sf2zf()

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

Definition at line 942 of file af_aiir.c.

Referenced by convert_sf2tf().

◆ convert_sf2tf()

static void convert_sf2tf ( AVFilterContext * ctx,
int channels )
static

Definition at line 961 of file af_aiir.c.

Referenced by config_output().

◆ convert_pd2zp()

static void convert_pd2zp ( AVFilterContext * ctx,
int channels )
static

Definition at line 989 of file af_aiir.c.

Referenced by config_output().

◆ check_stability()

static void check_stability ( AVFilterContext * ctx,
int channels )
static

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

Referenced by AVFILTER_DEFINE_CLASS(), and 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 1058 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 1084 of file af_aiir.c.

Referenced by 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 1089 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 1136 of file af_aiir.c.

Referenced by config_output().

◆ config_output()

static int config_output ( AVFilterLink * outlink)
static

Definition at line 1253 of file af_aiir.c.

◆ filter_frame()

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

Definition at line 1376 of file af_aiir.c.

◆ config_video()

static int config_video ( AVFilterLink * outlink)
static

Definition at line 1431 of file af_aiir.c.

Referenced by init(), and init().

◆ init()

static av_cold int init ( AVFilterContext * ctx)
static

Definition at line 1446 of file af_aiir.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext * ctx)
static

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

Referenced by adpcm_decode_frame(), alloc_frame_empty(), alloc_plane(), amf_transfer_data_to(), av_guess_frame_rate(), av_guess_sample_aspect_ratio(), av_hwframe_ctx_create_derived(), av_sscanf(), av_sscanf(), AVFILTER_DEFINE_CLASS_EXT(), avformat_alloc_output_context2(), cairo_format_from_pix_fmt(), call_kernel(), call_kernel(), cdxl_read_packet(), config_props(), configure_output_audio_filter(), configure_video_device(), convert_axis_pixel_format(), copy_picture_field(), create(), create_frame(), cudatranspose_rotate(), cuvid_handle_video_sequence(), d3d11va_create_staging_texture(), decode_frame(), decode_frame(), DEF_CHOOSE_FORMAT(), dnxhd_decode_frame(), dump_sei_unregistered_metadata(), dxva_list_guids_debug(), ff_alloc_input_device_context(), ff_alsa_open(), ff_AMediaCodec_configure(), ff_AMediaFormat_delete(), ff_AMediaFormat_getBuffer(), ff_AMediaFormat_getFloat(), ff_AMediaFormat_getInt32(), ff_AMediaFormat_getInt64(), ff_AMediaFormat_getRect(), ff_AMediaFormat_getString(), ff_AMediaFormat_setBuffer(), ff_AMediaFormat_setFloat(), ff_AMediaFormat_setInt32(), ff_AMediaFormat_setInt64(), ff_AMediaFormat_setRect(), ff_AMediaFormat_setString(), ff_AMediaFormat_toString(), ff_draw_init(), ff_draw_init2(), ff_flv_decode_picture_header(), ff_flv_encode_picture_header(), ff_fmt_from_frame(), ff_frame_pool_audio_reinit(), ff_frame_pool_get(), ff_frame_pool_video_reinit(), ff_h263_decode_picture_header(), ff_intel_h263_decode_picture_header(), ff_lcevc_parse_frame(), ff_lcevc_parse_frame(), ff_mediacodec_dec_init(), ff_mediacodec_dec_receive(), ff_metal_texture_from_pixbuf(), ff_metal_texture_from_pixbuf(), ff_mov_read_stsd_entries(), ff_print_formatted_eval_expr(), ff_qsv_map_pixfmt(), ff_sws_test_pixfmt_backend(), ff_vk_image_create(), ff_vk_video_dpb_init(), ff_vulkan_encode_init(), ffat_update_ctx(), filter(), filter(), filter_color(), filter_color2(), filter_mono(), find_reorder_func(), format_init(), format_is_supported(), fov_from_dfov(), frame_pool_audio_init(), frame_pool_video_init(), fsb_read_header(), get_format_name(), get_ocio_depth(), get_plane_wh(), get_response(), get_sample(), get_sdl_pix_fmt_and_blendmode(), get_sindex(), decklink_frame::GetTimecode(), h261_decode_picture_header(), handle_0alpha(), handle_jpeg(), handle_xyz(), import_pem(), init_fps(), init_frame(), init_out(), init_processing_chain(), lead_decode_frame(), libdav1d_picture_allocator(), libjxl_get_pix_fmt(), libplacebo_config_output(), magy_decode_frame(), main(), MAKE_REORDER_FUNCS(), map_format(), map_format(), match_video_size(), mediacodec_dec_get_audio_codec(), mediacodec_dec_get_video_codec(), mediacodec_dec_parse_audio_format(), mediacodec_dec_parse_video_format(), mediacodec_decode_init(), mediacodec_init(), mediacodec_jni_configure(), mediacodec_ndk_configure(), mediacodec_ndk_getOutputFormat(), mediacodec_ndk_onFormatChanged(), mediacodec_set_qp_range(), mediaformat_jni_delete(), mediaformat_jni_getBuffer(), mediaformat_jni_getFloat(), mediaformat_jni_getInt32(), mediaformat_jni_getInt64(), mediaformat_jni_getString(), mediaformat_jni_new(), mediaformat_jni_newFromObject(), mediaformat_jni_setBuffer(), mediaformat_jni_setFloat(), mediaformat_jni_setInt32(), mediaformat_jni_setInt64(), mediaformat_jni_setString(), mediaformat_jni_toString(), mediaformat_ndk_create(), mediaformat_ndk_delete(), mediaformat_ndk_getBuffer(), mediaformat_ndk_getFloat(), mediaformat_ndk_getInt32(), mediaformat_ndk_getInt64(), mediaformat_ndk_getRect(), mediaformat_ndk_getString(), mediaformat_ndk_setBuffer(), mediaformat_ndk_setFloat(), mediaformat_ndk_setInt32(), mediaformat_ndk_setInt64(), mediaformat_ndk_setRect(), mediaformat_ndk_setString(), mediaformat_ndk_toString(), mkv_write_stereo_mode(), mov_codec_id(), mov_parse_stsd_data(), mov_read_frma(), mov_skip_multiple_stsd(), mpeg_set_cc_format(), nist_read_header(), oh_decode_on_stream_changed(), oh_decode_output_frame(), oh_decode_set_format(), oh_encode_on_stream_changed(), oh_encode_send_sw_frame(), oh_encode_set_format(), on_format_changed(), open_slave(), ost_add(), pix_fmt_to_mfx_fourcc(), pixfmt_in_list(), print_integers(), print_link_prop(), query_formats(), range_override_needed(), read_channels(), read_zp_coefficients(), realloc_texture(), resample_init(), reset_ptr(), separator(), set_format_info(), setup_array(), swap_sample_fmts_on_filter(), sws_test_format(), sws_test_hw_format(), test_format_legacy(), test_format_ops(), uninit(), vaapi_decode_find_best_format(), vbn_decode_frame(), vs2av_log(), vt_map_frame(), vulkan_decode_get_profile(), xv_get_tag_from_format(), and yae_reset().

◆ inputs

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

Definition at line 1510 of file af_aiir.c.

◆ aiir_options

const AVOption aiir_options[]
static

Definition at line 1522 of file af_aiir.c.

◆ ff_af_aiir

const FFFilter ff_af_aiir
Initial value:
= {
.p.name = "aiir",
.p.description = NULL_IF_CONFIG_SMALL("Apply Infinite Impulse Response filter with supplied coefficients."),
.p.priv_class = &aiir_class,
.priv_size = sizeof(AudioIIRContext),
.init = init,
}
static int query_formats(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
Definition aeval.c:246
static const AVFilterPad inputs[]
Definition af_aap.c:299
int(* init)(AVBSFContext *ctx)
Definition dts2pts.c:608
#define AVFILTER_FLAG_DYNAMIC_OUTPUTS
The number of the filter outputs is not determined just by AVFilter.outputs.
Definition avfilter.h:161
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
Definition avfilter.h:166
static av_cold void uninit(AVBitStreamFilterContext *ctx)
#define FILTER_INPUTS(array)
Definition filters.h:264
#define FILTER_QUERY_FUNC2(func)
Definition filters.h:241
#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 1563 of file af_aiir.c.