FFmpeg
Data Structures | Macros | Enumerations | Functions | Variables
vf_xfade_opencl.c File Reference
#include "libavutil/log.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"
#include "filters.h"
#include "opencl.h"
#include "opencl_source.h"
#include "video.h"

Go to the source code of this file.

Data Structures

struct  XFadeOpenCLContext
 

Macros

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

Enumerations

enum  XFadeTransitions {
  CUSTOM = -1, FADE, WIPELEFT, WIPERIGHT,
  WIPEUP, WIPEDOWN, SLIDELEFT, SLIDERIGHT,
  SLIDEUP, SLIDEDOWN, CIRCLECROP, RECTCROP,
  DISTANCE, FADEBLACK, FADEWHITE, RADIAL,
  SMOOTHLEFT, SMOOTHRIGHT, SMOOTHUP, SMOOTHDOWN,
  CIRCLEOPEN, CIRCLECLOSE, VERTOPEN, VERTCLOSE,
  HORZOPEN, HORZCLOSE, DISSOLVE, PIXELIZE,
  DIAGTL, DIAGTR, DIAGBL, DIAGBR,
  HLSLICE, HRSLICE, VUSLICE, VDSLICE,
  HBLUR, FADEGRAYS, WIPETL, WIPETR,
  WIPEBL, WIPEBR, SQUEEZEH, SQUEEZEV,
  ZOOMIN, FADEFAST, FADESLOW, HLWIND,
  HRWIND, VUWIND, VDWIND, COVERLEFT,
  COVERRIGHT, COVERUP, COVERDOWN, REVEALLEFT,
  REVEALRIGHT, REVEALUP, REVEALDOWN, NB_TRANSITIONS,
  CUSTOM, FADE, WIPELEFT, WIPERIGHT,
  WIPEUP, WIPEDOWN, SLIDELEFT, SLIDERIGHT,
  SLIDEUP, SLIDEDOWN, NB_TRANSITIONS, FADE,
  WIPELEFT, WIPERIGHT, WIPEUP, WIPEDOWN,
  SLIDEDOWN, SLIDEUP, SLIDELEFT, SLIDERIGHT,
  CIRCLEOPEN, CIRCLECLOSE, DISSOLVE, PIXELIZE,
  WIPETL, WIPETR, WIPEBL, WIPEBR,
  NB_TRANSITIONS
}
 

Functions

static int xfade_opencl_load (AVFilterContext *avctx, enum AVPixelFormat main_format, enum AVPixelFormat xfade_format)
 
static int xfade_frame (AVFilterContext *avctx, AVFrame *a, AVFrame *b)
 
static int xfade_opencl_config_output (AVFilterLink *outlink)
 
static int xfade_opencl_activate (AVFilterContext *avctx)
 
static av_cold void xfade_opencl_uninit (AVFilterContext *avctx)
 
static AVFrameget_video_buffer (AVFilterLink *inlink, int w, int h)
 
 AVFILTER_DEFINE_CLASS (xfade_opencl)
 

Variables

static const AVOption xfade_opencl_options []
 
static const AVFilterPad xfade_opencl_inputs []
 
static const AVFilterPad xfade_opencl_outputs []
 
const AVFilter ff_vf_xfade_opencl
 

Macro Definition Documentation

◆ OFFSET

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

Definition at line 386 of file vf_xfade_opencl.c.

◆ FLAGS

Definition at line 387 of file vf_xfade_opencl.c.

Enumeration Type Documentation

◆ XFadeTransitions

Enumerator
CUSTOM 
FADE 
WIPELEFT 
WIPERIGHT 
WIPEUP 
WIPEDOWN 
SLIDELEFT 
SLIDERIGHT 
SLIDEUP 
SLIDEDOWN 
CIRCLECROP 
RECTCROP 
DISTANCE 
FADEBLACK 
FADEWHITE 
RADIAL 
SMOOTHLEFT 
SMOOTHRIGHT 
SMOOTHUP 
SMOOTHDOWN 
CIRCLEOPEN 
CIRCLECLOSE 
VERTOPEN 
VERTCLOSE 
HORZOPEN 
HORZCLOSE 
DISSOLVE 
PIXELIZE 
DIAGTL 
DIAGTR 
DIAGBL 
DIAGBR 
HLSLICE 
HRSLICE 
VUSLICE 
VDSLICE 
HBLUR 
FADEGRAYS 
WIPETL 
WIPETR 
WIPEBL 
WIPEBR 
SQUEEZEH 
SQUEEZEV 
ZOOMIN 
FADEFAST 
FADESLOW 
HLWIND 
HRWIND 
VUWIND 
VDWIND 
COVERLEFT 
COVERRIGHT 
COVERUP 
COVERDOWN 
REVEALLEFT 
REVEALRIGHT 
REVEALUP 
REVEALDOWN 
NB_TRANSITIONS 
CUSTOM 
FADE 
WIPELEFT 
WIPERIGHT 
WIPEUP 
WIPEDOWN 
SLIDELEFT 
SLIDERIGHT 
SLIDEUP 
SLIDEDOWN 
NB_TRANSITIONS 
FADE 
WIPELEFT 
WIPERIGHT 
WIPEUP 
WIPEDOWN 
SLIDEDOWN 
SLIDEUP 
SLIDELEFT 
SLIDERIGHT 
CIRCLEOPEN 
CIRCLECLOSE 
DISSOLVE 
PIXELIZE 
WIPETL 
WIPETR 
WIPEBL 
WIPEBR 
NB_TRANSITIONS 

Definition at line 29 of file vf_xfade_opencl.c.

Function Documentation

◆ xfade_opencl_load()

static int xfade_opencl_load ( AVFilterContext avctx,
enum AVPixelFormat  main_format,
enum AVPixelFormat  xfade_format 
)
static

Definition at line 69 of file vf_xfade_opencl.c.

Referenced by xfade_frame().

◆ xfade_frame()

static int xfade_frame ( AVFilterContext avctx,
AVFrame a,
AVFrame b 
)
static

Definition at line 137 of file vf_xfade_opencl.c.

Referenced by xfade_opencl_activate().

◆ xfade_opencl_config_output()

static int xfade_opencl_config_output ( AVFilterLink outlink)
static

Definition at line 212 of file vf_xfade_opencl.c.

◆ xfade_opencl_activate()

static int xfade_opencl_activate ( AVFilterContext avctx)
static

Definition at line 259 of file vf_xfade_opencl.c.

◆ xfade_opencl_uninit()

static av_cold void xfade_opencl_uninit ( AVFilterContext avctx)
static

Definition at line 355 of file vf_xfade_opencl.c.

◆ get_video_buffer()

static AVFrame* get_video_buffer ( AVFilterLink inlink,
int  w,
int  h 
)
static

Definition at line 377 of file vf_xfade_opencl.c.

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( xfade_opencl  )

Variable Documentation

◆ xfade_opencl_options

const AVOption xfade_opencl_options[]
static
Initial value:
= {
{ "transition", "set cross fade transition", OFFSET(transition), AV_OPT_TYPE_INT, {.i64=1}, 0, NB_TRANSITIONS-1, FLAGS, .unit = "transition" },
{ "custom", "custom transition", 0, AV_OPT_TYPE_CONST, {.i64=CUSTOM}, 0, 0, FLAGS, .unit = "transition" },
{ "fade", "fade transition", 0, AV_OPT_TYPE_CONST, {.i64=FADE}, 0, 0, FLAGS, .unit = "transition" },
{ "wipeleft", "wipe left transition", 0, AV_OPT_TYPE_CONST, {.i64=WIPELEFT}, 0, 0, FLAGS, .unit = "transition" },
{ "wiperight", "wipe right transition", 0, AV_OPT_TYPE_CONST, {.i64=WIPERIGHT}, 0, 0, FLAGS, .unit = "transition" },
{ "wipeup", "wipe up transition", 0, AV_OPT_TYPE_CONST, {.i64=WIPEUP}, 0, 0, FLAGS, .unit = "transition" },
{ "wipedown", "wipe down transition", 0, AV_OPT_TYPE_CONST, {.i64=WIPEDOWN}, 0, 0, FLAGS, .unit = "transition" },
{ "slideleft", "slide left transition", 0, AV_OPT_TYPE_CONST, {.i64=SLIDELEFT}, 0, 0, FLAGS, .unit = "transition" },
{ "slideright", "slide right transition", 0, AV_OPT_TYPE_CONST, {.i64=SLIDERIGHT}, 0, 0, FLAGS, .unit = "transition" },
{ "slideup", "slide up transition", 0, AV_OPT_TYPE_CONST, {.i64=SLIDEUP}, 0, 0, FLAGS, .unit = "transition" },
{ "slidedown", "slide down transition", 0, AV_OPT_TYPE_CONST, {.i64=SLIDEDOWN}, 0, 0, FLAGS, .unit = "transition" },
{ "source", "set OpenCL program source file for custom transition", OFFSET(source_file), AV_OPT_TYPE_STRING, {.str = NULL}, .flags = FLAGS },
{ "kernel", "set kernel name in program file for custom transition", OFFSET(kernel_name), AV_OPT_TYPE_STRING, {.str = NULL}, .flags = FLAGS },
{ "duration", "set cross fade duration", OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64=1000000}, 0, 60000000, FLAGS },
{ "offset", "set cross fade start relative to first input stream", OFFSET(offset), AV_OPT_TYPE_DURATION, {.i64=0}, INT64_MIN, INT64_MAX, FLAGS },
{ NULL }
}

Definition at line 389 of file vf_xfade_opencl.c.

◆ xfade_opencl_inputs

const AVFilterPad xfade_opencl_inputs[]
static
Initial value:
= {
{
.name = "main",
.get_buffer.video = get_video_buffer,
},
{
.name = "xfade",
.get_buffer.video = get_video_buffer,
},
}

Definition at line 410 of file vf_xfade_opencl.c.

◆ xfade_opencl_outputs

const AVFilterPad xfade_opencl_outputs[]
static
Initial value:
= {
{
.name = "default",
.config_props = &xfade_opencl_config_output,
},
}

Definition at line 425 of file vf_xfade_opencl.c.

◆ ff_vf_xfade_opencl

const AVFilter ff_vf_xfade_opencl
Initial value:
= {
.name = "xfade_opencl",
.description = NULL_IF_CONFIG_SMALL("Cross fade one video with another video."),
.priv_size = sizeof(XFadeOpenCLContext),
.priv_class = &xfade_opencl_class,
.flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
}

Definition at line 433 of file vf_xfade_opencl.c.

FLAGS
#define FLAGS
Definition: vf_xfade_opencl.c:387
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: filters.h:262
xfade_opencl_activate
static int xfade_opencl_activate(AVFilterContext *avctx)
Definition: vf_xfade_opencl.c:259
AV_OPT_TYPE_DURATION
@ AV_OPT_TYPE_DURATION
Underlying C type is int64_t.
Definition: opt.h:319
SLIDEUP
@ SLIDEUP
Definition: vf_xfade_opencl.c:38
SLIDELEFT
@ SLIDELEFT
Definition: vf_xfade_opencl.c:36
xfade_opencl_uninit
static av_cold void xfade_opencl_uninit(AVFilterContext *avctx)
Definition: vf_xfade_opencl.c:355
FADE
@ FADE
Definition: vf_xfade_opencl.c:31
XFadeOpenCLContext
Definition: vf_xfade_opencl.c:43
SLIDEDOWN
@ SLIDEDOWN
Definition: vf_xfade_opencl.c:39
duration
int64_t duration
Definition: movenc.c:65
WIPERIGHT
@ WIPERIGHT
Definition: vf_xfade_opencl.c:33
CUSTOM
@ CUSTOM
Definition: vf_xfade_opencl.c:30
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: filters.h:263
OFFSET
#define OFFSET(x)
Definition: vf_xfade_opencl.c:386
NULL
#define NULL
Definition: coverity.c:32
activate
filter_frame For filters that do not use the activate() callback
SLIDERIGHT
@ SLIDERIGHT
Definition: vf_xfade_opencl.c:37
AV_PIX_FMT_OPENCL
@ AV_PIX_FMT_OPENCL
Hardware surfaces for OpenCL.
Definition: pixfmt.h:358
FF_FILTER_FLAG_HWFRAME_AWARE
#define FF_FILTER_FLAG_HWFRAME_AWARE
The filter is aware of hardware frames, and any hardware frame context should not be automatically pr...
Definition: filters.h:206
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts.c:368
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
AVFILTER_FLAG_HWDEVICE
#define AVFILTER_FLAG_HWDEVICE
The filter can create hardware frames using AVFilterContext.hw_device_ctx.
Definition: avfilter.h:173
NB_TRANSITIONS
@ NB_TRANSITIONS
Definition: vf_xfade_opencl.c:40
xfade_opencl_outputs
static const AVFilterPad xfade_opencl_outputs[]
Definition: vf_xfade_opencl.c:425
offset
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf offset
Definition: writing_filters.txt:86
ff_opencl_filter_config_input
int ff_opencl_filter_config_input(AVFilterLink *inlink)
Check that the input link contains a suitable hardware frames context and extract the device from it.
Definition: opencl.c:46
uninit
static void uninit(AVBSFContext *ctx)
Definition: pcm_rechunk.c:68
WIPEDOWN
@ WIPEDOWN
Definition: vf_xfade_opencl.c:35
ff_opencl_filter_init
int ff_opencl_filter_init(AVFilterContext *avctx)
Initialise an OpenCL filter context.
Definition: opencl.c:135
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition: opt.h:259
get_video_buffer
static AVFrame * get_video_buffer(AVFilterLink *inlink, int w, int h)
Definition: vf_xfade_opencl.c:377
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Underlying C type is a uint8_t* that is either NULL or points to a C string allocated with the av_mal...
Definition: opt.h:276
xfade_opencl_config_output
static int xfade_opencl_config_output(AVFilterLink *outlink)
Definition: vf_xfade_opencl.c:212
WIPELEFT
@ WIPELEFT
Definition: vf_xfade_opencl.c:32
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition: opt.h:299
FILTER_SINGLE_PIXFMT
#define FILTER_SINGLE_PIXFMT(pix_fmt_)
Definition: filters.h:252
WIPEUP
@ WIPEUP
Definition: vf_xfade_opencl.c:34
xfade_opencl_inputs
static const AVFilterPad xfade_opencl_inputs[]
Definition: vf_xfade_opencl.c:410