FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions | Variables
vf_fftfilt.c File Reference

FFT domain filtering. More...

#include "libavfilter/internal.h"
#include "libavutil/common.h"
#include "libavutil/imgutils.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "libavcodec/avfft.h"
#include "libavutil/eval.h"

Go to the source code of this file.

Data Structures

struct  FFTFILTContext
 

Macros

#define MAX_PLANES   4
 
#define OFFSET(x)   offsetof(FFTFILTContext, x)
 
#define FLAGS   AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
 

Enumerations

enum  {
  VAR_X, VAR_Y, VAR_W, VAR_H,
  VAR_VARS_NB
}
 
enum  { Y = 0, U, V }
 

Functions

 AVFILTER_DEFINE_CLASS (fftfilt)
 
static double lum (void *priv, double x, double y, int plane)
 
static double weight_Y (void *priv, double x, double y)
 
static double weight_U (void *priv, double x, double y)
 
static double weight_V (void *priv, double x, double y)
 
static void copy_rev (FFTSample *dest, int w, int w2)
 
static void rdft_horizontal (FFTFILTContext *s, AVFrame *in, int w, int h, int plane)
 
static void rdft_vertical (FFTFILTContext *s, int h, int plane)
 
static void irdft_vertical (FFTFILTContext *s, int h, int plane)
 
static void irdft_horizontal (FFTFILTContext *s, AVFrame *out, int w, int h, int plane)
 
static av_cold int initialize (AVFilterContext *ctx)
 
static int config_props (AVFilterLink *inlink)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *in)
 
static av_cold void uninit (AVFilterContext *ctx)
 
static int query_formats (AVFilterContext *ctx)
 

Variables

static const char *const var_names [] = { "X", "Y", "W", "H", NULL }
 
static const AVOption fftfilt_options []
 
static const AVFilterPad fftfilt_inputs []
 
static const AVFilterPad fftfilt_outputs []
 
AVFilter ff_vf_fftfilt
 

Detailed Description

FFT domain filtering.

Definition in file vf_fftfilt.c.

Macro Definition Documentation

#define MAX_PLANES   4

Definition at line 34 of file vf_fftfilt.c.

Referenced by uninit().

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

Definition at line 59 of file vf_fftfilt.c.

Definition at line 60 of file vf_fftfilt.c.

Enumeration Type Documentation

anonymous enum
Enumerator
VAR_X 
VAR_Y 
VAR_W 
VAR_H 
VAR_VARS_NB 

Definition at line 55 of file vf_fftfilt.c.

anonymous enum
Enumerator
Y 
U 
V 

Definition at line 57 of file vf_fftfilt.c.

Function Documentation

AVFILTER_DEFINE_CLASS ( fftfilt  )
static double lum ( void priv,
double  x,
double  y,
int  plane 
)
inlinestatic

Definition at line 74 of file vf_fftfilt.c.

Referenced by blend_subrect(), weight_U(), weight_V(), and weight_Y().

static double weight_Y ( void priv,
double  x,
double  y 
)
static

Definition at line 80 of file vf_fftfilt.c.

Referenced by initialize().

static double weight_U ( void priv,
double  x,
double  y 
)
static

Definition at line 81 of file vf_fftfilt.c.

Referenced by initialize().

static double weight_V ( void priv,
double  x,
double  y 
)
static

Definition at line 82 of file vf_fftfilt.c.

Referenced by initialize().

static void copy_rev ( FFTSample dest,
int  w,
int  w2 
)
static

Definition at line 84 of file vf_fftfilt.c.

Referenced by rdft_horizontal(), and rdft_vertical().

static void rdft_horizontal ( FFTFILTContext s,
AVFrame in,
int  w,
int  h,
int  plane 
)
static

Definition at line 96 of file vf_fftfilt.c.

Referenced by filter_frame().

static void rdft_vertical ( FFTFILTContext s,
int  h,
int  plane 
)
static

Definition at line 115 of file vf_fftfilt.c.

Referenced by filter_frame().

static void irdft_vertical ( FFTFILTContext s,
int  h,
int  plane 
)
static

Definition at line 133 of file vf_fftfilt.c.

Referenced by filter_frame().

static void irdft_horizontal ( FFTFILTContext s,
AVFrame out,
int  w,
int  h,
int  plane 
)
static

Definition at line 149 of file vf_fftfilt.c.

Referenced by filter_frame().

static av_cold int initialize ( AVFilterContext ctx)
static

Definition at line 166 of file vf_fftfilt.c.

static int config_props ( AVFilterLink inlink)
static

Definition at line 200 of file vf_fftfilt.c.

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 248 of file vf_fftfilt.c.

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 292 of file vf_fftfilt.c.

static int query_formats ( AVFilterContext ctx)
static

Definition at line 304 of file vf_fftfilt.c.

Variable Documentation

const char* const var_names[] = { "X", "Y", "W", "H", NULL }
static

Definition at line 54 of file vf_fftfilt.c.

Referenced by initialize().

const AVOption fftfilt_options[]
static
Initial value:
= {
{ "dc_Y", "adjust gain in Y plane", OFFSET(dc[Y]), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1000, FLAGS },
{ "dc_U", "adjust gain in U plane", OFFSET(dc[U]), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1000, FLAGS },
{ "dc_V", "adjust gain in V plane", OFFSET(dc[V]), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1000, FLAGS },
{ "weight_Y", "set luminance expression in Y plane", OFFSET(weight_str[Y]), AV_OPT_TYPE_STRING, {.str = "1"}, CHAR_MIN, CHAR_MAX, FLAGS },
{ "weight_U", "set chrominance expression in U plane", OFFSET(weight_str[U]), AV_OPT_TYPE_STRING, {.str = NULL}, CHAR_MIN, CHAR_MAX, FLAGS },
{ "weight_V", "set chrominance expression in V plane", OFFSET(weight_str[V]), AV_OPT_TYPE_STRING, {.str = NULL}, CHAR_MIN, CHAR_MAX, FLAGS },
{NULL},
}
#define NULL
Definition: coverity.c:32
#define OFFSET(x)
Definition: vf_fftfilt.c:59
#define FLAGS
Definition: vf_fftfilt.c:60
Definition: vf_fftfilt.c:57
Definition: vf_fftfilt.c:57
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(constint16_t *) pi >>8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(constint32_t *) pi >>24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(constfloat *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(constfloat *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(constfloat *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(constdouble *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(constdouble *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(constdouble *) pi *(1U<< 31))))#defineSET_CONV_FUNC_GROUP(ofmt, ifmt) staticvoidset_generic_function(AudioConvert *ac){}voidff_audio_convert_free(AudioConvert **ac){if(!*ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);}AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enumAVSampleFormatout_fmt, enumAVSampleFormatin_fmt, intchannels, intsample_rate, intapply_map){AudioConvert *ac;intin_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) returnNULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method!=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt)>2){ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc){av_free(ac);returnNULL;}returnac;}in_planar=ff_sample_fmt_is_planar(in_fmt, channels);out_planar=ff_sample_fmt_is_planar(out_fmt, channels);if(in_planar==out_planar){ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar?ac->channels:1;}elseif(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;elseac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_AARCH64) ff_audio_convert_init_aarch64(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);returnac;}intff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in){intuse_generic=1;intlen=in->nb_samples;intp;if(ac->dc){av_log(ac->avr, AV_LOG_TRACE,"%dsamples-audio_convert:%sto%s(dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));returnff_convert_dither(ac-> dc
Definition: vf_fftfilt.c:57

Definition at line 62 of file vf_fftfilt.c.

const AVFilterPad fftfilt_inputs[]
static
Initial value:
= {
{
.name = "default",
.config_props = config_props,
.filter_frame = filter_frame,
},
{ NULL }
}
#define NULL
Definition: coverity.c:32
static int config_props(AVFilterLink *inlink)
Definition: vf_fftfilt.c:200
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: vf_fftfilt.c:248

Definition at line 318 of file vf_fftfilt.c.

const AVFilterPad fftfilt_outputs[]
static
Initial value:
= {
{
.name = "default",
},
{ NULL }
}
#define NULL
Definition: coverity.c:32

Definition at line 328 of file vf_fftfilt.c.

AVFilter ff_vf_fftfilt
Initial value:
= {
.name = "fftfilt",
.description = NULL_IF_CONFIG_SMALL("Apply arbitrary expressions to pixels in frequency domain."),
.priv_size = sizeof(FFTFILTContext),
.priv_class = &fftfilt_class,
}
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
static const AVFilterPad fftfilt_inputs[]
Definition: vf_fftfilt.c:318
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:176
static const AVFilterPad outputs[]
Definition: af_afftfilt.c:386
static const AVFilterPad inputs[]
Definition: af_afftfilt.c:376
static int query_formats(AVFilterContext *ctx)
Definition: vf_fftfilt.c:304
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_fftfilt.c:292
static const AVFilterPad fftfilt_outputs[]
Definition: vf_fftfilt.c:328
static av_cold int initialize(AVFilterContext *ctx)
Definition: vf_fftfilt.c:166

Definition at line 336 of file vf_fftfilt.c.