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 "filters.h"
#include "formats.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 (const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
 
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 40 of file vf_geq.c.

◆ NB_PLANES

#define NB_PLANES   4

Definition at line 41 of file vf_geq.c.

◆ OFFSET

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

Definition at line 73 of file vf_geq.c.

◆ FLAGS

Definition at line 74 of file vf_geq.c.

Enumeration Type Documentation

◆ InterpolationMethods

Enumerator
INTERP_NEAREST 
INTERP_BILINEAR 
NB_INTERP 

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

◆ anonymous enum

anonymous enum
Enumerator

Definition at line 71 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 102 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 164 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 212 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 231 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 246 of file vf_geq.c.

Referenced by geq_init().

◆ cb()

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

Definition at line 247 of file vf_geq.c.

Referenced by apply_noise_fill(), 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_executor_alloc(), ff_fill_rgb2yuv_table(), ff_poll_interrupt(), ff_quantize_and_encode_band_cost(), ff_vvc_inv_dct2_64(), filter_frame(), find_best_vect(), find_min_book(), frame_checksum_compare(), geq_init(), idct_put(), if(), index_mb(), init_dimensions(), ivi_create_huff_from_desc(), m101_decode_frame(), mediacodec_init(), mediacodec_ndk_setAsyncNotifyCallback(), 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(), spectrum_scale(), 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(), vvc_deblock_bs_luma(), vvc_deblock_subblock_bs(), and yuv_a_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 249 of file vf_geq.c.

Referenced by geq_init().

◆ lumsum()

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

Definition at line 251 of file vf_geq.c.

Referenced by geq_init().

◆ cbsum()

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

Definition at line 252 of file vf_geq.c.

Referenced by geq_init().

◆ crsub()

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

Definition at line 253 of file vf_geq.c.

Referenced by geq_init().

◆ alphasum()

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

Definition at line 254 of file vf_geq.c.

Referenced by geq_init().

◆ geq_init()

static av_cold int geq_init ( AVFilterContext ctx)
static

Definition at line 256 of file vf_geq.c.

◆ geq_query_formats()

static int geq_query_formats ( const AVFilterContext ctx,
AVFilterFormatsConfig **  cfg_in,
AVFilterFormatsConfig **  cfg_out 
)
static

Definition at line 339 of file vf_geq.c.

◆ geq_config_props()

static int geq_config_props ( AVFilterLink inlink)
static

Definition at line 379 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 400 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 456 of file vf_geq.c.

◆ geq_uninit()

static av_cold void geq_uninit ( AVFilterContext ctx)
static

Definition at line 508 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 49 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 76 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 520 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 529 of file vf_geq.c.

geq_uninit
static av_cold void geq_uninit(AVFilterContext *ctx)
Definition: vf_geq.c:508
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: filters.h:262
Y
@ Y
Definition: vf_geq.c:71
NB_INTERP
@ NB_INTERP
Definition: vf_geq.c:46
geq_config_props
static int geq_config_props(AVFilterLink *inlink)
Definition: vf_geq.c:379
geq_query_formats
static int geq_query_formats(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
Definition: vf_geq.c:339
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:73
R
@ R
Definition: vf_geq.c:71
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: filters.h:263
V
@ V
Definition: vf_geq.c:71
NULL
#define NULL
Definition: coverity.c:32
INTERP_NEAREST
@ INTERP_NEAREST
Definition: vf_geq.c:44
INTERP_BILINEAR
@ INTERP_BILINEAR
Definition: vf_geq.c:45
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts.c:368
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:256
FLAGS
#define FLAGS
Definition: vf_geq.c:74
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:389
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:182
GEQContext
Definition: vf_geq.c:52
uninit
static void uninit(AVBSFContext *ctx)
Definition: pcm_rechunk.c:68
FILTER_QUERY_FUNC2
#define FILTER_QUERY_FUNC2(func)
Definition: filters.h:239
A
@ A
Definition: vf_geq.c:71
geq_filter_frame
static int geq_filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: vf_geq.c:456
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition: opt.h:259
B
@ B
Definition: vf_geq.c:71
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:152
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Underlying C type is a uint8_t* that is either NULL or points to a C string allocated with the av_mal...
Definition: opt.h:276
G
@ G
Definition: vf_geq.c:71
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition: opt.h:299
U
@ U
Definition: vf_geq.c:71
geq_inputs
static const AVFilterPad geq_inputs[]
Definition: vf_geq.c:520