FFmpeg
Data Structures | Macros | Enumerations | Functions | Variables
vf_guided.c File Reference
#include "libavutil/imgutils.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"
#include "filters.h"
#include "formats.h"
#include "framesync.h"
#include "internal.h"
#include "video.h"

Go to the source code of this file.

Data Structures

struct  GuidedContext
 
struct  ThreadData
 Used for passing data between threads. More...
 

Macros

#define OFFSET(x)   offsetof(GuidedContext, x)
 
#define FLAGS   AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
 
#define GUIDED(type, name)
 

Enumerations

enum  FilterModes {
  BASIC, FINAL, NB_MODES, BASIC,
  FAST, NB_MODES
}
 
enum  GuidanceModes { OFF, ON, NB_GUIDANCE_MODES }
 

Functions

 AVFILTER_DEFINE_CLASS (guided)
 
static int box_slice (AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
 
static int query_formats (AVFilterContext *ctx)
 
static int config_input (AVFilterLink *inlink)
 
static int filter_frame (AVFilterContext *ctx, AVFrame **out, AVFrame *in, AVFrame *ref)
 
static int process_frame (FFFrameSync *fs)
 
static int config_output (AVFilterLink *outlink)
 
static int activate (AVFilterContext *ctx)
 
static av_cold int init (AVFilterContext *ctx)
 
static av_cold void uninit (AVFilterContext *ctx)
 
static int process_command (AVFilterContext *ctx, const char *cmd, const char *arg, char *res, int res_len, int flags)
 

Variables

static const AVOption guided_options []
 
static const AVFilterPad guided_outputs []
 
const AVFilter ff_vf_guided
 

Macro Definition Documentation

◆ OFFSET

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

Definition at line 65 of file vf_guided.c.

◆ FLAGS

Definition at line 66 of file vf_guided.c.

◆ GUIDED

#define GUIDED (   type,
  name 
)

Definition at line 187 of file vf_guided.c.

Enumeration Type Documentation

◆ FilterModes

Enumerator
BASIC 
FINAL 
NB_MODES 
BASIC 
FAST 
NB_MODES 

Definition at line 31 of file vf_guided.c.

◆ GuidanceModes

Enumerator
OFF 
ON 
NB_GUIDANCE_MODES 

Definition at line 37 of file vf_guided.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( guided  )

◆ box_slice()

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

Definition at line 93 of file vf_guided.c.

Referenced by config_input().

◆ query_formats()

static int query_formats ( AVFilterContext ctx)
static

Definition at line 130 of file vf_guided.c.

◆ config_input()

static int config_input ( AVFilterLink inlink)
static

Definition at line 156 of file vf_guided.c.

Referenced by init().

◆ filter_frame()

static int filter_frame ( AVFilterContext ctx,
AVFrame **  out,
AVFrame in,
AVFrame ref 
)
static

Definition at line 307 of file vf_guided.c.

Referenced by activate(), and process_frame().

◆ process_frame()

static int process_frame ( FFFrameSync fs)
static

Definition at line 336 of file vf_guided.c.

Referenced by config_output().

◆ config_output()

static int config_output ( AVFilterLink outlink)
static

Definition at line 355 of file vf_guided.c.

◆ activate()

static int activate ( AVFilterContext ctx)
static

Definition at line 405 of file vf_guided.c.

◆ init()

static av_cold int init ( AVFilterContext ctx)
static

Definition at line 435 of file vf_guided.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 460 of file vf_guided.c.

◆ process_command()

static int process_command ( AVFilterContext ctx,
const char *  cmd,
const char *  arg,
char *  res,
int  res_len,
int  flags 
)
static

Definition at line 468 of file vf_guided.c.

Variable Documentation

◆ guided_options

const AVOption guided_options[]
static
Initial value:
= {
{ "radius", "set the box radius", OFFSET(radius), AV_OPT_TYPE_INT, {.i64 = 3 }, 1, 20, FLAGS },
{ "eps", "set the regularization parameter (with square)", OFFSET(eps), AV_OPT_TYPE_FLOAT, {.dbl = 0.01 }, 0.0, 1, FLAGS },
{ "mode", "set filtering mode (0: basic mode; 1: fast mode)", OFFSET(mode), AV_OPT_TYPE_INT, {.i64 = BASIC}, BASIC, NB_MODES - 1, FLAGS, "mode" },
{ "basic", "basic guided filter", 0, AV_OPT_TYPE_CONST, {.i64 = BASIC}, 0, 0, FLAGS, "mode" },
{ "fast", "fast guided filter", 0, AV_OPT_TYPE_CONST, {.i64 = FAST }, 0, 0, FLAGS, "mode" },
{ "sub", "subsampling ratio for fast mode", OFFSET(sub), AV_OPT_TYPE_INT, {.i64 = 4 }, 2, 64, FLAGS },
{ "guidance", "set guidance mode (0: off mode; 1: on mode)", OFFSET(guidance), AV_OPT_TYPE_INT, {.i64 = OFF }, OFF, NB_GUIDANCE_MODES - 1, FLAGS, "guidance" },
{ "off", "only one input is enabled", 0, AV_OPT_TYPE_CONST, {.i64 = OFF }, 0, 0, FLAGS, "guidance" },
{ "on", "two inputs are required", 0, AV_OPT_TYPE_CONST, {.i64 = ON }, 0, 0, FLAGS, "guidance" },
{ "planes", "set planes to filter", OFFSET(planes), AV_OPT_TYPE_INT, {.i64 = 1 }, 0, 0xF, FLAGS },
{ NULL }
}

Definition at line 68 of file vf_guided.c.

◆ guided_outputs

const AVFilterPad guided_outputs[]
static
Initial value:
= {
{
.name = "default",
.config_props = config_output,
},
{ NULL }
}

Definition at line 483 of file vf_guided.c.

◆ ff_vf_guided

const AVFilter ff_vf_guided
Initial value:
= {
.name = "guided",
.description = NULL_IF_CONFIG_SMALL("Apply Guided filter."),
.init = init,
.uninit = uninit,
.query_formats = query_formats,
.priv_size = sizeof(GuidedContext),
.priv_class = &guided_class,
}

Definition at line 492 of file vf_guided.c.

sub
static float sub(float src0, float src1)
Definition: dnn_backend_native_layer_mathbinary.c:31
activate
static int activate(AVFilterContext *ctx)
Definition: vf_guided.c:405
guided_outputs
static const AVFilterPad guided_outputs[]
Definition: vf_guided.c:483
planes
static const struct @318 planes[]
inputs
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several inputs
Definition: filter_design.txt:243
OFFSET
#define OFFSET(x)
Definition: vf_guided.c:65
outputs
static const AVFilterPad outputs[]
Definition: af_acontrast.c:203
NULL
#define NULL
Definition: coverity.c:32
BASIC
@ BASIC
Definition: vf_guided.c:32
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:116
ON
@ ON
Definition: vf_guided.c:39
OFF
@ OFF
Definition: vf_guided.c:38
NB_MODES
@ NB_MODES
Definition: vf_guided.c:34
init
static av_cold int init(AVFilterContext *ctx)
Definition: vf_guided.c:435
FLAGS
#define FLAGS
Definition: vf_guided.c:66
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:126
AV_OPT_TYPE_FLOAT
@ AV_OPT_TYPE_FLOAT
Definition: opt.h:227
FAST
@ FAST
Definition: vf_guided.c:33
GuidedContext
Definition: vf_guided.c:43
process_command
static int process_command(AVFilterContext *ctx, const char *cmd, const char *arg, char *res, int res_len, int flags)
Definition: vf_guided.c:468
mode
mode
Definition: ebur128.h:83
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:224
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_guided.c:460
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
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
NB_GUIDANCE_MODES
@ NB_GUIDANCE_MODES
Definition: vf_guided.c:40
config_output
static int config_output(AVFilterLink *outlink)
Definition: vf_guided.c:355
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:561
query_formats
static int query_formats(AVFilterContext *ctx)
Definition: vf_guided.c:130
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:233