FFmpeg
Data Structures | Macros | Functions | Variables
vf_neighbor.c File Reference
#include "libavutil/imgutils.h"
#include "libavutil/intreadwrite.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  ThreadData
 Used for passing data between threads. More...
 
struct  NContext
 

Macros

#define OFFSET(x)   offsetof(NContext, x)
 
#define FLAGS   AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
 
#define DEFINE_NEIGHBOR_FILTER(name_, description_, priv_class_)
 
#define DEINFLATE_OPTIONS_OFFSET   (CONFIG_EROSION_FILTER || CONFIG_DILATION_FILTER)
 

Functions

static int query_formats (AVFilterContext *ctx)
 
static void erosion (uint8_t *dst, const uint8_t *p1, int width, int threshold, const uint8_t *coordinates[], int coord, int maxc)
 
static void erosion16 (uint8_t *dstp, const uint8_t *p1, int width, int threshold, const uint8_t *coordinates[], int coord, int maxc)
 
static void dilation (uint8_t *dst, const uint8_t *p1, int width, int threshold, const uint8_t *coordinates[], int coord, int maxc)
 
static void dilation16 (uint8_t *dstp, const uint8_t *p1, int width, int threshold, const uint8_t *coordinates[], int coord, int maxc)
 
static void deflate (uint8_t *dst, const uint8_t *p1, int width, int threshold, const uint8_t *coordinates[], int coord, int maxc)
 
static void deflate16 (uint8_t *dstp, const uint8_t *p1, int width, int threshold, const uint8_t *coordinates[], int coord, int maxc)
 
static void inflate (uint8_t *dst, const uint8_t *p1, int width, int threshold, const uint8_t *coordinates[], int coord, int maxc)
 
static void inflate16 (uint8_t *dstp, const uint8_t *p1, int width, int threshold, const uint8_t *coordinates[], int coord, int maxc)
 
static int config_input (AVFilterLink *inlink)
 
static int filter_slice (AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *in)
 
 AVFILTER_DEFINE_CLASS_EXT (erosion_dilation, "erosion/dilation", options)
 
 AVFILTER_DEFINE_CLASS_EXT (deflate_inflate, "deflate/inflate", &options[DEINFLATE_OPTIONS_OFFSET])
 

Variables

static const AVFilterPad neighbor_inputs []
 
static const AVFilterPad neighbor_outputs []
 
static const AVOption options []
 

Macro Definition Documentation

◆ OFFSET

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

Definition at line 354 of file vf_neighbor.c.

◆ FLAGS

Definition at line 355 of file vf_neighbor.c.

◆ DEFINE_NEIGHBOR_FILTER

#define DEFINE_NEIGHBOR_FILTER (   name_,
  description_,
  priv_class_ 
)
Value:
const AVFilter ff_vf_##name_ = { \
.name = #name_, \
.description = NULL_IF_CONFIG_SMALL(description_), \
.priv_class = &priv_class_##_class, \
.priv_size = sizeof(NContext), \
FILTER_OUTPUTS(neighbor_outputs), \
AVFILTER_FLAG_SLICE_THREADS, \
.process_command = ff_filter_process_command, \
}

Definition at line 357 of file vf_neighbor.c.

◆ DEINFLATE_OPTIONS_OFFSET

#define DEINFLATE_OPTIONS_OFFSET   (CONFIG_EROSION_FILTER || CONFIG_DILATION_FILTER)

Definition at line 373 of file vf_neighbor.c.

Function Documentation

◆ query_formats()

static int query_formats ( AVFilterContext ctx)
static

Definition at line 52 of file vf_neighbor.c.

◆ erosion()

static void erosion ( uint8_t *  dst,
const uint8_t *  p1,
int  width,
int  threshold,
const uint8_t *  coordinates[],
int  coord,
int  maxc 
)
static

Definition at line 79 of file vf_neighbor.c.

Referenced by config_input().

◆ erosion16()

static void erosion16 ( uint8_t *  dstp,
const uint8_t *  p1,
int  width,
int  threshold,
const uint8_t *  coordinates[],
int  coord,
int  maxc 
)
static

Definition at line 100 of file vf_neighbor.c.

Referenced by config_input().

◆ dilation()

static void dilation ( uint8_t *  dst,
const uint8_t *  p1,
int  width,
int  threshold,
const uint8_t *  coordinates[],
int  coord,
int  maxc 
)
static

Definition at line 122 of file vf_neighbor.c.

Referenced by config_input().

◆ dilation16()

static void dilation16 ( uint8_t *  dstp,
const uint8_t *  p1,
int  width,
int  threshold,
const uint8_t *  coordinates[],
int  coord,
int  maxc 
)
static

Definition at line 143 of file vf_neighbor.c.

Referenced by config_input().

◆ deflate()

static void deflate ( uint8_t *  dst,
const uint8_t *  p1,
int  width,
int  threshold,
const uint8_t *  coordinates[],
int  coord,
int  maxc 
)
static

◆ deflate16()

static void deflate16 ( uint8_t *  dstp,
const uint8_t *  p1,
int  width,
int  threshold,
const uint8_t *  coordinates[],
int  coord,
int  maxc 
)
static

Definition at line 181 of file vf_neighbor.c.

Referenced by config_input().

◆ inflate()

static void inflate ( uint8_t *  dst,
const uint8_t *  p1,
int  width,
int  threshold,
const uint8_t *  coordinates[],
int  coord,
int  maxc 
)
static

◆ inflate16()

static void inflate16 ( uint8_t *  dstp,
const uint8_t *  p1,
int  width,
int  threshold,
const uint8_t *  coordinates[],
int  coord,
int  maxc 
)
static

Definition at line 214 of file vf_neighbor.c.

Referenced by config_input().

◆ config_input()

static int config_input ( AVFilterLink inlink)
static

Definition at line 231 of file vf_neighbor.c.

◆ filter_slice()

static int filter_slice ( AVFilterContext ctx,
void *  arg,
int  jobnr,
int  nb_jobs 
)
static

Definition at line 260 of file vf_neighbor.c.

Referenced by filter_frame().

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 314 of file vf_neighbor.c.

◆ AVFILTER_DEFINE_CLASS_EXT() [1/2]

AVFILTER_DEFINE_CLASS_EXT ( erosion_dilation  ,
"erosion/dilation ,
options   
)

◆ AVFILTER_DEFINE_CLASS_EXT() [2/2]

AVFILTER_DEFINE_CLASS_EXT ( deflate_inflate  ,
"deflate/inflate ,
options[DEINFLATE_OPTIONS_OFFSET] 
)

Variable Documentation

◆ neighbor_inputs

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

Definition at line 338 of file vf_neighbor.c.

◆ neighbor_outputs

const AVFilterPad neighbor_outputs[]
static
Initial value:
= {
{
.name = "default",
},
}

Definition at line 347 of file vf_neighbor.c.

◆ options

const AVOption options[]
static
Initial value:
= {
{ "threshold0", "set threshold for 1st plane", OFFSET(threshold[0]), AV_OPT_TYPE_INT, {.i64=65535}, 0, 65535, FLAGS },
{ "threshold1", "set threshold for 2nd plane", OFFSET(threshold[1]), AV_OPT_TYPE_INT, {.i64=65535}, 0, 65535, FLAGS },
{ "threshold2", "set threshold for 3rd plane", OFFSET(threshold[2]), AV_OPT_TYPE_INT, {.i64=65535}, 0, 65535, FLAGS },
{ "threshold3", "set threshold for 4th plane", OFFSET(threshold[3]), AV_OPT_TYPE_INT, {.i64=65535}, 0, 65535, FLAGS },
{ NULL }
}

Definition at line 374 of file vf_neighbor.c.

FLAGS
#define FLAGS
Definition: vf_neighbor.c:355
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: vf_neighbor.c:314
AVFilter::name
const char * name
Filter name.
Definition: avfilter.h:153
config_input
static int config_input(AVFilterLink *inlink)
Definition: vf_neighbor.c:231
OFFSET
#define OFFSET(x)
Definition: vf_neighbor.c:354
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:152
NULL
#define NULL
Definition: coverity.c:32
neighbor_inputs
static const AVFilterPad neighbor_inputs[]
Definition: vf_neighbor.c:338
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:117
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:883
NContext
Definition: vf_neighbor.c:35
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:130
AVFilter
Filter definition.
Definition: avfilter.h:149
neighbor_outputs
static const AVFilterPad neighbor_outputs[]
Definition: vf_neighbor.c:347
query_formats
static int query_formats(AVFilterContext *ctx)
Definition: vf_neighbor.c:52
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:224
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201