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

Go to the source code of this file.

Data Structures

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

Macros

#define MAX_NB_COEFFS   16
 
#define PFILTER(name, type, sin, cos, cc)
 
#define FFILTER(name, type, sin, cos, fmod, cc)
 
#define OFFSET(x)   offsetof(AFreqShift, x)
 
#define FLAGS   AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
 

Functions

static void compute_transition_param (double *K, double *Q, double transition)
 
static double ipowp (double x, int64_t n)
 
static double compute_acc_num (double q, int order, int c)
 
static double compute_acc_den (double q, int order, int c)
 
static double compute_coef (int index, double k, double q, int order)
 
static void compute_coefs (double *coef_arrd, float *coef_arrf, int nbr_coefs, double transition)
 
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)
 
 AVFILTER_DEFINE_CLASS (afreqshift)
 
 AVFILTER_DEFINE_CLASS (aphaseshift)
 

Variables

static enum AVSampleFormat sample_fmts []
 
static const AVOption afreqshift_options []
 
static const AVFilterPad inputs []
 
const AVFilter ff_af_afreqshift
 
static const AVOption aphaseshift_options []
 
const AVFilter ff_af_aphaseshift
 

Macro Definition Documentation

◆ MAX_NB_COEFFS

#define MAX_NB_COEFFS   16

Definition at line 28 of file af_afreqshift.c.

◆ PFILTER

#define PFILTER (   name,
  type,
  sin,
  cos,
  cc 
)

Definition at line 55 of file af_afreqshift.c.

◆ FFILTER

#define FFILTER (   name,
  type,
  sin,
  cos,
  fmod,
  cc 
)

Definition at line 105 of file af_afreqshift.c.

◆ OFFSET

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

Definition at line 347 of file af_afreqshift.c.

◆ FLAGS

Definition at line 348 of file af_afreqshift.c.

Function Documentation

◆ compute_transition_param()

static void compute_transition_param ( double K,
double Q,
double  transition 
)
static

Definition at line 156 of file af_afreqshift.c.

Referenced by compute_coefs().

◆ ipowp()

static double ipowp ( double  x,
int64_t  n 
)
static

Definition at line 172 of file af_afreqshift.c.

Referenced by compute_acc_den(), and compute_acc_num().

◆ compute_acc_num()

static double compute_acc_num ( double  q,
int  order,
int  c 
)
static

Definition at line 186 of file af_afreqshift.c.

Referenced by compute_coef().

◆ compute_acc_den()

static double compute_acc_den ( double  q,
int  order,
int  c 
)
static

Definition at line 205 of file af_afreqshift.c.

Referenced by compute_coef().

◆ compute_coef()

static double compute_coef ( int  index,
double  k,
double  q,
int  order 
)
static

Definition at line 224 of file af_afreqshift.c.

Referenced by compute_coefs().

◆ compute_coefs()

static void compute_coefs ( double coef_arrd,
float coef_arrf,
int  nbr_coefs,
double  transition 
)
static

Definition at line 238 of file af_afreqshift.c.

Referenced by config_input(), and filter_frame().

◆ config_input()

static int config_input ( AVFilterLink inlink)
static

Definition at line 253 of file af_afreqshift.c.

◆ filter_channels()

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

Definition at line 288 of file af_afreqshift.c.

Referenced by filter_frame().

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 303 of file af_afreqshift.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 337 of file af_afreqshift.c.

◆ AVFILTER_DEFINE_CLASS() [1/2]

AVFILTER_DEFINE_CLASS ( afreqshift  )

◆ AVFILTER_DEFINE_CLASS() [2/2]

AVFILTER_DEFINE_CLASS ( aphaseshift  )

Variable Documentation

◆ sample_fmts

enum AVSampleFormat sample_fmts[]
static
Initial value:

Definition at line 51 of file af_afreqshift.c.

◆ afreqshift_options

const AVOption afreqshift_options[]
static
Initial value:
= {
{ "shift", "set frequency shift", OFFSET(shift), AV_OPT_TYPE_DOUBLE, {.dbl=0}, -INT_MAX, INT_MAX, FLAGS },
{ "level", "set output level", OFFSET(level), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0.0, 1.0, FLAGS },
{ "order", "set filter order", OFFSET(nb_coeffs),AV_OPT_TYPE_INT, {.i64=8}, 1, MAX_NB_COEFFS, FLAGS },
{ NULL }
}

Definition at line 350 of file af_afreqshift.c.

◆ inputs

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

Definition at line 359 of file af_afreqshift.c.

◆ ff_af_afreqshift

const AVFilter ff_af_afreqshift
Initial value:
= {
.name = "afreqshift",
.description = NULL_IF_CONFIG_SMALL("Apply frequency shifting to input audio."),
.priv_size = sizeof(AFreqShift),
.priv_class = &afreqshift_class,
.process_command = ff_filter_process_command,
}

Definition at line 368 of file af_afreqshift.c.

◆ aphaseshift_options

const AVOption aphaseshift_options[]
static
Initial value:
= {
{ "shift", "set phase shift", OFFSET(shift), AV_OPT_TYPE_DOUBLE, {.dbl=0}, -1.0, 1.0, FLAGS },
{ "level", "set output level",OFFSET(level), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0.0, 1.0, FLAGS },
{ "order", "set filter order",OFFSET(nb_coeffs), AV_OPT_TYPE_INT,{.i64=8}, 1, MAX_NB_COEFFS, FLAGS },
{ NULL }
}

Definition at line 382 of file af_afreqshift.c.

◆ ff_af_aphaseshift

const AVFilter ff_af_aphaseshift
Initial value:
= {
.name = "aphaseshift",
.description = NULL_IF_CONFIG_SMALL("Apply phase shifting to input audio."),
.priv_size = sizeof(AFreqShift),
.priv_class = &aphaseshift_class,
.process_command = ff_filter_process_command,
}

Definition at line 391 of file af_afreqshift.c.

AV_SAMPLE_FMT_FLTP
@ AV_SAMPLE_FMT_FLTP
float, planar
Definition: samplefmt.h:66
level
uint8_t level
Definition: svq3.c:204
inputs
static const AVFilterPad inputs[]
Definition: af_afreqshift.c:359
MAX_NB_COEFFS
#define MAX_NB_COEFFS
Definition: af_afreqshift.c:28
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: af_afreqshift.c:303
AFreqShift
Definition: af_afreqshift.c:30
sample_fmts
static enum AVSampleFormat sample_fmts[]
Definition: af_afreqshift.c:51
AV_OPT_TYPE_DOUBLE
@ AV_OPT_TYPE_DOUBLE
Definition: opt.h:237
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:182
NULL
#define NULL
Definition: coverity.c:32
OFFSET
#define OFFSET(x)
Definition: af_afreqshift.c:347
ff_audio_default_filterpad
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:33
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:106
shift
static int shift(int a, int b)
Definition: bonk.c:262
AV_SAMPLE_FMT_NONE
@ AV_SAMPLE_FMT_NONE
Definition: samplefmt.h:56
FILTER_SAMPLEFMTS_ARRAY
#define FILTER_SAMPLEFMTS_ARRAY(array)
Definition: internal.h:165
config_input
static int config_input(AVFilterLink *inlink)
Definition: af_afreqshift.c:253
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:890
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: af_afreqshift.c:337
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:147
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:235
AV_SAMPLE_FMT_DBLP
@ AV_SAMPLE_FMT_DBLP
double, planar
Definition: samplefmt.h:67
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
Definition: af_afreqshift.c:348
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:183