FFmpeg
Loading...
Searching...
No Matches
af_asoftclip.c File Reference
#include "libavutil/avassert.h"
#include "libavutil/channel_layout.h"
#include "libavutil/opt.h"
#include "avfilter.h"
#include "audio.h"
#include "filters.h"

Go to the source code of this file.

Data Structures

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

Macros

#define MAX_OVERSAMPLE   64
 
#define OFFSET(x)
 
#define A   AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_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 void get_lowpass (Lowpass *s, double frequency, double sample_rate)
 
static float run_lowpassf (const Lowpass *const s, float src, float *w)
 
static void filter_flt (ASoftClipContext *s, void **dptr, const void **sptr, int nb_samples, int channels, int start, int end)
 
static double run_lowpassd (const Lowpass *const s, double src, double *w)
 
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 []
 
const FFFilter ff_af_asoftclip
 

Macro Definition Documentation

◆ MAX_OVERSAMPLE

#define MAX_OVERSAMPLE   64

Definition at line 28 of file af_asoftclip.c.

Referenced by config_input().

◆ OFFSET

#define OFFSET ( x)
Value:

Definition at line 68 of file af_asoftclip.c.

◆ A

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 30 of file af_asoftclip.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( asoftclip )

◆ get_lowpass()

static void get_lowpass ( Lowpass * s,
double frequency,
double sample_rate )
static

Definition at line 91 of file af_asoftclip.c.

Referenced by config_input().

◆ run_lowpassf()

static float run_lowpassf ( const Lowpass *const s,
float src,
float * w )
inlinestatic

Definition at line 126 of file af_asoftclip.c.

Referenced by filter_flt().

◆ 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 138 of file af_asoftclip.c.

◆ run_lowpassd()

static double run_lowpassd ( const Lowpass *const s,
double src,
double * w )
inlinestatic

Definition at line 251 of file af_asoftclip.c.

Referenced by filter_dbl().

◆ 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 263 of file af_asoftclip.c.

◆ config_input()

static int config_input ( AVFilterLink * inlink)
static

Definition at line 376 of file af_asoftclip.c.

◆ filter_channels()

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

Definition at line 405 of file af_asoftclip.c.

◆ filter_frame()

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

Definition at line 422 of file af_asoftclip.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext * ctx)
static

Definition at line 459 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, .unit = "types" },
{ "hard", NULL, 0, AV_OPT_TYPE_CONST, {.i64=ASC_HARD}, 0, 0, A, .unit = "types" },
{ "tanh", NULL, 0, AV_OPT_TYPE_CONST, {.i64=ASC_TANH}, 0, 0, A, .unit = "types" },
{ "atan", NULL, 0, AV_OPT_TYPE_CONST, {.i64=ASC_ATAN}, 0, 0, A, .unit = "types" },
{ "cubic", NULL, 0, AV_OPT_TYPE_CONST, {.i64=ASC_CUBIC}, 0, 0, A, .unit = "types" },
{ "exp", NULL, 0, AV_OPT_TYPE_CONST, {.i64=ASC_EXP}, 0, 0, A, .unit = "types" },
{ "alg", NULL, 0, AV_OPT_TYPE_CONST, {.i64=ASC_ALG}, 0, 0, A, .unit = "types" },
{ "quintic", NULL, 0, AV_OPT_TYPE_CONST, {.i64=ASC_QUINTIC},0, 0, A, .unit = "types" },
{ "sin", NULL, 0, AV_OPT_TYPE_CONST, {.i64=ASC_SIN}, 0, 0, A, .unit = "types" },
{ "erf", NULL, 0, AV_OPT_TYPE_CONST, {.i64=ASC_ERF}, 0, 0, A, .unit = "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, MAX_OVERSAMPLE, A },
{ NULL }
}
@ NB_TYPES
Definition af_adenorm.c:31
#define MAX_OVERSAMPLE
@ ASC_HARD
@ ASC_ALG
@ ASC_SIN
@ ASC_TANH
@ ASC_ATAN
@ ASC_ERF
@ ASC_CUBIC
@ ASC_EXP
@ ASC_QUINTIC
#define A(x)
Definition vpx_arith.h:28
#define NULL
Definition coverity.c:32
#define OFFSET(x)
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition opt.h:298
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition opt.h:258
@ AV_OPT_TYPE_DOUBLE
Underlying C type is double.
Definition opt.h:266
cl_device_type type

Definition at line 71 of file af_asoftclip.c.

◆ inputs

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

Definition at line 467 of file af_asoftclip.c.

◆ ff_af_asoftclip

const FFFilter ff_af_asoftclip
Initial value:
= {
.p.name = "asoftclip",
.p.description = NULL_IF_CONFIG_SMALL("Audio Soft Clipper."),
.p.priv_class = &asoftclip_class,
.priv_size = sizeof(ASoftClipContext),
.uninit = uninit,
.process_command = ff_filter_process_command,
}
static const AVFilterPad inputs[]
Definition af_aap.c:299
const AVFilterPad ff_audio_default_filterpad[1]
An AVFilterPad array whose only entry has name "default" and is of type AVMEDIA_TYPE_AUDIO.
Definition audio.c:34
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:906
#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:196
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
Definition avfilter.h:166
@ AV_SAMPLE_FMT_FLTP
float, planar
Definition samplefmt.h:66
@ AV_SAMPLE_FMT_DBLP
double, planar
Definition samplefmt.h:67
static av_cold void uninit(AVBitStreamFilterContext *ctx)
#define FILTER_INPUTS(array)
Definition filters.h:264
#define FILTER_OUTPUTS(array)
Definition filters.h:265
#define FILTER_SAMPLEFMTS(...)
Definition filters.h:252
#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 476 of file af_asoftclip.c.