FFmpeg
Loading...
Searching...
No Matches
vf_edgedetect.c File Reference

Edge detection filter. More...

#include "libavutil/avassert.h"
#include "libavutil/imgutils.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "avfilter.h"
#include "filters.h"
#include "formats.h"
#include "video.h"
#include "edge_common.h"

Go to the source code of this file.

Data Structures

struct  plane_info
 
struct  EdgeDetectContext
 

Macros

#define PLANE_R   0x4
 
#define PLANE_G   0x1
 
#define PLANE_B   0x2
 
#define PLANE_Y   0x1
 
#define PLANE_U   0x2
 
#define PLANE_V   0x4
 
#define PLANE_A   0x8
 
#define OFFSET(x)
 
#define FLAGS   AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
 

Enumerations

enum  FilterMode { MODE_WIRES , MODE_COLORMIX , MODE_CANNY , NB_MODE }
 

Functions

 AVFILTER_DEFINE_CLASS (edgedetect)
 
static av_cold int init (AVFilterContext *ctx)
 
static int query_formats (const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
 
static int config_props (AVFilterLink *inlink)
 
static void color_mix (int w, int h, uint8_t *dst, int dst_linesize, const uint8_t *src, int src_linesize)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *in)
 
static av_cold void uninit (AVFilterContext *ctx)
 

Variables

static const AVOption edgedetect_options []
 
static const AVFilterPad edgedetect_inputs []
 
const FFFilter ff_vf_edgedetect
 

Detailed Description

Edge detection filter.

See also
https://en.wikipedia.org/wiki/Canny_edge_detector

Definition in file vf_edgedetect.c.

Macro Definition Documentation

◆ PLANE_R

#define PLANE_R   0x4

Definition at line 38 of file vf_edgedetect.c.

Referenced by config_input().

◆ PLANE_G

#define PLANE_G   0x1

Definition at line 39 of file vf_edgedetect.c.

Referenced by config_input().

◆ PLANE_B

#define PLANE_B   0x2

Definition at line 40 of file vf_edgedetect.c.

Referenced by config_input().

◆ PLANE_Y

#define PLANE_Y   0x1

Definition at line 41 of file vf_edgedetect.c.

Referenced by config_input().

◆ PLANE_U

#define PLANE_U   0x2

Definition at line 42 of file vf_edgedetect.c.

Referenced by config_input().

◆ PLANE_V

#define PLANE_V   0x4

Definition at line 43 of file vf_edgedetect.c.

Referenced by config_input().

◆ PLANE_A

#define PLANE_A   0x8

Definition at line 44 of file vf_edgedetect.c.

Referenced by config_input().

◆ OFFSET

#define OFFSET ( x)
Value:

Definition at line 70 of file vf_edgedetect.c.

◆ FLAGS

Definition at line 71 of file vf_edgedetect.c.

Enumeration Type Documentation

◆ FilterMode

enum FilterMode
Enumerator
MODE_WIRES 
MODE_COLORMIX 
MODE_CANNY 
NB_MODE 

Definition at line 46 of file vf_edgedetect.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( edgedetect )

◆ init()

static av_cold int init ( AVFilterContext * ctx)
static

Definition at line 91 of file vf_edgedetect.c.

◆ query_formats()

static int query_formats ( const AVFilterContext * ctx,
AVFilterFormatsConfig ** cfg_in,
AVFilterFormatsConfig ** cfg_out )
static

Definition at line 100 of file vf_edgedetect.c.

◆ config_props()

static int config_props ( AVFilterLink * inlink)
static

Definition at line 122 of file vf_edgedetect.c.

◆ color_mix()

static void color_mix ( int w,
int h,
uint8_t * dst,
int dst_linesize,
const uint8_t * src,
int src_linesize )
static

Definition at line 146 of file vf_edgedetect.c.

Referenced by filter_frame().

◆ filter_frame()

static int filter_frame ( AVFilterLink * inlink,
AVFrame * in )
static

Definition at line 160 of file vf_edgedetect.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext * ctx)
static

Definition at line 233 of file vf_edgedetect.c.

Variable Documentation

◆ edgedetect_options

const AVOption edgedetect_options[]
static
Initial value:
= {
{ "high", "set high threshold", OFFSET(high), AV_OPT_TYPE_DOUBLE, {.dbl=50/255.}, 0, 1, FLAGS },
{ "low", "set low threshold", OFFSET(low), AV_OPT_TYPE_DOUBLE, {.dbl=20/255.}, 0, 1, FLAGS },
{ "mode", "set mode", OFFSET(mode), AV_OPT_TYPE_INT, {.i64=MODE_WIRES}, 0, NB_MODE-1, FLAGS, .unit = "mode" },
{ "wires", "white/gray wires on black", 0, AV_OPT_TYPE_CONST, {.i64=MODE_WIRES}, INT_MIN, INT_MAX, FLAGS, .unit = "mode" },
{ "colormix", "mix colors", 0, AV_OPT_TYPE_CONST, {.i64=MODE_COLORMIX}, INT_MIN, INT_MAX, FLAGS, .unit = "mode" },
{ "canny", "detect edges on planes", 0, AV_OPT_TYPE_CONST, {.i64=MODE_CANNY}, INT_MIN, INT_MAX, FLAGS, .unit = "mode" },
{ "planes", "set planes to filter", OFFSET(filter_planes), AV_OPT_TYPE_FLAGS, {.i64=7}, 1, 0x7, FLAGS, .unit = "flags" },
{ "y", "filter luma plane", 0, AV_OPT_TYPE_CONST, {.i64=PLANE_Y}, 0, 0, FLAGS, .unit = "flags" },
{ "u", "filter u plane", 0, AV_OPT_TYPE_CONST, {.i64=PLANE_U}, 0, 0, FLAGS, .unit = "flags" },
{ "v", "filter v plane", 0, AV_OPT_TYPE_CONST, {.i64=PLANE_V}, 0, 0, FLAGS, .unit = "flags" },
{ "r", "filter red plane", 0, AV_OPT_TYPE_CONST, {.i64=PLANE_R}, 0, 0, FLAGS, .unit = "flags" },
{ "g", "filter green plane", 0, AV_OPT_TYPE_CONST, {.i64=PLANE_G}, 0, 0, FLAGS, .unit = "flags" },
{ "b", "filter blue plane", 0, AV_OPT_TYPE_CONST, {.i64=PLANE_B}, 0, 0, FLAGS, .unit = "flags" },
{ NULL }
}
#define FLAGS
Definition cmdutils.c:598
#define NULL
Definition coverity.c:32
int high
Definition dovi_rpuenc.c:39
mode
Use these values in ebur128_init (or'ed).
Definition ebur128.h:83
#define OFFSET(x)
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition opt.h:298
@ AV_OPT_TYPE_FLAGS
Underlying C type is unsigned int.
Definition opt.h:254
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition opt.h:258
@ AV_OPT_TYPE_DOUBLE
Underlying C type is double.
Definition opt.h:266
#define PLANE_B
#define PLANE_R
#define PLANE_Y
@ MODE_COLORMIX
@ MODE_WIRES
@ MODE_CANNY
@ NB_MODE
#define PLANE_U
#define PLANE_G
#define PLANE_V

Definition at line 72 of file vf_edgedetect.c.

◆ edgedetect_inputs

const AVFilterPad edgedetect_inputs[]
static
Initial value:
= {
{
.name = "default",
.config_props = config_props,
.filter_frame = filter_frame,
},
}
static int filter_frame(DBEDecodeContext *s, AVFrame *frame)
Definition dolby_e.c:1067
@ AVMEDIA_TYPE_VIDEO
Definition avutil.h:200
static int config_props(AVBitStreamFilterLink *link)
Definition source.c:181

Definition at line 246 of file vf_edgedetect.c.

◆ ff_vf_edgedetect

const FFFilter ff_vf_edgedetect
Initial value:
= {
.p.name = "edgedetect",
.p.description = NULL_IF_CONFIG_SMALL("Detect and draw edge."),
.p.priv_class = &edgedetect_class,
.priv_size = sizeof(EdgeDetectContext),
.init = init,
}
static int query_formats(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
Definition aeval.c:246
int(* init)(AVBSFContext *ctx)
Definition dts2pts.c:608
#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:196
static av_cold void uninit(AVBitStreamFilterContext *ctx)
#define FILTER_INPUTS(array)
Definition filters.h:264
#define FILTER_OUTPUTS(array)
Definition filters.h:265
#define FILTER_QUERY_FUNC2(func)
Definition filters.h:241
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition internal.h:88
static const AVFilterPad edgedetect_inputs[]
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

Definition at line 255 of file vf_edgedetect.c.