FFmpeg
Data Structures | Macros | Enumerations | Functions | Variables
af_asoftclip.c File Reference
#include "libavutil/avassert.h"
#include "libavutil/channel_layout.h"
#include "libavutil/opt.h"
#include "libswresample/swresample.h"
#include "avfilter.h"
#include "audio.h"
#include "formats.h"

Go to the source code of this file.

Data Structures

struct  ASoftClipContext
 
struct  ThreadData
 Used for passing data between threads. More...
 

Macros

#define OFFSET(x)   offsetof(ASoftClipContext, x)
 
#define A   AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
 
#define F   AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
 

Enumerations

enum  ASoftClipTypes {
  ASC_HARD = -1, ASC_TANH, ASC_ATAN, ASC_CUBIC,
  ASC_EXP, ASC_ALG, ASC_QUINTIC, ASC_SIN,
  ASC_ERF, NB_TYPES
}
 

Functions

 AVFILTER_DEFINE_CLASS (asoftclip)
 
static int query_formats (AVFilterContext *ctx)
 
static void filter_flt (ASoftClipContext *s, void **dptr, const void **sptr, int nb_samples, int channels, int start, int end)
 
static void filter_dbl (ASoftClipContext *s, void **dptr, const void **sptr, int nb_samples, int channels, int start, int end)
 
static int config_input (AVFilterLink *inlink)
 
static int filter_channels (AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *in)
 
static av_cold void uninit (AVFilterContext *ctx)
 

Variables

static const AVOption asoftclip_options []
 
static const AVFilterPad inputs []
 
static const AVFilterPad outputs []
 
const AVFilter ff_af_asoftclip
 

Macro Definition Documentation

◆ OFFSET

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

Definition at line 61 of file af_asoftclip.c.

◆ A

Definition at line 62 of file af_asoftclip.c.

◆ F

Definition at line 63 of file af_asoftclip.c.

Enumeration Type Documentation

◆ ASoftClipTypes

Enumerator
ASC_HARD 
ASC_TANH 
ASC_ATAN 
ASC_CUBIC 
ASC_EXP 
ASC_ALG 
ASC_QUINTIC 
ASC_SIN 
ASC_ERF 
NB_TYPES 

Definition at line 29 of file af_asoftclip.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( asoftclip  )

◆ query_formats()

static int query_formats ( AVFilterContext ctx)
static

Definition at line 85 of file af_asoftclip.c.

◆ filter_flt()

static void filter_flt ( ASoftClipContext s,
void **  dptr,
const void **  sptr,
int  nb_samples,
int  channels,
int  start,
int  end 
)
static

Definition at line 115 of file af_asoftclip.c.

Referenced by config_input().

◆ filter_dbl()

static void filter_dbl ( ASoftClipContext s,
void **  dptr,
const void **  sptr,
int  nb_samples,
int  channels,
int  start,
int  end 
)
static

Definition at line 207 of file af_asoftclip.c.

Referenced by config_input().

◆ config_input()

static int config_input ( AVFilterLink inlink)
static

Definition at line 299 of file af_asoftclip.c.

◆ filter_channels()

static int filter_channels ( AVFilterContext ctx,
void *  arg,
int  jobnr,
int  nb_jobs 
)
static

Definition at line 354 of file af_asoftclip.c.

Referenced by filter_frame().

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 371 of file af_asoftclip.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 451 of file af_asoftclip.c.

Variable Documentation

◆ asoftclip_options

const AVOption asoftclip_options[]
static
Initial value:
= {
{ "type", "set softclip type", OFFSET(type), AV_OPT_TYPE_INT, {.i64=0}, -1, NB_TYPES-1, A, "types" },
{ "hard", NULL, 0, AV_OPT_TYPE_CONST, {.i64=ASC_HARD}, 0, 0, A, "types" },
{ "tanh", NULL, 0, AV_OPT_TYPE_CONST, {.i64=ASC_TANH}, 0, 0, A, "types" },
{ "atan", NULL, 0, AV_OPT_TYPE_CONST, {.i64=ASC_ATAN}, 0, 0, A, "types" },
{ "cubic", NULL, 0, AV_OPT_TYPE_CONST, {.i64=ASC_CUBIC}, 0, 0, A, "types" },
{ "exp", NULL, 0, AV_OPT_TYPE_CONST, {.i64=ASC_EXP}, 0, 0, A, "types" },
{ "alg", NULL, 0, AV_OPT_TYPE_CONST, {.i64=ASC_ALG}, 0, 0, A, "types" },
{ "quintic", NULL, 0, AV_OPT_TYPE_CONST, {.i64=ASC_QUINTIC},0, 0, A, "types" },
{ "sin", NULL, 0, AV_OPT_TYPE_CONST, {.i64=ASC_SIN}, 0, 0, A, "types" },
{ "erf", NULL, 0, AV_OPT_TYPE_CONST, {.i64=ASC_ERF}, 0, 0, A, "types" },
{ "threshold", "set softclip threshold", OFFSET(threshold), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0.000001, 1, A },
{ "output", "set softclip output gain", OFFSET(output), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0.000001, 16, A },
{ "param", "set softclip parameter", OFFSET(param), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0.01, 3, A },
{ "oversample", "set oversample factor", OFFSET(oversample), AV_OPT_TYPE_INT, {.i64=1}, 1, 32, F },
{ NULL }
}

Definition at line 65 of file af_asoftclip.c.

◆ inputs

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

Definition at line 459 of file af_asoftclip.c.

◆ outputs

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

Definition at line 469 of file af_asoftclip.c.

◆ ff_af_asoftclip

const AVFilter ff_af_asoftclip
Initial value:
= {
.name = "asoftclip",
.description = NULL_IF_CONFIG_SMALL("Audio Soft Clipper."),
.query_formats = query_formats,
.priv_size = sizeof(ASoftClipContext),
.priv_class = &asoftclip_class,
}

Definition at line 477 of file af_asoftclip.c.

uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: af_asoftclip.c:451
NB_TYPES
@ NB_TYPES
Definition: af_asoftclip.c:39
ASC_EXP
@ ASC_EXP
Definition: af_asoftclip.c:34
output
filter_frame For filters that do not use the this method is called when a frame is pushed to the filter s input It can be called at any time except in a reentrant way If the input frame is enough to produce output
Definition: filter_design.txt:225
config_input
static int config_input(AVFilterLink *inlink)
Definition: af_asoftclip.c:299
outputs
static const AVFilterPad outputs[]
Definition: af_asoftclip.c:469
query_formats
static int query_formats(AVFilterContext *ctx)
Definition: af_asoftclip.c:85
ASC_ALG
@ ASC_ALG
Definition: af_asoftclip.c:35
type
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
Definition: writing_filters.txt:86
ASC_TANH
@ ASC_TANH
Definition: af_asoftclip.c:31
OFFSET
#define OFFSET(x)
Definition: af_asoftclip.c:61
ASC_ATAN
@ ASC_ATAN
Definition: af_asoftclip.c:32
AV_OPT_TYPE_DOUBLE
@ AV_OPT_TYPE_DOUBLE
Definition: opt.h:227
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
ASoftClipContext
Definition: af_asoftclip.c:42
inputs
static const AVFilterPad inputs[]
Definition: af_asoftclip.c:459
NULL
#define NULL
Definition: coverity.c:32
ASC_CUBIC
@ ASC_CUBIC
Definition: af_asoftclip.c:33
A
#define A
Definition: af_asoftclip.c:62
ASC_QUINTIC
@ ASC_QUINTIC
Definition: af_asoftclip.c:36
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:117
process_command
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
Definition: af_acrusher.c:336
ff_filter_process_command
int ff_filter_process_command(AVFilterContext *ctx, const char *cmd, const char *arg, char *res, int res_len, int flags)
Generic processing of user supplied commands that are set in the same way as the filter options.
Definition: avfilter.c:842
ASC_ERF
@ ASC_ERF
Definition: af_asoftclip.c:38
ASC_SIN
@ ASC_SIN
Definition: af_asoftclip.c:37
AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
#define AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
Some filters support a generic "enable" expression option that can be used to enable or disable a fil...
Definition: avfilter.h:126
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:225
F
#define F
Definition: af_asoftclip.c:63
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
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:561
ASC_HARD
@ ASC_HARD
Definition: af_asoftclip.c:30
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: af_asoftclip.c:371
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:234