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

Go to the source code of this file.

Data Structures

struct  AudioFadeContext
 

Macros

#define OFFSET(x)   offsetof(AudioFadeContext, x)
 
#define FLAGS   AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
 
#define TFLAGS   AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
 
#define CUBE(a)   ((a)*(a)*(a))
 
#define FADE_PLANAR(name, type)
 
#define FADE(name, type)
 

Enumerations

enum  CurveType {
  NONE = -1, TRI, QSIN, ESIN,
  HSIN, LOG, IPAR, QUA,
  CUB, SQU, CBR, PAR,
  EXP, IQSIN, IHSIN, DESE,
  DESI, LOSI, SINC, ISINC,
  NB_CURVES
}
 

Functions

static double fade_gain (int curve, int64_t index, int64_t range)
 
static int config_output (AVFilterLink *outlink)
 

Variables

static enum AVSampleFormat sample_fmts []
 

Detailed Description

fade audio filter

Definition in file af_afade.c.

Macro Definition Documentation

◆ OFFSET

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

Definition at line 56 of file af_afade.c.

◆ FLAGS

Definition at line 57 of file af_afade.c.

◆ TFLAGS

Definition at line 58 of file af_afade.c.

◆ CUBE

#define CUBE (   a)    ((a)*(a)*(a))

◆ FADE_PLANAR

#define FADE_PLANAR (   name,
  type 
)
Value:
static void fade_samples_## name ##p(uint8_t **dst, uint8_t * const *src, \
int nb_samples, int channels, int dir, \
int64_t start, int64_t range, int curve) \
{ \
int i, c; \
for (i = 0; i < nb_samples; i++) { \
double gain = fade_gain(curve, start + i * dir, range); \
for (c = 0; c < channels; c++) { \
type *d = (type *)dst[c]; \
const type *s = (type *)src[c]; \
\
d[i] = s[i] * gain; \
} \
} \
}

Definition at line 146 of file af_afade.c.

◆ FADE

#define FADE (   name,
  type 
)
Value:
static void fade_samples_## name (uint8_t **dst, uint8_t * const *src, \
int nb_samples, int channels, int dir, \
int64_t start, int64_t range, int curve) \
{ \
type *d = (type *)dst[0]; \
const type *s = (type *)src[0]; \
int i, c, k = 0; \
for (i = 0; i < nb_samples; i++) { \
double gain = fade_gain(curve, start + i * dir, range); \
for (c = 0; c < channels; c++, k++) \
d[k] = s[k] * gain; \
} \
}

Definition at line 164 of file af_afade.c.

Enumeration Type Documentation

◆ CurveType

enum CurveType
Enumerator
NONE 
TRI 
QSIN 
ESIN 
HSIN 
LOG 
IPAR 
QUA 
CUB 
SQU 
CBR 
PAR 
EXP 
IQSIN 
IHSIN 
DESE 
DESI 
LOSI 
SINC 
ISINC 
NB_CURVES 

Definition at line 54 of file af_afade.c.

Function Documentation

◆ fade_gain()

static double fade_gain ( int  curve,
int64_t  index,
int64_t  range 
)
static

Definition at line 68 of file af_afade.c.

◆ config_output()

static int config_output ( AVFilterLink outlink)
static

Definition at line 190 of file af_afade.c.

Variable Documentation

◆ sample_fmts

enum AVSampleFormat sample_fmts[]
static
AV_SAMPLE_FMT_FLTP
@ AV_SAMPLE_FMT_FLTP
float, planar
Definition: samplefmt.h:69
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:68
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
s
#define s(width, name)
Definition: cbs_vp9.c:257
channels
channels
Definition: aptx.h:33
fade_gain
static double fade_gain(int curve, int64_t index, int64_t range)
Definition: af_afade.c:68
src
#define src
Definition: vp8dsp.c:255
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
for
for(j=16;j >0;--j)
Definition: h264pred_template.c:469
AV_SAMPLE_FMT_NONE
@ AV_SAMPLE_FMT_NONE
Definition: samplefmt.h:59
AV_SAMPLE_FMT_S16P
@ AV_SAMPLE_FMT_S16P
signed 16 bits, planar
Definition: samplefmt.h:67
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:271
AV_SAMPLE_FMT_S16
@ AV_SAMPLE_FMT_S16
signed 16 bits
Definition: samplefmt.h:61
AV_SAMPLE_FMT_DBLP
@ AV_SAMPLE_FMT_DBLP
double, planar
Definition: samplefmt.h:70
d
d
Definition: ffmpeg_filter.c:153
AV_SAMPLE_FMT_DBL
@ AV_SAMPLE_FMT_DBL
double
Definition: samplefmt.h:64
AV_SAMPLE_FMT_S32
@ AV_SAMPLE_FMT_S32
signed 32 bits
Definition: samplefmt.h:62
AV_SAMPLE_FMT_FLT
@ AV_SAMPLE_FMT_FLT
float
Definition: samplefmt.h:63