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/mem.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "formats.h"
#include "internal.h"
#include "video.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 []
 
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 39 of file vf_geq.c.

◆ NB_PLANES

#define NB_PLANES   4

Definition at line 40 of file vf_geq.c.

◆ OFFSET

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

Definition at line 72 of file vf_geq.c.

◆ FLAGS

Definition at line 73 of file vf_geq.c.

Enumeration Type Documentation

◆ InterpolationMethods

Enumerator
INTERP_NEAREST 
INTERP_BILINEAR 
NB_INTERP 

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

◆ anonymous enum

anonymous enum
Enumerator

Definition at line 70 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 101 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 163 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 211 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 230 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 245 of file vf_geq.c.

Referenced by geq_init().

◆ cb()

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

Definition at line 246 of file vf_geq.c.

Referenced by av_executor_alloc(), av_executor_execute(), build_canonical_huff(), calc_power(), cfhd_encode_frame(), codebook_trellis_rate(), create_adapt_vect(), create_vorbis_context(), decode_frame(), decode_huffman2(), decode_lsp(), decode_q_branch(), do_decode(), draw_cursor(), draw_spatial(), dvbsub_parse_clut_segment(), encode_frame(), encode_q_branch(), encode_window_bands_info(), escape130_decode_frame(), ff_check_interrupt(), ff_dvdclut_yuv_to_rgb(), ff_fill_rgb2yuv_table(), ff_poll_interrupt(), ff_quantize_and_encode_band_cost(), ff_vvc_inv_dct2_64(), fill_gv_table(), fill_table(), filter_frame(), find_best_vect(), find_min_book(), frame_checksum_compare(), geq_init(), idct_put(), index_mb(), init_dimensions(), ivi_create_huff_from_desc(), m101_decode_frame(), opus_rc_enc_carryout(), osq_channel_parameters(), paf_audio_decode(), parse_ifo_palette(), parse_palette_segment(), pgmyuv_save(), pps_scc_extension(), ps_tableinit(), put_codebook_header(), put_codeword(), quantize_and_encode_band(), quantize_and_encode_band_cost_template(), quantize_band_cost(), quantize_band_cost_bits(), quantize_band_cost_cached(), read_coeffs_coarse(), ready_codebook(), ready_residue(), reset_stats(), rgb24_to_yuv420p(), rgb_to_yuv(), run_one_task(), search_for_quantizers_anmr(), search_for_quantizers_fast(), search_for_quantizers_twoloop(), set_blocks(), unpack_codebook(), update_residue_parameter(), update_stats(), update_volume(), vcr1_decode_frame(), vibrance_slice16(), vibrance_slice16p(), vibrance_slice8(), vibrance_slice8p(), vorbis_parse_setup_hdr_codebooks(), yuv_a_to_rgba(), and yuv_to_rgba().

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

Referenced by geq_init().

◆ lumsum()

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

Definition at line 250 of file vf_geq.c.

Referenced by geq_init().

◆ cbsum()

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

Definition at line 251 of file vf_geq.c.

Referenced by geq_init().

◆ crsub()

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

Definition at line 252 of file vf_geq.c.

Referenced by geq_init().

◆ alphasum()

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

Definition at line 253 of file vf_geq.c.

Referenced by geq_init().

◆ geq_init()

static av_cold int geq_init ( AVFilterContext ctx)
static

Definition at line 255 of file vf_geq.c.

◆ geq_query_formats()

static int geq_query_formats ( AVFilterContext ctx)
static

Definition at line 338 of file vf_geq.c.

◆ geq_config_props()

static int geq_config_props ( AVFilterLink inlink)
static

Definition at line 376 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 397 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 453 of file vf_geq.c.

◆ geq_uninit()

static av_cold void geq_uninit ( AVFilterContext ctx)
static

Definition at line 504 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 48 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, .unit = "interp" },
{ "i", "set interpolation method", OFFSET(interpolation), AV_OPT_TYPE_INT, {.i64=INTERP_BILINEAR}, 0, NB_INTERP-1, FLAGS, .unit = "interp" },
{ "nearest", "nearest interpolation", 0, AV_OPT_TYPE_CONST, {.i64=INTERP_NEAREST}, 0, 0, FLAGS, .unit = "interp" },
{ "n", "nearest interpolation", 0, AV_OPT_TYPE_CONST, {.i64=INTERP_NEAREST}, 0, 0, FLAGS, .unit = "interp" },
{ "bilinear", "bilinear interpolation", 0, AV_OPT_TYPE_CONST, {.i64=INTERP_BILINEAR}, 0, 0, FLAGS, .unit = "interp" },
{ "b", "bilinear interpolation", 0, AV_OPT_TYPE_CONST, {.i64=INTERP_BILINEAR}, 0, 0, FLAGS, .unit = "interp" },
{NULL},
}

Definition at line 75 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 516 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.

R
@ R
Definition: vf_geq.c:70
geq_query_formats
static int geq_query_formats(AVFilterContext *ctx)
Definition: vf_geq.c:338
geq_uninit
static av_cold void geq_uninit(AVFilterContext *ctx)
Definition: vf_geq.c:504
FILTER_QUERY_FUNC
#define FILTER_QUERY_FUNC(func)
Definition: internal.h:159
NB_INTERP
@ NB_INTERP
Definition: vf_geq.c:45
V
@ V
Definition: vf_geq.c:70
geq_config_props
static int geq_config_props(AVFilterLink *inlink)
Definition: vf_geq.c:376
ff_video_default_filterpad
const AVFilterPad ff_video_default_filterpad[1]
An AVFilterPad array whose only entry has name "default" and is of type AVMEDIA_TYPE_VIDEO.
Definition: video.c:37
OFFSET
#define OFFSET(x)
Definition: vf_geq.c:72
A
@ A
Definition: vf_geq.c:70
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:182
NULL
#define NULL
Definition: coverity.c:32
INTERP_NEAREST
@ INTERP_NEAREST
Definition: vf_geq.c:43
Y
@ Y
Definition: vf_geq.c:70
G
@ G
Definition: vf_geq.c:70
INTERP_BILINEAR
@ INTERP_BILINEAR
Definition: vf_geq.c:44
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts.c:366
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:94
geq_init
static av_cold int geq_init(AVFilterContext *ctx)
Definition: vf_geq.c:255
FLAGS
#define FLAGS
Definition: vf_geq.c:73
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:390
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:147
GEQContext
Definition: vf_geq.c:51
uninit
static void uninit(AVBSFContext *ctx)
Definition: pcm_rechunk.c:68
B
@ B
Definition: vf_geq.c:70
geq_filter_frame
static int geq_filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: vf_geq.c:453
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:245
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:183
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Definition: opt.h:249
U
@ U
Definition: vf_geq.c:70
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:254
geq_inputs
static const AVFilterPad geq_inputs[]
Definition: vf_geq.c:516