FFmpeg
Data Structures | Macros | Enumerations | Functions | Variables
vf_geq.c File Reference
#include "libavutil/avassert.h"
#include "libavutil/avstring.h"
#include "libavutil/eval.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "internal.h"

Go to the source code of this file.

Data Structures

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

Macros

#define MAX_NB_THREADS   32
 
#define NB_PLANES   4
 
#define OFFSET(x)   offsetof(GEQContext, x)
 
#define FLAGS   AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
 

Enumerations

enum  InterpolationMethods { INTERP_NEAREST, INTERP_BILINEAR, NB_INTERP }
 
enum  {
  VAR_X, VAR_Y, VAR_W, VAR_H,
  VAR_N, VAR_SW, VAR_SH, VAR_T,
  VAR_VARS_NB
}
 
enum  {
  Y = 0, U, V, A,
  G, B, R
}
 

Functions

 AVFILTER_DEFINE_CLASS (geq)
 
static double getpix (void *priv, double x, double y, int plane)
 
static int calculate_sums (GEQContext *geq, int plane, int w, int h)
 
static double getpix_integrate_internal (GEQContext *geq, int x, int y, int plane, int w, int h)
 
static double getpix_integrate (void *priv, double x, double y, int plane)
 
static double lum (void *priv, double x, double y)
 
static double cb (void *priv, double x, double y)
 
static double cr (void *priv, double x, double y)
 
static double alpha (void *priv, double x, double y)
 
static double lumsum (void *priv, double x, double y)
 
static double cbsum (void *priv, double x, double y)
 
static double crsub (void *priv, double x, double y)
 
static double alphasum (void *priv, double x, double y)
 
static av_cold int geq_init (AVFilterContext *ctx)
 
static int geq_query_formats (AVFilterContext *ctx)
 
static int geq_config_props (AVFilterLink *inlink)
 
static int slice_geq_filter (AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
 
static int geq_filter_frame (AVFilterLink *inlink, AVFrame *in)
 
static av_cold void geq_uninit (AVFilterContext *ctx)
 

Variables

static const char *const var_names [] = { "X", "Y", "W", "H", "N", "SW", "SH", "T", NULL }
 
static const AVOption geq_options []
 
static const AVFilterPad geq_inputs []
 
static const AVFilterPad geq_outputs []
 
const AVFilter ff_vf_geq
 

Detailed Description

Generic equation change filter Originally written by Michael Niedermayer for the MPlayer project, and ported by Clément Bœsch for FFmpeg.

Definition in file vf_geq.c.

Macro Definition Documentation

◆ MAX_NB_THREADS

#define MAX_NB_THREADS   32

Definition at line 36 of file vf_geq.c.

◆ NB_PLANES

#define NB_PLANES   4

Definition at line 37 of file vf_geq.c.

◆ OFFSET

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

Definition at line 69 of file vf_geq.c.

◆ FLAGS

Definition at line 70 of file vf_geq.c.

Enumeration Type Documentation

◆ InterpolationMethods

Enumerator
INTERP_NEAREST 
INTERP_BILINEAR 
NB_INTERP 

Definition at line 39 of file vf_geq.c.

◆ anonymous enum

anonymous enum
Enumerator
VAR_X 
VAR_Y 
VAR_W 
VAR_H 
VAR_N 
VAR_SW 
VAR_SH 
VAR_T 
VAR_VARS_NB 

Definition at line 46 of file vf_geq.c.

◆ anonymous enum

anonymous enum
Enumerator

Definition at line 67 of file vf_geq.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( geq  )

◆ getpix()

static double getpix ( void *  priv,
double  x,
double  y,
int  plane 
)
inlinestatic

Definition at line 98 of file vf_geq.c.

Referenced by alpha(), cb(), cr(), and lum().

◆ calculate_sums()

static int calculate_sums ( GEQContext geq,
int  plane,
int  w,
int  h 
)
static

Definition at line 156 of file vf_geq.c.

Referenced by geq_filter_frame().

◆ getpix_integrate_internal()

static double getpix_integrate_internal ( GEQContext geq,
int  x,
int  y,
int  plane,
int  w,
int  h 
)
inlinestatic

Definition at line 204 of file vf_geq.c.

Referenced by getpix_integrate().

◆ getpix_integrate()

static double getpix_integrate ( void *  priv,
double  x,
double  y,
int  plane 
)
inlinestatic

Definition at line 223 of file vf_geq.c.

Referenced by alphasum(), cbsum(), crsub(), and lumsum().

◆ lum()

static double lum ( void *  priv,
double  x,
double  y 
)
static

Definition at line 238 of file vf_geq.c.

Referenced by geq_init().

◆ cb()

static double cb ( void *  priv,
double  x,
double  y 
)
static

◆ cr()

static double cr ( void *  priv,
double  x,
double  y 
)
static

◆ alpha()

static double alpha ( void *  priv,
double  x,
double  y 
)
static

Definition at line 241 of file vf_geq.c.

Referenced by geq_init().

◆ lumsum()

static double lumsum ( void *  priv,
double  x,
double  y 
)
static

Definition at line 243 of file vf_geq.c.

Referenced by geq_init().

◆ cbsum()

static double cbsum ( void *  priv,
double  x,
double  y 
)
static

Definition at line 244 of file vf_geq.c.

Referenced by geq_init().

◆ crsub()

static double crsub ( void *  priv,
double  x,
double  y 
)
static

Definition at line 245 of file vf_geq.c.

Referenced by geq_init().

◆ alphasum()

static double alphasum ( void *  priv,
double  x,
double  y 
)
static

Definition at line 246 of file vf_geq.c.

Referenced by geq_init().

◆ geq_init()

static av_cold int geq_init ( AVFilterContext ctx)
static

Definition at line 248 of file vf_geq.c.

◆ geq_query_formats()

static int geq_query_formats ( AVFilterContext ctx)
static

Definition at line 331 of file vf_geq.c.

◆ geq_config_props()

static int geq_config_props ( AVFilterLink inlink)
static

Definition at line 369 of file vf_geq.c.

◆ slice_geq_filter()

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

Definition at line 390 of file vf_geq.c.

Referenced by geq_filter_frame().

◆ geq_filter_frame()

static int geq_filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 446 of file vf_geq.c.

◆ geq_uninit()

static av_cold void geq_uninit ( AVFilterContext ctx)
static

Definition at line 497 of file vf_geq.c.

Variable Documentation

◆ var_names

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

Definition at line 45 of file vf_geq.c.

Referenced by geq_init().

◆ geq_options

const AVOption geq_options[]
static
Initial value:
= {
{ "lum_expr", "set luminance expression", OFFSET(expr_str[Y]), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, FLAGS },
{ "lum", "set luminance expression", OFFSET(expr_str[Y]), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, FLAGS },
{ "cb_expr", "set chroma blue expression", OFFSET(expr_str[U]), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, FLAGS },
{ "cb", "set chroma blue expression", OFFSET(expr_str[U]), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, FLAGS },
{ "cr_expr", "set chroma red expression", OFFSET(expr_str[V]), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, FLAGS },
{ "cr", "set chroma red expression", OFFSET(expr_str[V]), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, FLAGS },
{ "alpha_expr", "set alpha expression", OFFSET(expr_str[A]), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, FLAGS },
{ "a", "set alpha expression", OFFSET(expr_str[A]), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, FLAGS },
{ "red_expr", "set red expression", OFFSET(expr_str[R]), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, FLAGS },
{ "r", "set red expression", OFFSET(expr_str[R]), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, FLAGS },
{ "green_expr", "set green expression", OFFSET(expr_str[G]), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, FLAGS },
{ "g", "set green expression", OFFSET(expr_str[G]), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, FLAGS },
{ "blue_expr", "set blue expression", OFFSET(expr_str[B]), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, FLAGS },
{ "b", "set blue expression", OFFSET(expr_str[B]), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, FLAGS },
{ "interpolation","set interpolation method", OFFSET(interpolation), AV_OPT_TYPE_INT, {.i64=INTERP_BILINEAR}, 0, NB_INTERP-1, FLAGS, "interp" },
{ "i", "set interpolation method", OFFSET(interpolation), AV_OPT_TYPE_INT, {.i64=INTERP_BILINEAR}, 0, NB_INTERP-1, FLAGS, "interp" },
{ "nearest", "nearest interpolation", 0, AV_OPT_TYPE_CONST, {.i64=INTERP_NEAREST}, 0, 0, FLAGS, "interp" },
{ "n", "nearest interpolation", 0, AV_OPT_TYPE_CONST, {.i64=INTERP_NEAREST}, 0, 0, FLAGS, "interp" },
{ "bilinear", "bilinear interpolation", 0, AV_OPT_TYPE_CONST, {.i64=INTERP_BILINEAR}, 0, 0, FLAGS, "interp" },
{ "b", "bilinear interpolation", 0, AV_OPT_TYPE_CONST, {.i64=INTERP_BILINEAR}, 0, 0, FLAGS, "interp" },
{NULL},
}

Definition at line 72 of file vf_geq.c.

◆ geq_inputs

const AVFilterPad geq_inputs[]
static
Initial value:
= {
{
.name = "default",
.config_props = geq_config_props,
.filter_frame = geq_filter_frame,
},
}

Definition at line 509 of file vf_geq.c.

◆ geq_outputs

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

Definition at line 518 of file vf_geq.c.

◆ ff_vf_geq

const AVFilter ff_vf_geq
Initial value:
= {
.name = "geq",
.description = NULL_IF_CONFIG_SMALL("Apply generic equation to each pixel."),
.priv_size = sizeof(GEQContext),
.priv_class = &geq_class,
}

Definition at line 525 of file vf_geq.c.

Y
@ Y
Definition: vf_geq.c:67
geq_query_formats
static int geq_query_formats(AVFilterContext *ctx)
Definition: vf_geq.c:331
geq_uninit
static av_cold void geq_uninit(AVFilterContext *ctx)
Definition: vf_geq.c:497
R
@ R
Definition: vf_geq.c:67
geq_outputs
static const AVFilterPad geq_outputs[]
Definition: vf_geq.c:518
V
@ V
Definition: vf_geq.c:67
FILTER_QUERY_FUNC
#define FILTER_QUERY_FUNC(func)
Definition: internal.h:171
NB_INTERP
@ NB_INTERP
Definition: vf_geq.c:42
geq_config_props
static int geq_config_props(AVFilterLink *inlink)
Definition: vf_geq.c:369
OFFSET
#define OFFSET(x)
Definition: vf_geq.c:69
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts_bsf.c:365
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:194
B
@ B
Definition: vf_geq.c:67
NULL
#define NULL
Definition: coverity.c:32
INTERP_NEAREST
@ INTERP_NEAREST
Definition: vf_geq.c:40
INTERP_BILINEAR
@ INTERP_BILINEAR
Definition: vf_geq.c:41
A
@ A
Definition: vf_geq.c:67
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
geq_init
static av_cold int geq_init(AVFilterContext *ctx)
Definition: vf_geq.c:248
FLAGS
#define FLAGS
Definition: vf_geq.c:70
G
@ G
Definition: vf_geq.c:67
interpolation
static int interpolation(DeclickChannel *c, const double *src, int ar_order, double *acoefficients, int *index, int nb_errors, double *auxiliary, double *interpolated)
Definition: af_adeclick.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
GEQContext
Definition: vf_geq.c:48
geq_filter_frame
static int geq_filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: vf_geq.c:446
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:225
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
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:195
uninit
static av_cold int uninit(AVCodecContext *avctx)
Definition: crystalhd.c:285
U
@ U
Definition: vf_geq.c:67
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Definition: opt.h:229
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:234
geq_inputs
static const AVFilterPad geq_inputs[]
Definition: vf_geq.c:509