FFmpeg
vf_maskfun.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018 Paul B Mahol
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #include "libavutil/imgutils.h"
22 #include "libavutil/pixdesc.h"
23 #include "libavutil/opt.h"
24 #include "avfilter.h"
25 #include "internal.h"
26 #include "video.h"
27 
28 typedef struct MaskFunContext {
29  const AVClass *class;
30 
31  int low, high;
32  int planes;
33  int fill;
34  int sum;
35 
36  int linesize[4];
37  int planewidth[4], planeheight[4];
38  int nb_planes;
39  int depth;
40  int max;
41  uint64_t max_sum;
42 
45 
47  int (*maskfun)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs);
49 
50 #define OFFSET(x) offsetof(MaskFunContext, x)
51 #define VFT AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
52 
53 static const AVOption maskfun_options[] = {
54  { "low", "set low threshold", OFFSET(low), AV_OPT_TYPE_INT, {.i64=10}, 0, UINT16_MAX, VFT },
55  { "high", "set high threshold", OFFSET(high), AV_OPT_TYPE_INT, {.i64=10}, 0, UINT16_MAX, VFT },
56  { "planes", "set planes", OFFSET(planes), AV_OPT_TYPE_INT, {.i64=0xF}, 0, 0xF, VFT },
57  { "fill", "set fill value", OFFSET(fill), AV_OPT_TYPE_INT, {.i64=0}, 0, UINT16_MAX, VFT },
58  { "sum", "set sum value", OFFSET(sum), AV_OPT_TYPE_INT, {.i64=10}, 0, UINT16_MAX, VFT },
59  { NULL }
60 };
61 
62 AVFILTER_DEFINE_CLASS(maskfun);
63 
64 static const enum AVPixelFormat pix_fmts[] = {
83 };
84 
86 {
87  AVFilterContext *ctx = inlink->dst;
88  MaskFunContext *s = ctx->priv;
89  AVFilterLink *outlink = ctx->outputs[0];
90  AVFrame *out;
91 
92  if (s->getsum(ctx, in)) {
93  AVFrame *out = av_frame_clone(s->empty);
94 
95  if (!out) {
96  av_frame_free(&in);
97  return AVERROR(ENOMEM);
98  }
99  out->pts = in->pts;
100  av_frame_free(&in);
101 
102  return ff_filter_frame(outlink, out);
103  }
104 
105  if (av_frame_is_writable(in)) {
106  out = in;
107  } else {
108  out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
109  if (!out)
110  return AVERROR(ENOMEM);
112  }
113 
114  s->in = in;
115  ff_filter_execute(ctx, s->maskfun, out, NULL,
116  FFMIN(s->planeheight[1], ff_filter_get_nb_threads(ctx)));
117 
118  if (out != in)
119  av_frame_free(&in);
120  return ff_filter_frame(outlink, out);
121 }
122 
123 #define GETSUM(name, type, div) \
124 static int getsum##name(AVFilterContext *ctx, AVFrame *out) \
125 { \
126  MaskFunContext *s = ctx->priv; \
127  uint64_t sum = 0; \
128  int p; \
129  \
130  for (p = 0; p < s->nb_planes; p++) { \
131  const int linesize = out->linesize[p] / div; \
132  const int w = s->planewidth[p]; \
133  const int h = s->planeheight[p]; \
134  type *dst = (type *)out->data[p]; \
135  \
136  if (!((1 << p) & s->planes)) \
137  continue; \
138  \
139  for (int y = 0; y < h; y++) { \
140  for (int x = 0; x < w; x++) \
141  sum += dst[x]; \
142  if (sum >= s->max_sum) \
143  return 1; \
144  dst += linesize; \
145  } \
146  } \
147  \
148  return 0; \
149 }
150 
151 GETSUM(8, uint8_t, 1)
152 GETSUM(16, uint16_t, 2)
153 
154 #define MASKFUN(name, type, div) \
155 static int maskfun##name(AVFilterContext *ctx, void *arg, \
156  int jobnr, int nb_jobs) \
157 { \
158  MaskFunContext *s = ctx->priv; \
159  AVFrame *in = s->in; \
160  AVFrame *out = arg; \
161  const int low = s->low; \
162  const int high = s->high; \
163  const int max = s->max; \
164  int p; \
165  \
166  for (p = 0; p < s->nb_planes; p++) { \
167  const int src_linesize = in->linesize[p] / div; \
168  const int linesize = out->linesize[p] / div; \
169  const int w = s->planewidth[p]; \
170  const int h = s->planeheight[p]; \
171  const int slice_start = (h * jobnr) / nb_jobs; \
172  const int slice_end = (h * (jobnr+1)) / nb_jobs; \
173  const type *src = (type *)in->data[p] + \
174  slice_start * src_linesize; \
175  type *dst = (type *)out->data[p] + \
176  slice_start * linesize; \
177  \
178  if (!((1 << p) & s->planes)) \
179  continue; \
180  \
181  for (int y = slice_start; y < slice_end; y++) { \
182  for (int x = 0; x < w; x++) { \
183  dst[x] = src[x]; \
184  if (dst[x] <= low) \
185  dst[x] = 0; \
186  else if (dst[x] > high) \
187  dst[x] = max; \
188  } \
189  \
190  src += src_linesize; \
191  dst += linesize; \
192  } \
193  } \
194  \
195  return 0; \
196 }
197 
198 MASKFUN(8, uint8_t, 1)
199 MASKFUN(16, uint16_t, 2)
200 
202 {
203  MaskFunContext *s = ctx->priv;
204 
205  s->fill = FFMIN(s->fill, s->max);
206  if (s->depth == 8) {
207  for (int p = 0; p < s->nb_planes; p++) {
208  uint8_t *dst = s->empty->data[p];
209 
210  for (int y = 0; y < s->planeheight[p]; y++) {
211  memset(dst, s->fill, s->planewidth[p]);
212  dst += s->empty->linesize[p];
213  }
214  }
215  } else {
216  for (int p = 0; p < s->nb_planes; p++) {
217  uint16_t *dst = (uint16_t *)s->empty->data[p];
218 
219  for (int y = 0; y < s->planeheight[p]; y++) {
220  for (int x = 0; x < s->planewidth[p]; x++)
221  dst[x] = s->fill;
222  dst += s->empty->linesize[p] / 2;
223  }
224  }
225  }
226 }
227 
229 {
230  MaskFunContext *s = ctx->priv;
231 
232  s->max_sum = 0;
233  for (int p = 0; p < s->nb_planes; p++) {
234  if (!((1 << p) & s->planes))
235  continue;
236  s->max_sum += (uint64_t)s->sum * s->planewidth[p] * s->planeheight[p];
237  }
238 }
239 
241 {
242  AVFilterContext *ctx = inlink->dst;
243  MaskFunContext *s = ctx->priv;
245  int vsub, hsub, ret;
246 
247  s->nb_planes = av_pix_fmt_count_planes(inlink->format);
248 
249  if ((ret = av_image_fill_linesizes(s->linesize, inlink->format, inlink->w)) < 0)
250  return ret;
251 
252  hsub = desc->log2_chroma_w;
253  vsub = desc->log2_chroma_h;
254  s->planeheight[1] = s->planeheight[2] = AV_CEIL_RSHIFT(inlink->h, vsub);
255  s->planeheight[0] = s->planeheight[3] = inlink->h;
256  s->planewidth[1] = s->planewidth[2] = AV_CEIL_RSHIFT(inlink->w, hsub);
257  s->planewidth[0] = s->planewidth[3] = inlink->w;
258 
259  s->depth = desc->comp[0].depth;
260  s->max = (1 << s->depth) - 1;
261 
262  if (s->depth == 8) {
263  s->maskfun = maskfun8;
264  s->getsum = getsum8;
265  } else {
266  s->maskfun = maskfun16;
267  s->getsum = getsum16;
268  }
269 
270  s->empty = ff_get_video_buffer(inlink, inlink->w, inlink->h);
271  if (!s->empty)
272  return AVERROR(ENOMEM);
273 
274  fill_frame(ctx);
275 
276  set_max_sum(ctx);
277 
278  return 0;
279 }
280 
281 static int process_command(AVFilterContext *ctx, const char *cmd, const char *args,
282  char *res, int res_len, int flags)
283 {
284  MaskFunContext *s = ctx->priv;
285  int fill = s->fill;
286  int sum = s->sum;
287  int ret;
288 
289  ret = ff_filter_process_command(ctx, cmd, args, res, res_len, flags);
290  if (ret < 0)
291  return ret;
292 
293  if (sum != s->sum)
294  set_max_sum(ctx);
295 
296  if (fill != s->fill)
297  fill_frame(ctx);
298 
299  return 0;
300 }
301 
303 {
304  MaskFunContext *s = ctx->priv;
305 
306  av_frame_free(&s->empty);
307 }
308 
309 static const AVFilterPad maskfun_inputs[] = {
310  {
311  .name = "default",
312  .type = AVMEDIA_TYPE_VIDEO,
314  .filter_frame = filter_frame,
315  .config_props = config_input,
316  },
317 };
318 
320  .name = "maskfun",
321  .description = NULL_IF_CONFIG_SMALL("Create Mask."),
322  .priv_size = sizeof(MaskFunContext),
323  .uninit = uninit,
327  .priv_class = &maskfun_class,
329  .process_command = process_command,
330 };
fill_frame
static void fill_frame(AVFilterContext *ctx)
Definition: vf_maskfun.c:201
ff_get_video_buffer
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
Definition: video.c:112
AV_PIX_FMT_YUVA422P16
#define AV_PIX_FMT_YUVA422P16
Definition: pixfmt.h:522
AV_PIX_FMT_GBRAP16
#define AV_PIX_FMT_GBRAP16
Definition: pixfmt.h:501
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:71
AVERROR
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
opt.h
out
FILE * out
Definition: movenc.c:55
MaskFunContext::empty
AVFrame * empty
Definition: vf_maskfun.c:44
ff_filter_frame
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition: avfilter.c:1015
av_pix_fmt_desc_get
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2965
FILTER_PIXFMTS_ARRAY
#define FILTER_PIXFMTS_ARRAY(array)
Definition: internal.h:162
inlink
The exact code depends on how similar the blocks are and how related they are to the and needs to apply these operations to the correct inlink or outlink if there are several Macros are available to factor that when no extra processing is inlink
Definition: filter_design.txt:212
process_command
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
Definition: vf_maskfun.c:281
av_frame_free
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:160
AV_PIX_FMT_YUVA422P9
#define AV_PIX_FMT_YUVA422P9
Definition: pixfmt.h:514
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:374
pixdesc.h
AVFrame::pts
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
Definition: frame.h:486
AV_PIX_FMT_YUVA420P16
#define AV_PIX_FMT_YUVA420P16
Definition: pixfmt.h:521
AV_PIX_FMT_YUVA420P10
#define AV_PIX_FMT_YUVA420P10
Definition: pixfmt.h:516
AVOption
AVOption.
Definition: opt.h:357
MaskFunContext::low
int low
Definition: vf_maskfun.c:31
AV_PIX_FMT_YUV420P10
#define AV_PIX_FMT_YUV420P10
Definition: pixfmt.h:478
high
int high
Definition: dovi_rpuenc.c:38
AV_PIX_FMT_YUV440P
@ AV_PIX_FMT_YUV440P
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
Definition: pixfmt.h:106
AVFilter::name
const char * name
Filter name.
Definition: avfilter.h:170
video.h
AV_PIX_FMT_YUVA422P10
#define AV_PIX_FMT_YUVA422P10
Definition: pixfmt.h:517
AV_PIX_FMT_GRAY9
#define AV_PIX_FMT_GRAY9
Definition: pixfmt.h:458
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_maskfun.c:302
hsub
static void hsub(htype *dst, const htype *src, int bins)
Definition: vf_median.c:74
av_pix_fmt_count_planes
int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:3005
AV_PIX_FMT_YUVA420P9
#define AV_PIX_FMT_YUVA420P9
Definition: pixfmt.h:513
AV_PIX_FMT_GBRP14
#define AV_PIX_FMT_GBRP14
Definition: pixfmt.h:496
AV_PIX_FMT_GBRAP
@ AV_PIX_FMT_GBRAP
planar GBRA 4:4:4:4 32bpp
Definition: pixfmt.h:212
AV_PIX_FMT_GBRP10
#define AV_PIX_FMT_GBRP10
Definition: pixfmt.h:494
AV_PIX_FMT_YUVA444P16
#define AV_PIX_FMT_YUVA444P16
Definition: pixfmt.h:523
AV_PIX_FMT_YUV422P9
#define AV_PIX_FMT_YUV422P9
Definition: pixfmt.h:476
OFFSET
#define OFFSET(x)
Definition: vf_maskfun.c:50
AV_PIX_FMT_GRAY16
#define AV_PIX_FMT_GRAY16
Definition: pixfmt.h:462
AVFilterPad
A filter pad used for either input or output.
Definition: internal.h:33
AV_PIX_FMT_YUV444P10
#define AV_PIX_FMT_YUV444P10
Definition: pixfmt.h:481
AV_PIX_FMT_YUVJ411P
@ AV_PIX_FMT_YUVJ411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) full scale (JPEG), deprecated in favor ...
Definition: pixfmt.h:283
av_cold
#define av_cold
Definition: attributes.h:90
AV_PIX_FMT_YUV422P16
#define AV_PIX_FMT_YUV422P16
Definition: pixfmt.h:490
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
AV_PIX_FMT_YUVJ422P
@ AV_PIX_FMT_YUVJ422P
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
Definition: pixfmt.h:86
AV_PIX_FMT_GBRAP10
#define AV_PIX_FMT_GBRAP10
Definition: pixfmt.h:498
planes
static const struct @417 planes[]
av_image_fill_linesizes
int av_image_fill_linesizes(int linesizes[4], enum AVPixelFormat pix_fmt, int width)
Fill plane linesizes for an image with pixel format pix_fmt and width width.
Definition: imgutils.c:89
config_input
static int config_input(AVFilterLink *inlink)
Definition: vf_maskfun.c:240
s
#define s(width, name)
Definition: cbs_vp9.c:198
AV_PIX_FMT_GBRAP12
#define AV_PIX_FMT_GBRAP12
Definition: pixfmt.h:499
AV_PIX_FMT_YUVA420P
@ AV_PIX_FMT_YUVA420P
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
Definition: pixfmt.h:108
AV_PIX_FMT_YUV444P16
#define AV_PIX_FMT_YUV444P16
Definition: pixfmt.h:491
AV_CEIL_RSHIFT
#define AV_CEIL_RSHIFT(a, b)
Definition: common.h:59
AV_PIX_FMT_YUV420P9
#define AV_PIX_FMT_YUV420P9
Definition: pixfmt.h:475
ff_vf_maskfun
const AVFilter ff_vf_maskfun
Definition: vf_maskfun.c:319
AV_PIX_FMT_YUV420P16
#define AV_PIX_FMT_YUV420P16
Definition: pixfmt.h:489
ctx
AVFormatContext * ctx
Definition: movenc.c:49
AV_PIX_FMT_GRAY14
#define AV_PIX_FMT_GRAY14
Definition: pixfmt.h:461
av_frame_clone
AVFrame * av_frame_clone(const AVFrame *src)
Create a new frame that references the same data as src.
Definition: frame.c:593
AV_PIX_FMT_YUV420P
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:73
maskfun_inputs
static const AVFilterPad maskfun_inputs[]
Definition: vf_maskfun.c:309
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:182
MASKFUN
#define MASKFUN(name, type, div)
Definition: vf_maskfun.c:154
AV_PIX_FMT_YUVJ444P
@ AV_PIX_FMT_YUVJ444P
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
Definition: pixfmt.h:87
MaskFunContext::in
AVFrame * in
Definition: vf_maskfun.c:43
arg
const char * arg
Definition: jacosubdec.c:67
AV_PIX_FMT_GRAY10
#define AV_PIX_FMT_GRAY10
Definition: pixfmt.h:459
AVFILTER_DEFINE_CLASS
AVFILTER_DEFINE_CLASS(maskfun)
AV_PIX_FMT_GBRP16
#define AV_PIX_FMT_GBRP16
Definition: pixfmt.h:497
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:66
NULL
#define NULL
Definition: coverity.c:32
av_frame_copy_props
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
Definition: frame.c:709
AV_PIX_FMT_YUVJ420P
@ AV_PIX_FMT_YUVJ420P
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
Definition: pixfmt.h:85
MaskFunContext::max_sum
uint64_t max_sum
Definition: vf_maskfun.c:41
MaskFunContext::sum
int sum
Definition: vf_maskfun.c:34
AV_PIX_FMT_YUV422P10
#define AV_PIX_FMT_YUV422P10
Definition: pixfmt.h:479
AV_PIX_FMT_GRAY8
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
Definition: pixfmt.h:81
AV_PIX_FMT_GBRP9
#define AV_PIX_FMT_GBRP9
Definition: pixfmt.h:493
set_max_sum
static void set_max_sum(AVFilterContext *ctx)
Definition: vf_maskfun.c:228
MaskFunContext::planewidth
int planewidth[4]
Definition: vf_maskfun.c:37
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
for
for(k=2;k<=8;++k)
Definition: h264pred_template.c:425
AV_PIX_FMT_YUV422P12
#define AV_PIX_FMT_YUV422P12
Definition: pixfmt.h:483
AV_PIX_FMT_YUV444P12
#define AV_PIX_FMT_YUV444P12
Definition: pixfmt.h:485
av_frame_is_writable
int av_frame_is_writable(AVFrame *frame)
Check if the frame data is writable.
Definition: frame.c:645
ff_filter_process_command
int ff_filter_process_command(AVFilterContext *ctx, const char *cmd, const char *arg, char *res, int res_len, int flags)
Generic processing of user supplied commands that are set in the same way as the filter options.
Definition: avfilter.c:887
AV_PIX_FMT_YUVA444P
@ AV_PIX_FMT_YUVA444P
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
Definition: pixfmt.h:174
pix_fmts
static enum AVPixelFormat pix_fmts[]
Definition: vf_maskfun.c:64
AV_PIX_FMT_YUVA444P10
#define AV_PIX_FMT_YUVA444P10
Definition: pixfmt.h:518
MaskFunContext::linesize
int linesize[4]
Definition: vf_maskfun.c:36
internal.h
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:147
MaskFunContext::maskfun
int(* maskfun)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
Definition: vf_maskfun.c:47
MaskFunContext::max
int max
Definition: vf_maskfun.c:40
AV_PIX_FMT_GBRP12
#define AV_PIX_FMT_GBRP12
Definition: pixfmt.h:495
maskfun_options
static const AVOption maskfun_options[]
Definition: vf_maskfun.c:53
ff_filter_get_nb_threads
int ff_filter_get_nb_threads(AVFilterContext *ctx)
Get number of threads for current filter instance.
Definition: avfilter.c:827
MaskFunContext::depth
int depth
Definition: vf_maskfun.c:39
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: vf_maskfun.c:85
FFMIN
#define FFMIN(a, b)
Definition: macros.h:49
AV_PIX_FMT_YUVJ440P
@ AV_PIX_FMT_YUVJ440P
planar YUV 4:4:0 full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV440P and setting color_range
Definition: pixfmt.h:107
AVFilterPad::name
const char * name
Pad name.
Definition: internal.h:39
MaskFunContext::fill
int fill
Definition: vf_maskfun.c:33
AV_PIX_FMT_YUV444P9
#define AV_PIX_FMT_YUV444P9
Definition: pixfmt.h:477
VFT
#define VFT
Definition: vf_maskfun.c:51
AVFilter
Filter definition.
Definition: avfilter.h:166
ret
ret
Definition: filter_design.txt:187
MaskFunContext::planeheight
int planeheight[4]
Definition: vf_maskfun.c:37
AV_PIX_FMT_YUVA444P9
#define AV_PIX_FMT_YUVA444P9
Definition: pixfmt.h:515
MaskFunContext::nb_planes
int nb_planes
Definition: vf_maskfun.c:38
AV_PIX_FMT_YUV420P12
#define AV_PIX_FMT_YUV420P12
Definition: pixfmt.h:482
AV_PIX_FMT_YUV422P14
#define AV_PIX_FMT_YUV422P14
Definition: pixfmt.h:487
MaskFunContext::high
int high
Definition: vf_maskfun.c:31
MaskFunContext::getsum
int(* getsum)(AVFilterContext *ctx, AVFrame *out)
Definition: vf_maskfun.c:46
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:72
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:245
avfilter.h
AV_PIX_FMT_YUV444P
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:78
AVFilterContext
An instance of a filter.
Definition: avfilter.h:407
AV_PIX_FMT_GBRP
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
Definition: pixfmt.h:165
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:117
desc
const char * desc
Definition: libsvtav1.c:79
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
AV_PIX_FMT_YUV422P
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:77
AVPixFmtDescriptor
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition: pixdesc.h:69
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:183
AV_PIX_FMT_YUV411P
@ AV_PIX_FMT_YUV411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
Definition: pixfmt.h:80
imgutils.h
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:474
AV_PIX_FMT_YUV410P
@ AV_PIX_FMT_YUV410P
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
Definition: pixfmt.h:79
AV_PIX_FMT_YUV440P12
#define AV_PIX_FMT_YUV440P12
Definition: pixfmt.h:484
AV_PIX_FMT_YUV444P14
#define AV_PIX_FMT_YUV444P14
Definition: pixfmt.h:488
MaskFunContext::planes
int planes
Definition: vf_maskfun.c:32
AV_PIX_FMT_GRAY12
#define AV_PIX_FMT_GRAY12
Definition: pixfmt.h:460
ff_filter_execute
static av_always_inline int ff_filter_execute(AVFilterContext *ctx, avfilter_action_func *func, void *arg, int *ret, int nb_jobs)
Definition: internal.h:134
int
int
Definition: ffmpeg_filter.c:424
AV_PIX_FMT_YUVA422P
@ AV_PIX_FMT_YUVA422P
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
Definition: pixfmt.h:173
AV_PIX_FMT_YUV420P14
#define AV_PIX_FMT_YUV420P14
Definition: pixfmt.h:486
MaskFunContext
Definition: vf_maskfun.c:28
GETSUM
#define GETSUM(name, type, div)
Definition: vf_maskfun.c:123
AVFILTERPAD_FLAG_NEEDS_WRITABLE
#define AVFILTERPAD_FLAG_NEEDS_WRITABLE
The filter expects writable frames from its input link, duplicating data buffers if needed.
Definition: internal.h:52