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 NB_COEFS   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 int query_formats (AVFilterContext *ctx)
 
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 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

◆ NB_COEFS

#define NB_COEFS   16

Definition at line 29 of file af_afreqshift.c.

◆ PFILTER

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

Definition at line 80 of file af_afreqshift.c.

◆ FFILTER

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

Definition at line 129 of file af_afreqshift.c.

◆ OFFSET

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

Definition at line 364 of file af_afreqshift.c.

◆ FLAGS

Definition at line 365 of file af_afreqshift.c.

Function Documentation

◆ query_formats()

static int query_formats ( AVFilterContext ctx)
static

Definition at line 50 of file af_afreqshift.c.

◆ compute_transition_param()

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

Definition at line 179 of file af_afreqshift.c.

Referenced by compute_coefs().

◆ ipowp()

static double ipowp ( double  x,
int64_t  n 
)
static

Definition at line 195 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 209 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 228 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 247 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 261 of file af_afreqshift.c.

Referenced by config_input().

◆ config_input()

static int config_input ( AVFilterLink inlink)
static

Definition at line 276 of file af_afreqshift.c.

◆ filter_channels()

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

Definition at line 309 of file af_afreqshift.c.

Referenced by filter_frame().

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 324 of file af_afreqshift.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 354 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

◆ 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 },
{ NULL }
}

Definition at line 367 of file af_afreqshift.c.

◆ inputs

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

Definition at line 375 of file af_afreqshift.c.

◆ outputs

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

Definition at line 385 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."),
.query_formats = query_formats,
.priv_size = sizeof(AFreqShift),
.priv_class = &afreqshift_class,
}

Definition at line 393 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 },
{ NULL }
}

Definition at line 407 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."),
.query_formats = query_formats,
.priv_size = sizeof(AFreqShift),
.priv_class = &aphaseshift_class,
}

Definition at line 415 of file af_afreqshift.c.

level
uint8_t level
Definition: svq3.c:204
inputs
static const AVFilterPad inputs[]
Definition: af_afreqshift.c:375
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: af_afreqshift.c:324
AFreqShift
Definition: af_afreqshift.c:31
AV_OPT_TYPE_DOUBLE
@ AV_OPT_TYPE_DOUBLE
Definition: opt.h:227
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
NULL
#define NULL
Definition: coverity.c:32
OFFSET
#define OFFSET(x)
Definition: af_afreqshift.c:364
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:117
process_command
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
Definition: af_acrusher.c:336
config_input
static int config_input(AVFilterLink *inlink)
Definition: af_afreqshift.c:276
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:354
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:126
outputs
static const AVFilterPad outputs[]
Definition: af_afreqshift.c:385
shift
static int shift(int a, int b)
Definition: sonic.c:83
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:365
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:561
query_formats
static int query_formats(AVFilterContext *ctx)
Definition: af_afreqshift.c:50