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 "internal.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 377 of file vf_xfade_opencl.c.

◆ FLAGS

Definition at line 378 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 30 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 70 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 138 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 213 of file vf_xfade_opencl.c.

◆ xfade_opencl_activate()

static int xfade_opencl_activate ( AVFilterContext avctx)
static

Definition at line 258 of file vf_xfade_opencl.c.

◆ xfade_opencl_uninit()

static av_cold void xfade_opencl_uninit ( AVFilterContext avctx)
static

Definition at line 346 of file vf_xfade_opencl.c.

◆ get_video_buffer()

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

Definition at line 368 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 380 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 401 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 416 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 424 of file vf_xfade_opencl.c.

FLAGS
#define FLAGS
Definition: vf_xfade_opencl.c:378
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: internal.h:351
xfade_opencl_activate
static int xfade_opencl_activate(AVFilterContext *avctx)
Definition: vf_xfade_opencl.c:258
AV_OPT_TYPE_DURATION
@ AV_OPT_TYPE_DURATION
Definition: opt.h:249
SLIDEUP
@ SLIDEUP
Definition: vf_xfade_opencl.c:39
SLIDELEFT
@ SLIDELEFT
Definition: vf_xfade_opencl.c:37
xfade_opencl_uninit
static av_cold void xfade_opencl_uninit(AVFilterContext *avctx)
Definition: vf_xfade_opencl.c:346
FADE
@ FADE
Definition: vf_xfade_opencl.c:32
XFadeOpenCLContext
Definition: vf_xfade_opencl.c:44
SLIDEDOWN
@ SLIDEDOWN
Definition: vf_xfade_opencl.c:40
duration
int64_t duration
Definition: movenc.c:64
WIPERIGHT
@ WIPERIGHT
Definition: vf_xfade_opencl.c:34
CUSTOM
@ CUSTOM
Definition: vf_xfade_opencl.c:31
OFFSET
#define OFFSET(x)
Definition: vf_xfade_opencl.c:377
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:182
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:38
AV_PIX_FMT_OPENCL
@ AV_PIX_FMT_OPENCL
Hardware surfaces for OpenCL.
Definition: pixfmt.h:358
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts.c:365
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:106
AVFILTER_FLAG_HWDEVICE
#define AVFILTER_FLAG_HWDEVICE
The filter can create hardware frames using AVFilterContext.hw_device_ctx.
Definition: avfilter.h:138
NB_TRANSITIONS
@ NB_TRANSITIONS
Definition: vf_xfade_opencl.c:41
xfade_opencl_outputs
static const AVFilterPad xfade_opencl_outputs[]
Definition: vf_xfade_opencl.c:416
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:45
FILTER_SINGLE_PIXFMT
#define FILTER_SINGLE_PIXFMT(pix_fmt_)
Definition: internal.h:172
uninit
static void uninit(AVBSFContext *ctx)
Definition: pcm_rechunk.c:68
WIPEDOWN
@ WIPEDOWN
Definition: vf_xfade_opencl.c:36
ff_opencl_filter_init
int ff_opencl_filter_init(AVFilterContext *avctx)
Initialise an OpenCL filter context.
Definition: opencl.c:132
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:235
get_video_buffer
static AVFrame * get_video_buffer(AVFilterLink *inlink, int w, int h)
Definition: vf_xfade_opencl.c:368
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:183
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Definition: opt.h:239
xfade_opencl_config_output
static int xfade_opencl_config_output(AVFilterLink *outlink)
Definition: vf_xfade_opencl.c:213
WIPELEFT
@ WIPELEFT
Definition: vf_xfade_opencl.c:33
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:244
WIPEUP
@ WIPEUP
Definition: vf_xfade_opencl.c:35
xfade_opencl_inputs
static const AVFilterPad xfade_opencl_inputs[]
Definition: vf_xfade_opencl.c:401