FFmpeg
Data Structures | Macros | Functions | Variables
vf_maskfun.c File Reference
#include "libavutil/imgutils.h"
#include "libavutil/pixdesc.h"
#include "libavutil/opt.h"
#include "avfilter.h"
#include "formats.h"
#include "internal.h"
#include "video.h"

Go to the source code of this file.

Data Structures

struct  MaskFunContext
 

Macros

#define OFFSET(x)   offsetof(MaskFunContext, x)
 
#define VF   AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
 
#define GETSUM(name, type, div)
 
#define MASKFUN(name, type, div)
 

Functions

 AVFILTER_DEFINE_CLASS (maskfun)
 
static int query_formats (AVFilterContext *ctx)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *frame)
 
static int config_input (AVFilterLink *inlink)
 

Variables

static const AVOption maskfun_options []
 
static const AVFilterPad maskfun_inputs []
 
static const AVFilterPad maskfun_outputs []
 
AVFilter ff_vf_maskfun
 

Macro Definition Documentation

◆ OFFSET

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

Definition at line 49 of file vf_maskfun.c.

◆ VF

Definition at line 50 of file vf_maskfun.c.

◆ GETSUM

#define GETSUM (   name,
  type,
  div 
)
Value:
static int getsum##name(AVFilterContext *ctx, AVFrame *out) \
{ \
MaskFunContext *s = ctx->priv; \
uint64_t sum = 0; \
int p; \
for (p = 0; p < s->nb_planes; p++) { \
const int linesize = out->linesize[p] / div; \
const int w = s->width[p]; \
const int h = s->height[p]; \
type *dst = (type *)out->data[p]; \
\
if (!((1 << p) & s->planes)) \
continue; \
for (int y = 0; y < h; y++) { \
for (int x = 0; x < w; x++) \
sum += dst[x]; \
if (sum >= s->max_sum) \
return 1; \
dst += linesize; \
} \
} \
\
return 0; \
}

Definition at line 114 of file vf_maskfun.c.

◆ MASKFUN

#define MASKFUN (   name,
  type,
  div 
)

Definition at line 145 of file vf_maskfun.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( maskfun  )

◆ query_formats()

static int query_formats ( AVFilterContext ctx)
static

Definition at line 63 of file vf_maskfun.c.

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame frame 
)
static

Definition at line 89 of file vf_maskfun.c.

◆ config_input()

static int config_input ( AVFilterLink inlink)
static

Definition at line 185 of file vf_maskfun.c.

Variable Documentation

◆ maskfun_options

const AVOption maskfun_options[]
static
Initial value:
= {
{ "low", "set low threshold", OFFSET(low), AV_OPT_TYPE_INT, {.i64=10}, 0, UINT16_MAX, VF },
{ "high", "set high threshold", OFFSET(high), AV_OPT_TYPE_INT, {.i64=10}, 0, UINT16_MAX, VF },
{ "planes", "set planes", OFFSET(planes), AV_OPT_TYPE_INT, {.i64=0xF}, 0, 0xF, VF },
{ "fill", "set fill value", OFFSET(fill), AV_OPT_TYPE_INT, {.i64=0}, 0, UINT16_MAX, VF },
{ "sum", "set sum value", OFFSET(sum), AV_OPT_TYPE_INT, {.i64=10}, 0, UINT16_MAX, VF },
{ NULL }
}

Definition at line 52 of file vf_maskfun.c.

◆ maskfun_inputs

const AVFilterPad maskfun_inputs[]
static
Initial value:
= {
{
.name = "default",
.filter_frame = filter_frame,
.config_props = config_input,
.needs_writable = 1,
},
{ NULL }
}

Definition at line 251 of file vf_maskfun.c.

◆ maskfun_outputs

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

Definition at line 262 of file vf_maskfun.c.

◆ ff_vf_maskfun

AVFilter ff_vf_maskfun
Initial value:
= {
.name = "maskfun",
.description = NULL_IF_CONFIG_SMALL("Create Mask."),
.priv_size = sizeof(MaskFunContext),
.priv_class = &maskfun_class,
}

Definition at line 270 of file vf_maskfun.c.

out
FILE * out
Definition: movenc.c:54
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:295
w
uint8_t w
Definition: llviddspenc.c:38
name
const char * name
Definition: avisynth_c.h:867
maskfun_outputs
static const AVFilterPad maskfun_outputs[]
Definition: vf_maskfun.c:262
type
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
Definition: writing_filters.txt:86
OFFSET
#define OFFSET(x)
Definition: vf_maskfun.c:49
config_input
static int config_input(AVFilterLink *inlink)
Definition: vf_maskfun.c:185
s
#define s(width, name)
Definition: cbs_vp9.c:257
outputs
static const AVFilterPad outputs[]
Definition: af_acontrast.c:203
ctx
AVFormatContext * ctx
Definition: movenc.c:48
maskfun_inputs
static const AVFilterPad maskfun_inputs[]
Definition: vf_maskfun.c:251
if
if(ret)
Definition: filter_design.txt:179
NULL
#define NULL
Definition: coverity.c:32
inputs
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several inputs
Definition: filter_design.txt:243
for
for(j=16;j >0;--j)
Definition: h264pred_template.c:469
planes
static const struct @314 planes[]
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:188
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:125
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
Definition: vf_maskfun.c:89
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:223
AVFilterContext
An instance of a filter.
Definition: avfilter.h:338
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:116
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:565
query_formats
static int query_formats(AVFilterContext *ctx)
Definition: vf_maskfun.c:63
h
h
Definition: vp9dsp_template.c:2038
thread_data::p
int p
Definition: vf_nlmeans.c:340
VF
#define VF
Definition: vf_maskfun.c:50
MaskFunContext
Definition: vf_maskfun.c:29