FFmpeg  4.3
Macros | Functions | Variables
af_afir.c File Reference
#include <float.h>
#include "libavutil/avstring.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 AFR   AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_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 void direct (const float *in, const FFTComplex *ir, int len, float *out)
 
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 void uninit_segment (AVFilterContext *ctx, AudioFIRSegment *seg)
 
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 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)
 
static int process_command (AVFilterContext *ctx, const char *cmd, const char *arg, char *res, int res_len, int flags)
 
 AVFILTER_DEFINE_CLASS (afir)
 

Variables

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

◆ AF

Definition at line 933 of file af_afir.c.

◆ AFR

Definition at line 934 of file af_afir.c.

◆ VF

Definition at line 935 of file af_afir.c.

◆ OFFSET

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

Definition at line 936 of file af_afir.c.

Function Documentation

◆ fcmul_add_c()

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

Definition at line 43 of file af_afir.c.

Referenced by ff_afir_init().

◆ direct()

static void direct ( const float *  in,
const FFTComplex ir,
int  len,
float *  out 
)
static

◆ fir_quantum()

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

Definition at line 67 of file af_afir.c.

Referenced by fir_channel().

◆ fir_channel()

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

Definition at line 185 of file af_afir.c.

Referenced by fir_channels().

◆ fir_channels()

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

Definition at line 196 of file af_afir.c.

Referenced by fir_frame().

◆ fir_frame()

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

Definition at line 209 of file af_afir.c.

Referenced by activate().

◆ drawtext()

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

Definition at line 236 of file af_afir.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 259 of file af_afir.c.

Referenced by draw_response().

◆ draw_response()

static void draw_response ( AVFilterContext ctx,
AVFrame out 
)
static

Definition at line 285 of file af_afir.c.

Referenced by convert_coeffs().

◆ init_segment()

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

Definition at line 374 of file af_afir.c.

Referenced by convert_coeffs().

◆ uninit_segment()

static void uninit_segment ( AVFilterContext ctx,
AudioFIRSegment seg 
)
static

Definition at line 416 of file af_afir.c.

Referenced by uninit().

◆ convert_coeffs()

static int convert_coeffs ( AVFilterContext ctx)
static

Definition at line 446 of file af_afir.c.

Referenced by activate().

◆ check_ir()

static int check_ir ( AVFilterLink link,
AVFrame frame 
)
static

Definition at line 607 of file af_afir.c.

Referenced by activate().

◆ activate()

static int activate ( AVFilterContext ctx)
static

Definition at line 623 of file af_afir.c.

◆ query_formats()

static int query_formats ( AVFilterContext ctx)
static

Definition at line 712 of file af_afir.c.

◆ config_output()

static int config_output ( AVFilterLink outlink)
static

Definition at line 767 of file af_afir.c.

Referenced by init().

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 785 of file af_afir.c.

◆ config_video()

static int config_video ( AVFilterLink outlink)
static

Definition at line 807 of file af_afir.c.

Referenced by init().

◆ ff_afir_init()

void ff_afir_init ( AudioFIRDSPContext dsp)

Definition at line 826 of file af_afir.c.

Referenced by checkasm_check_afir(), and init().

◆ init()

static av_cold int init ( AVFilterContext ctx)
static

Definition at line 834 of file af_afir.c.

◆ process_command()

static int process_command ( AVFilterContext ctx,
const char *  cmd,
const char *  arg,
char *  res,
int  res_len,
int  flags 
)
static

Definition at line 910 of file af_afir.c.

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( afir  )

Variable Documentation

◆ afir_options

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}, 1, 32768, AF },
{ "maxp", "set max partition size", OFFSET(maxp), AV_OPT_TYPE_INT, {.i64=8192}, 8, 32768, AF },
{ "nbirs", "set number of input IRs",OFFSET(nb_irs),AV_OPT_TYPE_INT, {.i64=1}, 1, 32, AF },
{ "ir", "select IR", OFFSET(selir), AV_OPT_TYPE_INT, {.i64=0}, 0, 31, AFR },
{ NULL }
}

Definition at line 938 of file af_afir.c.

◆ ff_af_afir

AVFilter ff_af_afir
Initial value:
= {
.name = "afir",
.description = NULL_IF_CONFIG_SMALL("Apply Finite Impulse Response filter with supplied coefficients in additional stream(s)."),
.priv_size = sizeof(AudioFIRContext),
.priv_class = &afir_class,
.init = init,
}

Definition at line 965 of file af_afir.c.

activate
static int activate(AVFilterContext *ctx)
Definition: af_afir.c:623
AV_OPT_TYPE_VIDEO_RATE
@ AV_OPT_TYPE_VIDEO_RATE
offset must point to AVRational
Definition: opt.h:236
VF
#define VF
Definition: af_afir.c:935
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: af_afir.c:785
AVFILTER_FLAG_DYNAMIC_INPUTS
#define AVFILTER_FLAG_DYNAMIC_INPUTS
The number of the filter inputs is not determined just by AVFilter.inputs.
Definition: avfilter.h:105
NULL
#define NULL
Definition: coverity.c:32
AV_OPT_TYPE_IMAGE_SIZE
@ AV_OPT_TYPE_IMAGE_SIZE
offset must point to two consecutive integers
Definition: opt.h:233
AFR
#define AFR
Definition: af_afir.c:934
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:111
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:186
AF
#define AF
Definition: af_afir.c:933
AV_OPT_TYPE_FLOAT
@ AV_OPT_TYPE_FLOAT
Definition: opt.h:226
query_formats
static int query_formats(AVFilterContext *ctx)
Definition: af_afir.c:712
OFFSET
#define OFFSET(x)
Definition: af_afir.c:936
w
FFmpeg Automated Testing Environment ************************************Introduction Using FATE from your FFmpeg source directory Submitting the results to the FFmpeg result aggregation server Uploading new samples to the fate suite FATE makefile targets and variables Makefile targets Makefile variables Examples Introduction **************FATE is an extended regression suite on the client side and a means for results aggregation and presentation on the server side The first part of this document explains how you can use FATE from your FFmpeg source directory to test your ffmpeg binary The second part describes how you can run FATE to submit the results to FFmpeg’s FATE server In any way you can have a look at the publicly viewable FATE results by visiting this as it can be seen if some test on some platform broke with their recent contribution This usually happens on the platforms the developers could not test on The second part of this document describes how you can run FATE to submit your results to FFmpeg’s FATE server If you want to submit your results be sure to check that your combination of OS and compiler is not already listed on the above mentioned website In the third part you can find a comprehensive listing of FATE makefile targets and variables Using FATE from your FFmpeg source directory **********************************************If you want to run FATE on your machine you need to have the samples in place You can get the samples via the build target fate rsync Use this command from the top level source this will cause FATE to fail NOTE To use a custom wrapper to run the pass ‘ target exec’ to ‘configure’ or set the TARGET_EXEC Make variable Submitting the results to the FFmpeg result aggregation server ****************************************************************To submit your results to the server you should run fate through the shell script ‘tests fate sh’ from the FFmpeg sources This script needs to be invoked with a configuration file as its first argument tests fate sh path to fate_config A configuration file template with comments describing the individual configuration variables can be found at ‘doc fate_config sh template’ Create a configuration that suits your based on the configuration template The ‘slot’ configuration variable can be any string that is not yet but it is suggested that you name it adhering to the following pattern ‘ARCH OS COMPILER COMPILER VERSION’ The configuration file itself will be sourced in a shell therefore all shell features may be used This enables you to setup the environment as you need it for your build For your first test runs the ‘fate_recv’ variable should be empty or commented out This will run everything as normal except that it will omit the submission of the results to the server The following files should be present in $workdir as specified in the configuration it may help to try out the ‘ssh’ command with one or more ‘ v’ options You should get detailed output concerning your SSH configuration and the authentication process The only thing left is to automate the execution of the fate sh script and the synchronisation of the samples directory Uploading new samples to the fate suite *****************************************If you need a sample uploaded send a mail to samples request This is for developers who have an account on the fate suite server If you upload new please make sure they are as small as space on each network bandwidth and so on benefit from smaller test cases Also keep in mind older checkouts use existing sample that means in practice generally do not remove or overwrite files as it likely would break older checkouts or releases Also all needed samples for a commit should be ideally before the push If you need an account for frequently uploading samples or you wish to help others by doing that send a mail to ffmpeg devel rsync vauL Duo ug o o w
Definition: fate.txt:150
AudioFIRContext
Definition: af_afir.h:61
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:223
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:116
init
static av_cold int init(AVFilterContext *ctx)
Definition: af_afir.c:834
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Definition: opt.h:240
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:564
process_command
static int process_command(AVFilterContext *ctx, const char *cmd, const char *arg, char *res, int res_len, int flags)
Definition: af_afir.c:910
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:232