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 68 of file vf_geq.c.

◆ FLAGS

Definition at line 69 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 66 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 97 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 142 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 180 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 199 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 214 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 217 of file vf_geq.c.

Referenced by geq_init().

◆ lumsum()

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

Definition at line 219 of file vf_geq.c.

Referenced by geq_init().

◆ cbsum()

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

Definition at line 220 of file vf_geq.c.

Referenced by geq_init().

◆ crsub()

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

Definition at line 221 of file vf_geq.c.

Referenced by geq_init().

◆ alphasum()

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

Definition at line 222 of file vf_geq.c.

Referenced by geq_init().

◆ geq_init()

static av_cold int geq_init ( AVFilterContext ctx)
static

Definition at line 224 of file vf_geq.c.

◆ geq_query_formats()

static int geq_query_formats ( AVFilterContext ctx)
static

Definition at line 305 of file vf_geq.c.

◆ geq_config_props()

static int geq_config_props ( AVFilterLink inlink)
static

Definition at line 341 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 362 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 408 of file vf_geq.c.

◆ geq_uninit()

static av_cold void geq_uninit ( AVFilterContext ctx)
static

Definition at line 458 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 71 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 470 of file vf_geq.c.

◆ geq_outputs

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

Definition at line 479 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 486 of file vf_geq.c.

geq_query_formats
static int geq_query_formats(AVFilterContext *ctx)
Definition: vf_geq.c:305
geq_uninit
static av_cold void geq_uninit(AVFilterContext *ctx)
Definition: vf_geq.c:458
geq_outputs
static const AVFilterPad geq_outputs[]
Definition: vf_geq.c:479
FILTER_QUERY_FUNC
#define FILTER_QUERY_FUNC(func)
Definition: internal.h:168
R
@ R
Definition: vf_geq.c:66
NB_INTERP
@ NB_INTERP
Definition: vf_geq.c:42
init
static int init
Definition: av_tx.c:47
A
@ A
Definition: vf_geq.c:66
geq_config_props
static int geq_config_props(AVFilterLink *inlink)
Definition: vf_geq.c:341
OFFSET
#define OFFSET(x)
Definition: vf_geq.c:68
U
@ U
Definition: vf_geq.c:66
G
@ G
Definition: vf_geq.c:66
V
@ V
Definition: vf_geq.c:66
B
@ B
Definition: vf_geq.c:66
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:191
NULL
#define NULL
Definition: coverity.c:32
INTERP_NEAREST
@ INTERP_NEAREST
Definition: vf_geq.c:40
Y
@ Y
Definition: vf_geq.c:66
INTERP_BILINEAR
@ INTERP_BILINEAR
Definition: vf_geq.c:41
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
geq_init
static av_cold int geq_init(AVFilterContext *ctx)
Definition: vf_geq.c:224
FLAGS
#define FLAGS
Definition: vf_geq.c:69
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:146
GEQContext
Definition: vf_geq.c:48
geq_filter_frame
static int geq_filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: vf_geq.c:408
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:224
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:121
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:192
uninit
static av_cold int uninit(AVCodecContext *avctx)
Definition: crystalhd.c:282
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Definition: opt.h:228
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:233
geq_inputs
static const AVFilterPad geq_inputs[]
Definition: vf_geq.c:470