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)
 
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

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

Definition at line 49 of file vf_maskfun.c.

Definition at line 50 of file vf_maskfun.c.

#define GETSUM (   name,
  type,
  div 
)
Value:
static int getsum##name(AVFilterContext *ctx, AVFrame *out) \
{ \
MaskFunContext *s = ctx->priv; \
uint64_t sum = 0; \
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:295
GLint GLenum type
Definition: opengl_enc.c:104
uint8_t w
Definition: llviddspenc.c:38
AVFormatContext * ctx
Definition: movenc.c:48
#define s(width, name)
Definition: cbs_vp9.c:257
if(ret)
int
An instance of a filter.
Definition: avfilter.h:338
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 the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a it should return
FILE * out
Definition: movenc.c:54
for(j=16;j >0;--j)
const char * name
Definition: opengl_enc.c:102

Definition at line 114 of file vf_maskfun.c.

#define MASKFUN (   name,
  type,
  div 
)

Definition at line 145 of file vf_maskfun.c.

Function Documentation

AVFILTER_DEFINE_CLASS ( maskfun  )
static int query_formats ( AVFilterContext ctx)
static

Definition at line 63 of file vf_maskfun.c.

static int filter_frame ( AVFilterLink inlink,
AVFrame frame 
)
static

Definition at line 89 of file vf_maskfun.c.

static int config_input ( AVFilterLink inlink)
static

Definition at line 185 of file vf_maskfun.c.

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 251 of file vf_maskfun.c.

Variable Documentation

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
#define VF
Definition: vf_maskfun.c:50
#define OFFSET(x)
Definition: vf_maskfun.c:49
static const struct @317 planes[]

Definition at line 52 of file vf_maskfun.c.

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.

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.

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:186
#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 outputs[]
Definition: af_acontrast.c:203
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
#define flags(name, subs,...)
Definition: cbs_av1.c:561
static const AVFilterPad maskfun_outputs[]
Definition: vf_maskfun.c:269

Definition at line 277 of file vf_maskfun.c.