FFmpeg
Loading...
Searching...
No Matches
vf_geq.c File Reference

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

#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)
 
#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 FFFilter 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.

Referenced by blur(), check_compiled(), check_range(), check_uop(), geq_init(), and geq_uninit().

◆ OFFSET

#define OFFSET ( x)
Value:
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(), getpix(), 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(), and getpix_integrate_internal().

◆ 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.

◆ 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(), colormap_slice(), create_adapt_vect(), create_vorbis_context(), decode_frame(), decode_frame(), decode_huffman2(), decode_lsp(), decode_q_branch(), do_decode(), draw_cursor(), draw_spatial(), dvbsub_parse_clut_segment(), encode_frame(), encode_frame(), encode_q_branch(), 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_sws_enum_op_lists(), ff_vvc_inv_dct2_64(), filter_frame(), find_best_vect(), find_capture_source(), 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(), nmr_band_curve(), oh_decode_start(), oh_encode_start(), opencl_error_callback(), 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_NONE(), 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_on_wgc_thread(), run_one_task(), run_one_task(), 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()

◆ alpha()

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

Definition at line 249 of file vf_geq.c.

◆ 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.

◆ 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},
}
static int interpolation(DeclickChannel *c, const double *src, int ar_order, double *acoefficients, int *index, int nb_errors, double *auxiliary, double *interpolated)
#define U(x)
Definition vpx_arith.h:37
#define A(x)
Definition vpx_arith.h:28
#define V
Definition avdct.c:32
#define Y
Definition boxblur.h:37
#define FLAGS
Definition cmdutils.c:598
#define NULL
Definition coverity.c:32
#define OFFSET(x)
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition opt.h:298
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition opt.h:258
@ 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:275
#define B
Definition huffyuv.h:42
#define R
Definition huffyuv.h:44
#define G
Definition huffyuv.h:43
@ INTERP_NEAREST
Definition vf_geq.c:44
@ INTERP_BILINEAR
Definition vf_geq.c:45
@ NB_INTERP
Definition vf_geq.c:46

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,
},
}
@ AVMEDIA_TYPE_VIDEO
Definition avutil.h:200
static int geq_config_props(AVFilterLink *inlink)
Definition vf_geq.c:379
static int geq_filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition vf_geq.c:456

Definition at line 520 of file vf_geq.c.

◆ ff_vf_geq

const FFFilter ff_vf_geq
Initial value:
= {
.p.name = "geq",
.p.description = NULL_IF_CONFIG_SMALL("Apply generic equation to each pixel."),
.p.priv_class = &geq_class,
.priv_size = sizeof(GEQContext),
}
int(* init)(AVBSFContext *ctx)
Definition dts2pts.c:608
#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:196
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
Definition avfilter.h:166
static av_cold void uninit(AVBitStreamFilterContext *ctx)
#define FILTER_INPUTS(array)
Definition filters.h:264
#define FILTER_OUTPUTS(array)
Definition filters.h:265
#define FILTER_QUERY_FUNC2(func)
Definition filters.h:241
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition internal.h:88
static av_cold void geq_uninit(AVFilterContext *ctx)
Definition vf_geq.c:508
static const AVFilterPad geq_inputs[]
Definition vf_geq.c:520
static int geq_query_formats(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
Definition vf_geq.c:339
static av_cold int geq_init(AVFilterContext *ctx)
Definition vf_geq.c:256
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

Definition at line 529 of file vf_geq.c.