FFmpeg
Data Structures | Macros | Functions | Variables
vf_floodfill.c File Reference
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"
#include "filters.h"
#include "video.h"

Go to the source code of this file.

Data Structures

struct  Points
 
struct  FloodfillContext
 

Macros

#define OFFSET(x)   offsetof(FloodfillContext, x)
 
#define FLAGS   AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
 

Functions

static int is_inside (int x, int y, int w, int h)
 
static int is_same4 (const AVFrame *frame, int x, int y, unsigned s0, unsigned s1, unsigned s2, unsigned s3)
 
static int is_same4_16 (const AVFrame *frame, int x, int y, unsigned s0, unsigned s1, unsigned s2, unsigned s3)
 
static int is_same3 (const AVFrame *frame, int x, int y, unsigned s0, unsigned s1, unsigned s2, unsigned s3)
 
static int is_same3_16 (const AVFrame *frame, int x, int y, unsigned s0, unsigned s1, unsigned s2, unsigned s3)
 
static int is_same1 (const AVFrame *frame, int x, int y, unsigned s0, unsigned s1, unsigned s2, unsigned s3)
 
static int is_same1_16 (const AVFrame *frame, int x, int y, unsigned s0, unsigned s1, unsigned s2, unsigned s3)
 
static void set_pixel1 (AVFrame *frame, int x, int y, unsigned d0, unsigned d1, unsigned d2, unsigned d3)
 
static void set_pixel1_16 (AVFrame *frame, int x, int y, unsigned d0, unsigned d1, unsigned d2, unsigned d3)
 
static void set_pixel3 (AVFrame *frame, int x, int y, unsigned d0, unsigned d1, unsigned d2, unsigned d3)
 
static void set_pixel3_16 (AVFrame *frame, int x, int y, unsigned d0, unsigned d1, unsigned d2, unsigned d3)
 
static void set_pixel4 (AVFrame *frame, int x, int y, unsigned d0, unsigned d1, unsigned d2, unsigned d3)
 
static void set_pixel4_16 (AVFrame *frame, int x, int y, unsigned d0, unsigned d1, unsigned d2, unsigned d3)
 
static void pick_pixel1 (const AVFrame *frame, int x, int y, int *s0, int *s1, int *s2, int *s3)
 
static void pick_pixel1_16 (const AVFrame *frame, int x, int y, int *s0, int *s1, int *s2, int *s3)
 
static void pick_pixel3 (const AVFrame *frame, int x, int y, int *s0, int *s1, int *s2, int *s3)
 
static void pick_pixel3_16 (const AVFrame *frame, int x, int y, int *s0, int *s1, int *s2, int *s3)
 
static void pick_pixel4 (const AVFrame *frame, int x, int y, int *s0, int *s1, int *s2, int *s3)
 
static void pick_pixel4_16 (const AVFrame *frame, int x, int y, int *s0, int *s1, int *s2, int *s3)
 
static int config_input (AVFilterLink *inlink)
 
static int filter_frame (AVFilterLink *link, AVFrame *frame)
 
static av_cold void uninit (AVFilterContext *ctx)
 
 AVFILTER_DEFINE_CLASS (floodfill)
 

Variables

static enum AVPixelFormat pixel_fmts []
 
static const AVFilterPad floodfill_inputs []
 
static const AVOption floodfill_options []
 
const AVFilter ff_vf_floodfill
 

Macro Definition Documentation

◆ OFFSET

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

Definition at line 387 of file vf_floodfill.c.

◆ FLAGS

Definition at line 388 of file vf_floodfill.c.

Function Documentation

◆ is_inside()

static int is_inside ( int  x,
int  y,
int  w,
int  h 
)
static

Definition at line 53 of file vf_floodfill.c.

Referenced by ff_vvc_split_cu_flag(), and filter_frame().

◆ is_same4()

static int is_same4 ( const AVFrame frame,
int  x,
int  y,
unsigned  s0,
unsigned  s1,
unsigned  s2,
unsigned  s3 
)
static

Definition at line 60 of file vf_floodfill.c.

Referenced by config_input().

◆ is_same4_16()

static int is_same4_16 ( const AVFrame frame,
int  x,
int  y,
unsigned  s0,
unsigned  s1,
unsigned  s2,
unsigned  s3 
)
static

Definition at line 73 of file vf_floodfill.c.

Referenced by config_input().

◆ is_same3()

static int is_same3 ( const AVFrame frame,
int  x,
int  y,
unsigned  s0,
unsigned  s1,
unsigned  s2,
unsigned  s3 
)
static

Definition at line 86 of file vf_floodfill.c.

Referenced by config_input().

◆ is_same3_16()

static int is_same3_16 ( const AVFrame frame,
int  x,
int  y,
unsigned  s0,
unsigned  s1,
unsigned  s2,
unsigned  s3 
)
static

Definition at line 98 of file vf_floodfill.c.

Referenced by config_input().

◆ is_same1()

static int is_same1 ( const AVFrame frame,
int  x,
int  y,
unsigned  s0,
unsigned  s1,
unsigned  s2,
unsigned  s3 
)
static

Definition at line 110 of file vf_floodfill.c.

Referenced by config_input().

◆ is_same1_16()

static int is_same1_16 ( const AVFrame frame,
int  x,
int  y,
unsigned  s0,
unsigned  s1,
unsigned  s2,
unsigned  s3 
)
static

Definition at line 120 of file vf_floodfill.c.

Referenced by config_input().

◆ set_pixel1()

static void set_pixel1 ( AVFrame frame,
int  x,
int  y,
unsigned  d0,
unsigned  d1,
unsigned  d2,
unsigned  d3 
)
static

Definition at line 130 of file vf_floodfill.c.

Referenced by config_input().

◆ set_pixel1_16()

static void set_pixel1_16 ( AVFrame frame,
int  x,
int  y,
unsigned  d0,
unsigned  d1,
unsigned  d2,
unsigned  d3 
)
static

Definition at line 136 of file vf_floodfill.c.

Referenced by config_input().

◆ set_pixel3()

static void set_pixel3 ( AVFrame frame,
int  x,
int  y,
unsigned  d0,
unsigned  d1,
unsigned  d2,
unsigned  d3 
)
static

Definition at line 142 of file vf_floodfill.c.

Referenced by config_input().

◆ set_pixel3_16()

static void set_pixel3_16 ( AVFrame frame,
int  x,
int  y,
unsigned  d0,
unsigned  d1,
unsigned  d2,
unsigned  d3 
)
static

Definition at line 150 of file vf_floodfill.c.

Referenced by config_input().

◆ set_pixel4()

static void set_pixel4 ( AVFrame frame,
int  x,
int  y,
unsigned  d0,
unsigned  d1,
unsigned  d2,
unsigned  d3 
)
static

Definition at line 158 of file vf_floodfill.c.

Referenced by config_input().

◆ set_pixel4_16()

static void set_pixel4_16 ( AVFrame frame,
int  x,
int  y,
unsigned  d0,
unsigned  d1,
unsigned  d2,
unsigned  d3 
)
static

Definition at line 167 of file vf_floodfill.c.

Referenced by config_input().

◆ pick_pixel1()

static void pick_pixel1 ( const AVFrame frame,
int  x,
int  y,
int *  s0,
int *  s1,
int *  s2,
int *  s3 
)
static

Definition at line 176 of file vf_floodfill.c.

Referenced by config_input().

◆ pick_pixel1_16()

static void pick_pixel1_16 ( const AVFrame frame,
int  x,
int  y,
int *  s0,
int *  s1,
int *  s2,
int *  s3 
)
static

Definition at line 183 of file vf_floodfill.c.

Referenced by config_input().

◆ pick_pixel3()

static void pick_pixel3 ( const AVFrame frame,
int  x,
int  y,
int *  s0,
int *  s1,
int *  s2,
int *  s3 
)
static

Definition at line 190 of file vf_floodfill.c.

Referenced by config_input().

◆ pick_pixel3_16()

static void pick_pixel3_16 ( const AVFrame frame,
int  x,
int  y,
int *  s0,
int *  s1,
int *  s2,
int *  s3 
)
static

Definition at line 201 of file vf_floodfill.c.

Referenced by config_input().

◆ pick_pixel4()

static void pick_pixel4 ( const AVFrame frame,
int  x,
int  y,
int *  s0,
int *  s1,
int *  s2,
int *  s3 
)
static

Definition at line 212 of file vf_floodfill.c.

Referenced by config_input().

◆ pick_pixel4_16()

static void pick_pixel4_16 ( const AVFrame frame,
int  x,
int  y,
int *  s0,
int *  s1,
int *  s2,
int *  s3 
)
static

Definition at line 225 of file vf_floodfill.c.

Referenced by config_input().

◆ config_input()

static int config_input ( AVFilterLink inlink)
static

Definition at line 238 of file vf_floodfill.c.

◆ filter_frame()

static int filter_frame ( AVFilterLink link,
AVFrame frame 
)
static

Definition at line 281 of file vf_floodfill.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 371 of file vf_floodfill.c.

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( floodfill  )

Variable Documentation

◆ pixel_fmts

enum AVPixelFormat pixel_fmts[]
static

◆ floodfill_inputs

const AVFilterPad floodfill_inputs[]
static
Initial value:
= {
{
.name = "default",
.filter_frame = filter_frame,
.config_props = config_input,
},
}

Definition at line 378 of file vf_floodfill.c.

◆ floodfill_options

const AVOption floodfill_options[]
static
Initial value:
= {
{ "x", "set pixel x coordinate", OFFSET(x), AV_OPT_TYPE_INT, {.i64=0}, 0, UINT16_MAX, FLAGS },
{ "y", "set pixel y coordinate", OFFSET(y), AV_OPT_TYPE_INT, {.i64=0}, 0, UINT16_MAX, FLAGS },
{ "s0", "set source #0 component value", OFFSET(s[0]), AV_OPT_TYPE_INT, {.i64=0},-1, UINT16_MAX, FLAGS },
{ "s1", "set source #1 component value", OFFSET(s[1]), AV_OPT_TYPE_INT, {.i64=0},-1, UINT16_MAX, FLAGS },
{ "s2", "set source #2 component value", OFFSET(s[2]), AV_OPT_TYPE_INT, {.i64=0},-1, UINT16_MAX, FLAGS },
{ "s3", "set source #3 component value", OFFSET(s[3]), AV_OPT_TYPE_INT, {.i64=0},-1, UINT16_MAX, FLAGS },
{ "d0", "set destination #0 component value", OFFSET(d[0]), AV_OPT_TYPE_INT, {.i64=0}, 0, UINT16_MAX, FLAGS },
{ "d1", "set destination #1 component value", OFFSET(d[1]), AV_OPT_TYPE_INT, {.i64=0}, 0, UINT16_MAX, FLAGS },
{ "d2", "set destination #2 component value", OFFSET(d[2]), AV_OPT_TYPE_INT, {.i64=0}, 0, UINT16_MAX, FLAGS },
{ "d3", "set destination #3 component value", OFFSET(d[3]), AV_OPT_TYPE_INT, {.i64=0}, 0, UINT16_MAX, FLAGS },
{ NULL }
}

Definition at line 390 of file vf_floodfill.c.

◆ ff_vf_floodfill

const AVFilter ff_vf_floodfill
Initial value:
= {
.name = "floodfill",
.description = NULL_IF_CONFIG_SMALL("Fill area with same color with another color."),
.priv_size = sizeof(FloodfillContext),
.priv_class = &floodfill_class,
}

Definition at line 406 of file vf_floodfill.c.

AV_PIX_FMT_GBRAP16
#define AV_PIX_FMT_GBRAP16
Definition: pixfmt.h:525
FILTER_PIXFMTS_ARRAY
#define FILTER_PIXFMTS_ARRAY(array)
Definition: filters.h:242
pixel_fmts
static enum AVPixelFormat pixel_fmts[]
Definition: vf_floodfill.c:360
floodfill_inputs
static const AVFilterPad floodfill_inputs[]
Definition: vf_floodfill.c:378
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: filters.h:262
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_floodfill.c:371
AV_PIX_FMT_GRAY9
#define AV_PIX_FMT_GRAY9
Definition: pixfmt.h:482
AV_PIX_FMT_GBRP14
#define AV_PIX_FMT_GBRP14
Definition: pixfmt.h:520
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:518
AV_PIX_FMT_YUVA444P16
#define AV_PIX_FMT_YUVA444P16
Definition: pixfmt.h:547
AV_PIX_FMT_GRAY16
#define AV_PIX_FMT_GRAY16
Definition: pixfmt.h:486
AV_PIX_FMT_YUV444P10
#define AV_PIX_FMT_YUV444P10
Definition: pixfmt.h:505
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_GBRAP10
#define AV_PIX_FMT_GBRAP10
Definition: pixfmt.h:522
s
#define s(width, name)
Definition: cbs_vp9.c:198
AV_PIX_FMT_GBRAP12
#define AV_PIX_FMT_GBRAP12
Definition: pixfmt.h:523
AV_PIX_FMT_YUV444P16
#define AV_PIX_FMT_YUV444P16
Definition: pixfmt.h:515
AV_PIX_FMT_GRAY14
#define AV_PIX_FMT_GRAY14
Definition: pixfmt.h:485
config_input
static int config_input(AVFilterLink *inlink)
Definition: vf_floodfill.c:238
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: filters.h:263
AV_PIX_FMT_GRAY10
#define AV_PIX_FMT_GRAY10
Definition: pixfmt.h:483
AV_PIX_FMT_GBRP16
#define AV_PIX_FMT_GBRP16
Definition: pixfmt.h:521
NULL
#define NULL
Definition: coverity.c:32
filter_frame
static int filter_frame(AVFilterLink *link, AVFrame *frame)
Definition: vf_floodfill.c:281
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:517
FLAGS
#define FLAGS
Definition: vf_floodfill.c:388
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
AV_PIX_FMT_YUV444P12
#define AV_PIX_FMT_YUV444P12
Definition: pixfmt.h:509
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
AV_PIX_FMT_YUVA444P10
#define AV_PIX_FMT_YUVA444P10
Definition: pixfmt.h:542
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:182
AV_PIX_FMT_GBRP12
#define AV_PIX_FMT_GBRP12
Definition: pixfmt.h:519
AV_PIX_FMT_YUV444P9
#define AV_PIX_FMT_YUV444P9
Definition: pixfmt.h:501
AV_PIX_FMT_YUVA444P9
#define AV_PIX_FMT_YUVA444P9
Definition: pixfmt.h:539
OFFSET
#define OFFSET(x)
Definition: vf_floodfill.c:387
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:72
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition: opt.h:259
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
AV_PIX_FMT_GBRP
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
Definition: pixfmt.h:165
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
FloodfillContext
Definition: vf_floodfill.c:33
AV_PIX_FMT_YUV444P14
#define AV_PIX_FMT_YUV444P14
Definition: pixfmt.h:512