FFmpeg
Loading...
Searching...
No Matches
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 "filters.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)
 
#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 FFFilter ff_af_afreqshift
 
static const AVOption aphaseshift_options []
 
const FFFilter ff_af_aphaseshift
 

Macro Definition Documentation

◆ MAX_NB_COEFFS

#define MAX_NB_COEFFS   16

Definition at line 29 of file af_afreqshift.c.

Referenced by config_input().

◆ 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 106 of file af_afreqshift.c.

◆ OFFSET

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

Definition at line 348 of file af_afreqshift.c.

◆ FLAGS

Function Documentation

◆ compute_transition_param()

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

Definition at line 157 of file af_afreqshift.c.

Referenced by compute_coefs(), and compute_transition_param().

◆ ipowp()

static double ipowp ( double x,
int64_t n )
static

Definition at line 173 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 187 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 206 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 225 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 239 of file af_afreqshift.c.

Referenced by config_input(), and filter_frame().

◆ config_input()

static int config_input ( AVFilterLink * inlink)
static

Definition at line 254 of file af_afreqshift.c.

◆ filter_channels()

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

Definition at line 289 of file af_afreqshift.c.

◆ filter_frame()

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

Definition at line 304 of file af_afreqshift.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext * ctx)
static

Definition at line 338 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:
= {
}
@ AV_SAMPLE_FMT_FLTP
float, planar
Definition samplefmt.h:66
@ AV_SAMPLE_FMT_NONE
Definition samplefmt.h:56
@ AV_SAMPLE_FMT_DBLP
double, planar
Definition samplefmt.h:67

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 }
}
#define MAX_NB_COEFFS
#define FLAGS
Definition cmdutils.c:598
#define NULL
Definition coverity.c:32
#define OFFSET(x)
@ 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
static int shift(int a, int b)
Definition bonk.c:261
uint8_t level
Definition svq3.c:208

Definition at line 351 of file af_afreqshift.c.

◆ inputs

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

◆ ff_af_afreqshift

const FFFilter ff_af_afreqshift
Initial value:
= {
.p.name = "afreqshift",
.p.description = NULL_IF_CONFIG_SMALL("Apply frequency shifting to input audio."),
.p.priv_class = &afreqshift_class,
.priv_size = sizeof(AFreqShift),
.process_command = ff_filter_process_command,
}
static enum AVSampleFormat sample_fmts[]
Definition adpcmenc.c:933
static const AVFilterPad inputs[]
Definition af_aap.c:299
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
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:906
#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:196
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
Definition avfilter.h:166
static av_cold void uninit(AVBitStreamFilterContext *ctx)
#define FILTER_INPUTS(array)
Definition filters.h:264
#define FILTER_SAMPLEFMTS_ARRAY(array)
Definition filters.h:247
#define FILTER_OUTPUTS(array)
Definition filters.h:265
#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 369 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 383 of file af_afreqshift.c.

◆ ff_af_aphaseshift

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

Definition at line 392 of file af_afreqshift.c.