FFmpeg
Data Structures | Macros | Functions | Variables
af_aderivative.c File Reference
#include "libavutil/opt.h"
#include "audio.h"
#include "avfilter.h"
#include "internal.h"

Go to the source code of this file.

Data Structures

struct  ADerivativeContext
 

Macros

#define DERIVATIVE(name, type)
 
#define INTEGRAL(name, type)
 

Functions

static int config_input (AVFilterLink *inlink)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *in)
 
static av_cold void uninit (AVFilterContext *ctx)
 
 AVFILTER_DEFINE_CLASS_EXT (aderivative, "aderivative/aintegral", aderivative_options)
 

Variables

static const AVFilterPad aderivative_inputs []
 
static const AVFilterPad aderivative_outputs []
 
static const AVOption aderivative_options []
 
const AVFilter ff_af_aderivative
 
const AVFilter ff_af_aintegral
 

Macro Definition Documentation

◆ DERIVATIVE

#define DERIVATIVE (   name,
  type 
)
Value:
static void aderivative_## name ##p(void **d, void **p, const void **s, \
int nb_samples, int channels) \
{ \
int n, c; \
for (c = 0; c < channels; c++) { \
const type *src = s[c]; \
type *dst = d[c]; \
type *prv = p[c]; \
for (n = 0; n < nb_samples; n++) { \
const type current = src[n]; \
\
dst[n] = current - prv[0]; \
prv[0] = current; \
} \
} \
}

Definition at line 31 of file af_aderivative.c.

◆ INTEGRAL

#define INTEGRAL (   name,
  type 
)
Value:
static void aintegral_## name ##p(void **d, void **p, const void **s, \
int nb_samples, int channels) \
{ \
int n, c; \
for (c = 0; c < channels; c++) { \
const type *src = s[c]; \
type *dst = d[c]; \
type *prv = p[c]; \
for (n = 0; n < nb_samples; n++) { \
const type current = src[n]; \
\
dst[n] = current + prv[0]; \
prv[0] = dst[n]; \
} \
} \
}

Definition at line 56 of file af_aderivative.c.

Function Documentation

◆ config_input()

static int config_input ( AVFilterLink inlink)
static

Definition at line 79 of file af_aderivative.c.

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 102 of file af_aderivative.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 140 of file af_aderivative.c.

◆ AVFILTER_DEFINE_CLASS_EXT()

AVFILTER_DEFINE_CLASS_EXT ( aderivative  ,
"aderivative/aintegral"  ,
aderivative_options   
)

Variable Documentation

◆ aderivative_inputs

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

Definition at line 147 of file af_aderivative.c.

◆ aderivative_outputs

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

Definition at line 156 of file af_aderivative.c.

◆ aderivative_options

const AVOption aderivative_options[]
static
Initial value:
= {
{ NULL }
}

Definition at line 163 of file af_aderivative.c.

◆ ff_af_aderivative

const AVFilter ff_af_aderivative
Initial value:
= {
.name = "aderivative",
.description = NULL_IF_CONFIG_SMALL("Compute derivative of input audio."),
.priv_size = sizeof(ADerivativeContext),
.priv_class = &aderivative_class,
}

Definition at line 169 of file af_aderivative.c.

◆ ff_af_aintegral

const AVFilter ff_af_aintegral
Initial value:
= {
.name = "aintegral",
.description = NULL_IF_CONFIG_SMALL("Compute integral of input audio."),
.priv_size = sizeof(ADerivativeContext),
.priv_class = &aderivative_class,
}

Definition at line 182 of file af_aderivative.c.

AV_SAMPLE_FMT_FLTP
@ AV_SAMPLE_FMT_FLTP
float, planar
Definition: samplefmt.h:66
name
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 default minimum maximum flags name is the option name
Definition: writing_filters.txt:88
AV_SAMPLE_FMT_S32P
@ AV_SAMPLE_FMT_S32P
signed 32 bits, planar
Definition: samplefmt.h:65
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
aderivative_inputs
static const AVFilterPad aderivative_inputs[]
Definition: af_aderivative.c:147
s
#define s(width, name)
Definition: cbs_vp9.c:256
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: af_aderivative.c:102
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
config_input
static int config_input(AVFilterLink *inlink)
Definition: af_aderivative.c:79
channels
channels
Definition: aptx.h:31
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:194
NULL
#define NULL
Definition: coverity.c:32
c
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
Definition: undefined.txt:32
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:115
for
for(k=2;k<=8;++k)
Definition: h264pred_template.c:425
AV_SAMPLE_FMT_S16P
@ AV_SAMPLE_FMT_S16P
signed 16 bits, planar
Definition: samplefmt.h:64
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: af_aderivative.c:140
AV_SAMPLE_FMT_DBLP
@ AV_SAMPLE_FMT_DBLP
double, planar
Definition: samplefmt.h:67
aderivative_outputs
static const AVFilterPad aderivative_outputs[]
Definition: af_aderivative.c:156
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:195
src
INIT_CLIP pixel * src
Definition: h264pred_template.c:418
d
d
Definition: ffmpeg_filter.c:156
AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL
#define AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL
Same as AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, except that the filter will have its filter_frame() c...
Definition: avfilter.h:150
ADerivativeContext
Definition: af_aderivative.c:24
FILTER_SAMPLEFMTS
#define FILTER_SAMPLEFMTS(...)
Definition: internal.h:182