FFmpeg  4.1.11
vf_floodfill.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 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/opt.h"
22 #include "libavutil/imgutils.h"
23 #include "libavutil/intreadwrite.h"
24 #include "avfilter.h"
25 #include "formats.h"
26 #include "internal.h"
27 #include "video.h"
28 
29 typedef struct Points {
30  uint16_t x, y;
31 } Points;
32 
33 typedef struct FloodfillContext {
34  const AVClass *class;
35 
36  int x, y;
37  int s[4];
38  int d[4];
39 
40  int nb_planes;
41  int back, front;
43 
44  int (*is_same)(AVFrame *frame, int x, int y,
45  unsigned s0, unsigned s1, unsigned s2, unsigned s3);
46  void (*set_pixel)(AVFrame *frame, int x, int y,
47  unsigned d0, unsigned d1, unsigned d2, unsigned d3);
48  void (*pick_pixel)(AVFrame *frame, int x, int y,
49  int *s0, int *s1, int *s2, int *s3);
51 
52 static int is_inside(int x, int y, int w, int h)
53 {
54  if (x >= 0 && x < w && y >= 0 && y < h)
55  return 1;
56  return 0;
57 }
58 
59 static int is_same4(AVFrame *frame, int x, int y,
60  unsigned s0, unsigned s1, unsigned s2, unsigned s3)
61 {
62  unsigned c0 = frame->data[0][y * frame->linesize[0] + x];
63  unsigned c1 = frame->data[1][y * frame->linesize[1] + x];
64  unsigned c2 = frame->data[2][y * frame->linesize[2] + x];
65  unsigned c3 = frame->data[3][y * frame->linesize[3] + x];
66 
67  if (s0 == c0 && s1 == c1 && s2 == c2 && s3 == c3)
68  return 1;
69  return 0;
70 }
71 
72 static int is_same4_16(AVFrame *frame, int x, int y,
73  unsigned s0, unsigned s1, unsigned s2, unsigned s3)
74 {
75  unsigned c0 = AV_RN16(frame->data[0] + y * frame->linesize[0] + 2 * x);
76  unsigned c1 = AV_RN16(frame->data[1] + y * frame->linesize[1] + 2 * x);
77  unsigned c2 = AV_RN16(frame->data[2] + y * frame->linesize[2] + 2 * x);
78  unsigned c3 = AV_RN16(frame->data[3] + y * frame->linesize[3] + 2 * x);
79 
80  if (s0 == c0 && s1 == c1 && s2 == c2 && s3 == c3)
81  return 1;
82  return 0;
83 }
84 
85 static int is_same3(AVFrame *frame, int x, int y,
86  unsigned s0, unsigned s1, unsigned s2, unsigned s3)
87 {
88  unsigned c0 = frame->data[0][y * frame->linesize[0] + x];
89  unsigned c1 = frame->data[1][y * frame->linesize[1] + x];
90  unsigned c2 = frame->data[2][y * frame->linesize[2] + x];
91 
92  if (s0 == c0 && s1 == c1 && s2 == c2)
93  return 1;
94  return 0;
95 }
96 
97 static int is_same3_16(AVFrame *frame, int x, int y,
98  unsigned s0, unsigned s1, unsigned s2, unsigned s3)
99 {
100  unsigned c0 = AV_RN16(frame->data[0] + y * frame->linesize[0] + 2 * x);
101  unsigned c1 = AV_RN16(frame->data[1] + y * frame->linesize[1] + 2 * x);
102  unsigned c2 = AV_RN16(frame->data[2] + y * frame->linesize[2] + 2 * x);
103 
104  if (s0 == c0 && s1 == c1 && s2 == c2)
105  return 1;
106  return 0;
107 }
108 
109 static int is_same1(AVFrame *frame, int x, int y,
110  unsigned s0, unsigned s1, unsigned s2, unsigned s3)
111 {
112  unsigned c0 = frame->data[0][y * frame->linesize[0] + x];
113 
114  if (s0 == c0)
115  return 1;
116  return 0;
117 }
118 
119 static int is_same1_16(AVFrame *frame, int x, int y,
120  unsigned s0, unsigned s1, unsigned s2, unsigned s3)
121 {
122  unsigned c0 = AV_RN16(frame->data[0] + y * frame->linesize[0] + 2 * x);
123 
124  if (s0 == c0)
125  return 1;
126  return 0;
127 }
128 
129 static void set_pixel1(AVFrame *frame, int x, int y,
130  unsigned d0, unsigned d1, unsigned d2, unsigned d3)
131 {
132  frame->data[0][y * frame->linesize[0] + x] = d0;
133 }
134 
135 static void set_pixel1_16(AVFrame *frame, int x, int y,
136  unsigned d0, unsigned d1, unsigned d2, unsigned d3)
137 {
138  AV_WN16(frame->data[0] + y * frame->linesize[0] + 2 * x, d0);
139 }
140 
141 static void set_pixel3(AVFrame *frame, int x, int y,
142  unsigned d0, unsigned d1, unsigned d2, unsigned d3)
143 {
144  frame->data[0][y * frame->linesize[0] + x] = d0;
145  frame->data[1][y * frame->linesize[1] + x] = d1;
146  frame->data[2][y * frame->linesize[2] + x] = d2;
147 }
148 
149 static void set_pixel3_16(AVFrame *frame, int x, int y,
150  unsigned d0, unsigned d1, unsigned d2, unsigned d3)
151 {
152  AV_WN16(frame->data[0] + y * frame->linesize[0] + 2 * x, d0);
153  AV_WN16(frame->data[1] + y * frame->linesize[1] + 2 * x, d1);
154  AV_WN16(frame->data[2] + y * frame->linesize[2] + 2 * x, d2);
155 }
156 
157 static void set_pixel4(AVFrame *frame, int x, int y,
158  unsigned d0, unsigned d1, unsigned d2, unsigned d3)
159 {
160  frame->data[0][y * frame->linesize[0] + x] = d0;
161  frame->data[1][y * frame->linesize[1] + x] = d1;
162  frame->data[2][y * frame->linesize[2] + x] = d2;
163  frame->data[3][y * frame->linesize[3] + x] = d3;
164 }
165 
166 static void set_pixel4_16(AVFrame *frame, int x, int y,
167  unsigned d0, unsigned d1, unsigned d2, unsigned d3)
168 {
169  AV_WN16(frame->data[0] + y * frame->linesize[0] + 2 * x, d0);
170  AV_WN16(frame->data[1] + y * frame->linesize[1] + 2 * x, d1);
171  AV_WN16(frame->data[2] + y * frame->linesize[2] + 2 * x, d2);
172  AV_WN16(frame->data[3] + y * frame->linesize[3] + 2 * x, d3);
173 }
174 
175 static void pick_pixel1(AVFrame *frame, int x, int y,
176  int *s0, int *s1, int *s2, int *s3)
177 {
178  if (*s0 < 0)
179  *s0 = frame->data[0][y * frame->linesize[0] + x];
180 }
181 
182 static void pick_pixel1_16(AVFrame *frame, int x, int y,
183  int *s0, int *s1, int *s2, int *s3)
184 {
185  if (*s0 < 0)
186  *s0 = AV_RN16(frame->data[0] + y * frame->linesize[0] + 2 * x);
187 }
188 
189 static void pick_pixel3(AVFrame *frame, int x, int y,
190  int *s0, int *s1, int *s2, int *s3)
191 {
192  if (*s0 < 0)
193  *s0 = frame->data[0][y * frame->linesize[0] + x];
194  if (*s1 < 0)
195  *s1 = frame->data[1][y * frame->linesize[1] + x];
196  if (*s2 < 0)
197  *s2 = frame->data[2][y * frame->linesize[2] + x];
198 }
199 
200 static void pick_pixel3_16(AVFrame *frame, int x, int y,
201  int *s0, int *s1, int *s2, int *s3)
202 {
203  if (*s0 < 0)
204  *s0 = AV_RN16(frame->data[0] + y * frame->linesize[0] + 2 * x);
205  if (*s1 < 0)
206  *s1 = AV_RN16(frame->data[1] + y * frame->linesize[1] + 2 * x);
207  if (*s2 < 0)
208  *s2 = AV_RN16(frame->data[2] + y * frame->linesize[2] + 2 * x);
209 }
210 
211 static void pick_pixel4(AVFrame *frame, int x, int y,
212  int *s0, int *s1, int *s2, int *s3)
213 {
214  if (*s0 < 0)
215  *s0 = frame->data[0][y * frame->linesize[0] + x];
216  if (*s1 < 0)
217  *s1 = frame->data[1][y * frame->linesize[1] + x];
218  if (*s2 < 0)
219  *s2 = frame->data[2][y * frame->linesize[2] + x];
220  if (*s3 < 0)
221  *s3 = frame->data[3][y * frame->linesize[3] + x];
222 }
223 
224 static void pick_pixel4_16(AVFrame *frame, int x, int y,
225  int *s0, int *s1, int *s2, int *s3)
226 {
227  if (*s0 < 0)
228  *s0 = AV_RN16(frame->data[0] + y * frame->linesize[0] + 2 * x);
229  if (*s1 < 0)
230  *s1 = AV_RN16(frame->data[1] + y * frame->linesize[1] + 2 * x);
231  if (*s2 < 0)
232  *s2 = AV_RN16(frame->data[2] + y * frame->linesize[2] + 2 * x);
233  if (*s3 < 0)
234  *s3 = AV_RN16(frame->data[3] + y * frame->linesize[3] + 2 * x);
235 }
236 
237 static int config_input(AVFilterLink *inlink)
238 {
240  AVFilterContext *ctx = inlink->dst;
241  FloodfillContext *s = ctx->priv;
242  int depth;
243 
245  depth = desc->comp[0].depth;
246  if (depth == 8) {
247  switch (s->nb_planes) {
248  case 1: s->set_pixel = set_pixel1;
249  s->is_same = is_same1;
250  s->pick_pixel = pick_pixel1; break;
251  case 3: s->set_pixel = set_pixel3;
252  s->is_same = is_same3;
253  s->pick_pixel = pick_pixel3; break;
254  case 4: s->set_pixel = set_pixel4;
255  s->is_same = is_same4;
256  s->pick_pixel = pick_pixel4; break;
257  }
258  } else {
259  switch (s->nb_planes) {
260  case 1: s->set_pixel = set_pixel1_16;
261  s->is_same = is_same1_16;
262  s->pick_pixel = pick_pixel1_16; break;
263  case 3: s->set_pixel = set_pixel3_16;
264  s->is_same = is_same3_16;
265  s->pick_pixel = pick_pixel3_16; break;
266  case 4: s->set_pixel = set_pixel4_16;
267  s->is_same = is_same4_16;
268  s->pick_pixel = pick_pixel4_16; break;
269  }
270  }
271 
272  s->front = s->back = 0;
273  s->points = av_calloc(inlink->w * inlink->h, 4 * sizeof(Points));
274  if (!s->points)
275  return AVERROR(ENOMEM);
276 
277  return 0;
278 }
279 
281 {
282  AVFilterContext *ctx = link->dst;
283  FloodfillContext *s = ctx->priv;
284  const unsigned d0 = s->d[0];
285  const unsigned d1 = s->d[1];
286  const unsigned d2 = s->d[2];
287  const unsigned d3 = s->d[3];
288  int s0 = s->s[0];
289  int s1 = s->s[1];
290  int s2 = s->s[2];
291  int s3 = s->s[3];
292  const int w = frame->width;
293  const int h = frame->height;
294  int i, ret;
295 
296  for (i = 0; i < s->nb_planes; i++) {
297  if (s->s[i] != s->d[i])
298  break;
299  }
300 
301  if (i == s->nb_planes)
302  goto end;
303 
304  if (ret = av_frame_make_writable(frame))
305  return ret;
306 
307  if (is_inside(s->x, s->y, w, h)) {
308  s->pick_pixel(frame, s->x, s->y, &s0, &s1, &s2, &s3);
309 
310  if (s->is_same(frame, s->x, s->y, s0, s1, s2, s3)) {
311  s->points[s->front].x = s->x;
312  s->points[s->front].y = s->y;
313  s->front++;
314  }
315 
316  while (s->front > s->back) {
317  int x, y;
318 
319  s->front--;
320  x = s->points[s->front].x;
321  y = s->points[s->front].y;
322 
323  if (s->is_same(frame, x, y, s0, s1, s2, s3)) {
324  s->set_pixel(frame, x, y, d0, d1, d2, d3);
325 
326  if (is_inside(x + 1, y, w, h)) {
327  s->points[s->front] .x = x + 1;
328  s->points[s->front++].y = y;
329  }
330 
331  if (is_inside(x - 1, y, w, h)) {
332  s->points[s->front] .x = x - 1;
333  s->points[s->front++].y = y;
334  }
335 
336  if (is_inside(x, y + 1, w, h)) {
337  s->points[s->front] .x = x;
338  s->points[s->front++].y = y + 1;
339  }
340 
341  if (is_inside(x, y - 1, w, h)) {
342  s->points[s->front] .x = x;
343  s->points[s->front++].y = y - 1;
344  }
345  }
346  }
347  }
348 
349 end:
350  return ff_filter_frame(ctx->outputs[0], frame);
351 }
352 
354 {
355  static const enum AVPixelFormat pixel_fmts[] = {
379  };
381 
382  formats = ff_make_format_list(pixel_fmts);
383  if (!formats)
384  return AVERROR(ENOMEM);
385 
386  return ff_set_common_formats(ctx, formats);
387 }
388 
390 {
391  FloodfillContext *s = ctx->priv;
392 
393  av_freep(&s->points);
394 }
395 
396 static const AVFilterPad floodfill_inputs[] = {
397  {
398  .name = "default",
399  .type = AVMEDIA_TYPE_VIDEO,
400  .filter_frame = filter_frame,
401  .config_props = config_input,
402  },
403  { NULL }
404 };
405 
406 static const AVFilterPad floodfill_outputs[] = {
407  {
408  .name = "default",
409  .type = AVMEDIA_TYPE_VIDEO,
410  },
411  { NULL }
412 };
413 
414 #define OFFSET(x) offsetof(FloodfillContext, x)
415 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
416 
417 static const AVOption floodfill_options[] = {
418  { "x", "set pixel x coordinate", OFFSET(x), AV_OPT_TYPE_INT, {.i64=0}, 0, UINT16_MAX, FLAGS },
419  { "y", "set pixel y coordinate", OFFSET(y), AV_OPT_TYPE_INT, {.i64=0}, 0, UINT16_MAX, FLAGS },
420  { "s0", "set source #0 component value", OFFSET(s[0]), AV_OPT_TYPE_INT, {.i64=0},-1, UINT16_MAX, FLAGS },
421  { "s1", "set source #1 component value", OFFSET(s[1]), AV_OPT_TYPE_INT, {.i64=0},-1, UINT16_MAX, FLAGS },
422  { "s2", "set source #2 component value", OFFSET(s[2]), AV_OPT_TYPE_INT, {.i64=0},-1, UINT16_MAX, FLAGS },
423  { "s3", "set source #3 component value", OFFSET(s[3]), AV_OPT_TYPE_INT, {.i64=0},-1, UINT16_MAX, FLAGS },
424  { "d0", "set destination #0 component value", OFFSET(d[0]), AV_OPT_TYPE_INT, {.i64=0}, 0, UINT16_MAX, FLAGS },
425  { "d1", "set destination #1 component value", OFFSET(d[1]), AV_OPT_TYPE_INT, {.i64=0}, 0, UINT16_MAX, FLAGS },
426  { "d2", "set destination #2 component value", OFFSET(d[2]), AV_OPT_TYPE_INT, {.i64=0}, 0, UINT16_MAX, FLAGS },
427  { "d3", "set destination #3 component value", OFFSET(d[3]), AV_OPT_TYPE_INT, {.i64=0}, 0, UINT16_MAX, FLAGS },
428  { NULL }
429 };
430 
431 AVFILTER_DEFINE_CLASS(floodfill);
432 
434  .name = "floodfill",
435  .description = NULL_IF_CONFIG_SMALL("Fill area with same color with another color."),
436  .priv_size = sizeof(FloodfillContext),
437  .priv_class = &floodfill_class,
439  .uninit = uninit,
440  .inputs = floodfill_inputs,
441  .outputs = floodfill_outputs,
443 };
void(* pick_pixel)(AVFrame *frame, int x, int y, int *s0, int *s1, int *s2, int *s3)
Definition: vf_floodfill.c:48
#define NULL
Definition: coverity.c:32
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2446
This structure describes decoded (raw) audio or video data.
Definition: frame.h:226
AVOption.
Definition: opt.h:246
#define AV_PIX_FMT_YUV444P14
Definition: pixfmt.h:389
#define AV_PIX_FMT_GBRAP10
Definition: pixfmt.h:399
AVFilter ff_vf_floodfill
Definition: vf_floodfill.c:433
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:71
misc image utilities
static const AVFilterPad floodfill_outputs[]
Definition: vf_floodfill.c:406
int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2486
Main libavfilter public API header.
const char * desc
Definition: nvenc.c:65
planar GBR 4:4:4 24bpp
Definition: pixfmt.h:168
#define AV_PIX_FMT_GBRP10
Definition: pixfmt.h:395
static int is_inside(int x, int y, int w, int h)
Definition: vf_floodfill.c:52
static void pick_pixel4_16(AVFrame *frame, int x, int y, int *s0, int *s1, int *s2, int *s3)
Definition: vf_floodfill.c:224
void * av_calloc(size_t nmemb, size_t size)
Non-inlined equivalent of av_mallocz_array().
Definition: mem.c:244
AVFilterFormats * ff_make_format_list(const int *fmts)
Create a list of supported formats.
Definition: formats.c:283
#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
const char * name
Pad name.
Definition: internal.h:60
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition: avfilter.c:1080
static int is_same1_16(AVFrame *frame, int x, int y, unsigned s0, unsigned s1, unsigned s2, unsigned s3)
Definition: vf_floodfill.c:119
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
Definition: pixdesc.h:117
#define av_cold
Definition: attributes.h:82
static int config_input(AVFilterLink *inlink)
Definition: vf_floodfill.c:237
AVOptions.
static av_cold int end(AVCodecContext *avctx)
Definition: avrndec.c:90
#define AV_PIX_FMT_GBRP9
Definition: pixfmt.h:394
static AVFrame * frame
static const uint64_t c1
Definition: murmur3.c:49
#define AV_PIX_FMT_YUV444P16
Definition: pixfmt.h:392
static void pick_pixel3_16(AVFrame *frame, int x, int y, int *s0, int *s1, int *s2, int *s3)
Definition: vf_floodfill.c:200
static int is_same4(AVFrame *frame, int x, int y, unsigned s0, unsigned s1, unsigned s2, unsigned s3)
Definition: vf_floodfill.c:59
A filter pad used for either input or output.
Definition: internal.h:54
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:258
int width
Definition: frame.h:284
int ff_set_common_formats(AVFilterContext *ctx, AVFilterFormats *formats)
A helper for query_formats() which sets all links to the same list of formats.
Definition: formats.c:568
#define s2
Definition: regdef.h:39
#define AVERROR(e)
Definition: error.h:43
static void set_pixel4_16(AVFrame *frame, int x, int y, unsigned d0, unsigned d1, unsigned d2, unsigned d3)
Definition: vf_floodfill.c:166
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:188
void * priv
private data for use by the filter
Definition: avfilter.h:353
#define s0
Definition: regdef.h:37
#define AV_PIX_FMT_YUVA444P16
Definition: pixfmt.h:421
#define AV_PIX_FMT_GBRAP12
Definition: pixfmt.h:400
void(* set_pixel)(AVFrame *frame, int x, int y, unsigned d0, unsigned d1, unsigned d2, unsigned d3)
Definition: vf_floodfill.c:46
#define AV_PIX_FMT_YUV444P10
Definition: pixfmt.h:382
static void set_pixel4(AVFrame *frame, int x, int y, unsigned d0, unsigned d1, unsigned d2, unsigned d3)
Definition: vf_floodfill.c:157
static void pick_pixel1(AVFrame *frame, int x, int y, int *s0, int *s1, int *s2, int *s3)
Definition: vf_floodfill.c:175
#define AV_PIX_FMT_GBRAP16
Definition: pixfmt.h:401
#define AV_PIX_FMT_GBRP16
Definition: pixfmt.h:398
#define AV_PIX_FMT_GRAY16
Definition: pixfmt.h:363
#define FLAGS
Definition: vf_floodfill.c:415
static int is_same3_16(AVFrame *frame, int x, int y, unsigned s0, unsigned s1, unsigned s2, unsigned s3)
Definition: vf_floodfill.c:97
uint8_t w
Definition: llviddspenc.c:38
AVFormatContext * ctx
Definition: movenc.c:48
#define s(width, name)
Definition: cbs_vp9.c:257
#define AV_PIX_FMT_YUVA444P10
Definition: pixfmt.h:418
static const AVFilterPad inputs[]
Definition: af_acontrast.c:193
#define AV_PIX_FMT_YUV444P9
Definition: pixfmt.h:378
#define AV_PIX_FMT_GBRP14
Definition: pixfmt.h:397
AVFILTER_DEFINE_CLASS(floodfill)
#define s3
Definition: regdef.h:40
static const AVFilterPad outputs[]
Definition: af_acontrast.c:203
static int filter_frame(AVFilterLink *link, AVFrame *frame)
Definition: vf_floodfill.c:280
typedef void(RENAME(mix_any_func_type))
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
Definition: frame.h:257
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
Definition: pixfmt.h:177
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition: pixdesc.h:81
#define AV_RN16(p)
Definition: intreadwrite.h:360
static void set_pixel1(AVFrame *frame, int x, int y, unsigned d0, unsigned d1, unsigned d2, unsigned d3)
Definition: vf_floodfill.c:129
Describe the class of an AVClass context structure.
Definition: log.h:67
Filter definition.
Definition: avfilter.h:144
uint16_t x
Definition: vf_floodfill.c:30
static int is_same3(AVFrame *frame, int x, int y, unsigned s0, unsigned s1, unsigned s2, unsigned s3)
Definition: vf_floodfill.c:85
const char * name
Filter name.
Definition: avfilter.h:148
#define s1
Definition: regdef.h:38
#define OFFSET(x)
Definition: vf_floodfill.c:414
AVFilterLink ** outputs
array of pointers to output links
Definition: avfilter.h:350
#define AV_PIX_FMT_GBRP12
Definition: pixfmt.h:396
int av_frame_make_writable(AVFrame *frame)
Ensure that the frame data is writable, avoiding data copy if possible.
Definition: frame.c:611
#define flags(name, subs,...)
Definition: cbs_av1.c:610
#define AV_PIX_FMT_YUV444P12
Definition: pixfmt.h:386
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:240
static int is_same4_16(AVFrame *frame, int x, int y, unsigned s0, unsigned s1, unsigned s2, unsigned s3)
Definition: vf_floodfill.c:72
static void set_pixel3(AVFrame *frame, int x, int y, unsigned d0, unsigned d1, unsigned d2, unsigned d3)
Definition: vf_floodfill.c:141
int
static void pick_pixel1_16(AVFrame *frame, int x, int y, int *s0, int *s1, int *s2, int *s3)
Definition: vf_floodfill.c:182
Y , 8bpp.
Definition: pixfmt.h:74
static void pick_pixel4(AVFrame *frame, int x, int y, int *s0, int *s1, int *s2, int *s3)
Definition: vf_floodfill.c:211
planar GBRA 4:4:4:4 32bpp
Definition: pixfmt.h:215
#define AV_PIX_FMT_YUVA444P9
Definition: pixfmt.h:415
static const uint64_t c2
Definition: murmur3.c:50
static void pick_pixel3(AVFrame *frame, int x, int y, int *s0, int *s1, int *s2, int *s3)
Definition: vf_floodfill.c:189
A list of supported formats for one end of a filter link.
Definition: formats.h:64
An instance of a filter.
Definition: avfilter.h:338
int height
Definition: frame.h:284
#define av_freep(p)
#define AV_WN16(p, v)
Definition: intreadwrite.h:372
static const AVOption floodfill_options[]
Definition: vf_floodfill.c:417
uint16_t y
Definition: vf_floodfill.c:30
int(* is_same)(AVFrame *frame, int x, int y, unsigned s0, unsigned s1, unsigned s2, unsigned s3)
Definition: vf_floodfill.c:44
static int is_same1(AVFrame *frame, int x, int y, unsigned s0, unsigned s1, unsigned s2, unsigned s3)
Definition: vf_floodfill.c:109
formats
Definition: signature.h:48
static const AVFilterPad floodfill_inputs[]
Definition: vf_floodfill.c:396
internal API functions
static void set_pixel1_16(AVFrame *frame, int x, int y, unsigned d0, unsigned d1, unsigned d2, unsigned d3)
Definition: vf_floodfill.c:135
static void set_pixel3_16(AVFrame *frame, int x, int y, unsigned d0, unsigned d1, unsigned d2, unsigned d3)
Definition: vf_floodfill.c:149
int depth
Number of bits in the component.
Definition: pixdesc.h:58
AVPixelFormat
Pixel format.
Definition: pixfmt.h:64
static av_cold int query_formats(AVFilterContext *ctx)
Definition: vf_floodfill.c:353
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_floodfill.c:389