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"
#include "formats.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 []
 
static const AVFilterPad outputs []
 
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 29 of file af_afreqshift.c.

◆ PFILTER

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

Definition at line 56 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 346 of file af_afreqshift.c.

◆ FLAGS

Definition at line 347 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 155 of file af_afreqshift.c.

Referenced by compute_coefs().

◆ ipowp()

static double ipowp ( double  x,
int64_t  n 
)
static

Definition at line 171 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 185 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 204 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 223 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 237 of file af_afreqshift.c.

Referenced by config_input(), and filter_frame().

◆ config_input()

static int config_input ( AVFilterLink inlink)
static

Definition at line 252 of file af_afreqshift.c.

◆ filter_channels()

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

Definition at line 287 of file af_afreqshift.c.

Referenced by filter_frame().

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 302 of file af_afreqshift.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 336 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 52 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 349 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 358 of file af_afreqshift.c.

◆ outputs

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

Definition at line 367 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 374 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 388 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 397 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:358
MAX_NB_COEFFS
#define MAX_NB_COEFFS
Definition: af_afreqshift.c:29
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: af_afreqshift.c:302
AFreqShift
Definition: af_afreqshift.c:31
sample_fmts
static enum AVSampleFormat sample_fmts[]
Definition: af_afreqshift.c:52
AV_OPT_TYPE_DOUBLE
@ AV_OPT_TYPE_DOUBLE
Definition: opt.h:227
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:194
NULL
#define NULL
Definition: coverity.c:32
OFFSET
#define OFFSET(x)
Definition: af_afreqshift.c:346
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
shift
static int shift(int a, int b)
Definition: bonk.c:257
AV_SAMPLE_FMT_NONE
@ AV_SAMPLE_FMT_NONE
Definition: samplefmt.h:56
FILTER_SAMPLEFMTS_ARRAY
#define FILTER_SAMPLEFMTS_ARRAY(array)
Definition: internal.h:177
config_input
static int config_input(AVFilterLink *inlink)
Definition: af_afreqshift.c:252
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:842
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: af_afreqshift.c:336
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:142
outputs
static const AVFilterPad outputs[]
Definition: af_afreqshift.c:367
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:225
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:347
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:195