FFmpeg  4.3.6
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)
 
static av_cold void uninit (AVFilterContext *ctx)
 

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; \
}
This structure describes decoded (raw) audio or video data.
Definition: frame.h:300
const char * name
Definition: qsvenc.c:46
uint8_t w
Definition: llviddspenc.c:38
AVFormatContext * ctx
Definition: movenc.c:48
#define s(width, name)
Definition: cbs_vp9.c:257
cl_device_type type
if(ret< 0)
Definition: vf_mcdeint.c:279
An instance of a filter.
Definition: avfilter.h:338
FILE * out
Definition: movenc.c:54
for(j=16;j >0;--j)

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.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 251 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 }
}
#define NULL
Definition: coverity.c:32
static const struct @315 planes[]
#define VF
Definition: vf_maskfun.c:50
#define OFFSET(x)
Definition: vf_maskfun.c:49

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 }
}
#define NULL
Definition: coverity.c:32
static int config_input(AVFilterLink *inlink)
Definition: vf_maskfun.c:185
static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
Definition: vf_maskfun.c:89

Definition at line 258 of file vf_maskfun.c.

◆ maskfun_outputs

const AVFilterPad maskfun_outputs[]
static
Initial value:
= {
{
.name = "default",
},
{ NULL }
}
#define NULL
Definition: coverity.c:32

Definition at line 269 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,
}
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_maskfun.c:251
#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
static const AVFilterPad maskfun_inputs[]
Definition: vf_maskfun.c:258
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:188
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
Definition: avfilter.h:116
static int query_formats(AVFilterContext *ctx)
Definition: vf_maskfun.c:63
static const AVFilterPad inputs[]
Definition: af_acontrast.c:193
static const AVFilterPad outputs[]
Definition: af_acontrast.c:203
#define flags(name, subs,...)
Definition: cbs_av1.c:565
static const AVFilterPad maskfun_outputs[]
Definition: vf_maskfun.c:269

Definition at line 277 of file vf_maskfun.c.