FFmpeg
Loading...
Searching...
No Matches
af_acrusher.c File Reference
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "avfilter.h"
#include "filters.h"
#include "audio.h"

Go to the source code of this file.

Data Structures

struct  LFOContext
 
struct  SRContext
 
struct  ACrusherContext
 

Macros

#define OFFSET(x)
 
#define A   AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
 

Functions

 AVFILTER_DEFINE_CLASS (acrusher)
 
static double samplereduction (ACrusherContext *s, SRContext *sr, double in)
 
static double add_dc (double s, double dc, double idc)
 
static double remove_dc (double s, double dc, double idc)
 
static double factor (double y, double k, double aa1, double aa)
 
static double bitreduction (ACrusherContext *s, double in)
 
static double lfo_get (LFOContext *lfo)
 
static void lfo_advance (LFOContext *lfo, unsigned count)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *in)
 
static av_cold void uninit (AVFilterContext *ctx)
 
static int config_input (AVFilterLink *inlink)
 
static int process_command (AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
 

Variables

static const AVOption acrusher_options []
 
static const AVFilterPad avfilter_af_acrusher_inputs []
 
const FFFilter ff_af_acrusher
 

Macro Definition Documentation

◆ OFFSET

#define OFFSET ( x)
Value:

Definition at line 71 of file af_acrusher.c.

◆ A

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( acrusher )

◆ samplereduction()

static double samplereduction ( ACrusherContext * s,
SRContext * sr,
double in )
static

Definition at line 93 of file af_acrusher.c.

Referenced by filter_frame().

◆ add_dc()

static double add_dc ( double s,
double dc,
double idc )
static

Definition at line 109 of file af_acrusher.c.

Referenced by bitreduction().

◆ remove_dc()

static double remove_dc ( double s,
double dc,
double idc )
static

Definition at line 114 of file af_acrusher.c.

Referenced by bitreduction().

◆ factor()

static double factor ( double y,
double k,
double aa1,
double aa )
inlinestatic

Definition at line 119 of file af_acrusher.c.

◆ bitreduction()

static double bitreduction ( ACrusherContext * s,
double in )
static

Definition at line 124 of file af_acrusher.c.

Referenced by filter_frame().

◆ lfo_get()

static double lfo_get ( LFOContext * lfo)
static

Definition at line 197 of file af_acrusher.c.

Referenced by filter_frame().

◆ lfo_advance()

static void lfo_advance ( LFOContext * lfo,
unsigned count )
static

Definition at line 210 of file af_acrusher.c.

Referenced by filter_frame().

◆ filter_frame()

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

Definition at line 217 of file af_acrusher.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext * ctx)
static

Definition at line 267 of file af_acrusher.c.

◆ config_input()

static int config_input ( AVFilterLink * inlink)
static

Definition at line 274 of file af_acrusher.c.

Referenced by process_command().

◆ process_command()

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

Definition at line 307 of file af_acrusher.c.

Referenced by AVFILTER_DEFINE_CLASS_EXT(), and AVFILTER_DEFINE_CLASS_EXT().

Variable Documentation

◆ acrusher_options

const AVOption acrusher_options[]
static
Initial value:
= {
{ "level_in", "set level in", OFFSET(level_in), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0.015625, 64, A },
{ "level_out","set level out", OFFSET(level_out), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0.015625, 64, A },
{ "bits", "set bit reduction", OFFSET(bits), AV_OPT_TYPE_DOUBLE, {.dbl=8}, 1, 64, A },
{ "mix", "set mix", OFFSET(mix), AV_OPT_TYPE_DOUBLE, {.dbl=.5}, 0, 1, A },
{ "mode", "set mode", OFFSET(mode), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, A, .unit = "mode" },
{ "lin", "linear", 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, A, .unit = "mode" },
{ "log", "logarithmic", 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, A, .unit = "mode" },
{ "dc", "set DC", OFFSET(dc), AV_OPT_TYPE_DOUBLE, {.dbl=1}, .25, 4, A },
{ "aa", "set anti-aliasing", OFFSET(aa), AV_OPT_TYPE_DOUBLE, {.dbl=.5}, 0, 1, A },
{ "samples", "set sample reduction", OFFSET(samples), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 1, 250, A },
{ "lfo", "enable LFO", OFFSET(is_lfo), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, A },
{ "lforange", "set LFO depth", OFFSET(lforange), AV_OPT_TYPE_DOUBLE, {.dbl=20}, 1, 250, A },
{ "lforate", "set LFO rate", OFFSET(lforate), AV_OPT_TYPE_DOUBLE, {.dbl=.3}, .01, 200, A },
{ NULL }
}
#define A(x)
Definition vpx_arith.h:28
#define NULL
Definition coverity.c:32
mode
Use these values in ebur128_init (or'ed).
Definition ebur128.h:83
static const uint8_t bits[8]
Definition fastaudio.c:100
#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
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
Definition opt.h:326
static int mix(int c0, int c1)
Definition 4xm.c:717

Definition at line 74 of file af_acrusher.c.

◆ avfilter_af_acrusher_inputs

const AVFilterPad avfilter_af_acrusher_inputs[]
static
Initial value:
= {
{
.name = "default",
.config_props = config_input,
.filter_frame = filter_frame,
},
}
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 320 of file af_acrusher.c.

◆ ff_af_acrusher

const FFFilter ff_af_acrusher
Initial value:
= {
.p.name = "acrusher",
.p.description = NULL_IF_CONFIG_SMALL("Reduce audio bit resolution."),
.p.priv_class = &acrusher_class,
.priv_size = sizeof(ACrusherContext),
.process_command = process_command,
}
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
static const AVFilterPad avfilter_af_acrusher_inputs[]
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
#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:204
@ AV_SAMPLE_FMT_DBL
double
Definition samplefmt.h:61
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_SINGLE_SAMPLEFMT(sample_fmt_)
Definition filters.h:257
#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 329 of file af_acrusher.c.