FFmpeg
Data Structures | Macros | Enumerations | Functions | Variables
vf_xfade_opencl.c File Reference
#include "libavutil/log.h"
#include "libavutil/mem.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,
  NB_TRANSITIONS, CUSTOM, FADE, WIPELEFT,
  WIPERIGHT, WIPEUP, WIPEDOWN, SLIDELEFT,
  SLIDERIGHT, SLIDEUP, SLIDEDOWN, 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 []
 
AVFilter ff_vf_xfade_opencl
 

Macro Definition Documentation

◆ OFFSET

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

Definition at line 378 of file vf_xfade_opencl.c.

◆ FLAGS

Definition at line 379 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 
NB_TRANSITIONS 
CUSTOM 
FADE 
WIPELEFT 
WIPERIGHT 
WIPEUP 
WIPEDOWN 
SLIDELEFT 
SLIDERIGHT 
SLIDEUP 
SLIDEDOWN 
NB_TRANSITIONS 

Definition at line 31 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 71 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 139 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 214 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 347 of file vf_xfade_opencl.c.

◆ get_video_buffer()

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

Definition at line 369 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, "transition" },
{ "custom", "custom transition", 0, AV_OPT_TYPE_CONST, {.i64=CUSTOM}, 0, 0, FLAGS, "transition" },
{ "fade", "fade transition", 0, AV_OPT_TYPE_CONST, {.i64=FADE}, 0, 0, FLAGS, "transition" },
{ "wipeleft", "wipe left transition", 0, AV_OPT_TYPE_CONST, {.i64=WIPELEFT}, 0, 0, FLAGS, "transition" },
{ "wiperight", "wipe right transition", 0, AV_OPT_TYPE_CONST, {.i64=WIPERIGHT}, 0, 0, FLAGS, "transition" },
{ "wipeup", "wipe up transition", 0, AV_OPT_TYPE_CONST, {.i64=WIPEUP}, 0, 0, FLAGS, "transition" },
{ "wipedown", "wipe down transition", 0, AV_OPT_TYPE_CONST, {.i64=WIPEDOWN}, 0, 0, FLAGS, "transition" },
{ "slideleft", "slide left transition", 0, AV_OPT_TYPE_CONST, {.i64=SLIDELEFT}, 0, 0, FLAGS, "transition" },
{ "slideright", "slide right transition", 0, AV_OPT_TYPE_CONST, {.i64=SLIDERIGHT}, 0, 0, FLAGS, "transition" },
{ "slideup", "slide up transition", 0, AV_OPT_TYPE_CONST, {.i64=SLIDEUP}, 0, 0, FLAGS, "transition" },
{ "slidedown", "slide down transition", 0, AV_OPT_TYPE_CONST, {.i64=SLIDEDOWN}, 0, 0, FLAGS, "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 381 of file vf_xfade_opencl.c.

◆ xfade_opencl_inputs

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

Definition at line 402 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,
},
{ NULL }
}

Definition at line 418 of file vf_xfade_opencl.c.

◆ ff_vf_xfade_opencl

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 427 of file vf_xfade_opencl.c.

init
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:31
FLAGS
#define FLAGS
Definition: vf_xfade_opencl.c:379
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:339
xfade_opencl_activate
static int xfade_opencl_activate(AVFilterContext *avctx)
Definition: vf_xfade_opencl.c:259
AV_OPT_TYPE_DURATION
@ AV_OPT_TYPE_DURATION
Definition: opt.h:239
SLIDEUP
@ SLIDEUP
Definition: vf_xfade_opencl.c:40
SLIDELEFT
@ SLIDELEFT
Definition: vf_xfade_opencl.c:38
xfade_opencl_uninit
static av_cold void xfade_opencl_uninit(AVFilterContext *avctx)
Definition: vf_xfade_opencl.c:347
FADE
@ FADE
Definition: vf_xfade_opencl.c:33
XFadeOpenCLContext
Definition: vf_xfade_opencl.c:45
SLIDEDOWN
@ SLIDEDOWN
Definition: vf_xfade_opencl.c:41
duration
int64_t duration
Definition: movenc.c:64
outputs
static const AVFilterPad outputs[]
Definition: af_acontrast.c:203
WIPERIGHT
@ WIPERIGHT
Definition: vf_xfade_opencl.c:35
CUSTOM
@ CUSTOM
Definition: vf_xfade_opencl.c:32
OFFSET
#define OFFSET(x)
Definition: vf_xfade_opencl.c:378
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:39
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
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
NB_TRANSITIONS
@ NB_TRANSITIONS
Definition: vf_xfade_opencl.c:42
xfade_opencl_outputs
static const AVFilterPad xfade_opencl_outputs[]
Definition: vf_xfade_opencl.c:418
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:60
WIPEDOWN
@ WIPEDOWN
Definition: vf_xfade_opencl.c:37
ff_opencl_filter_init
int ff_opencl_filter_init(AVFilterContext *avctx)
Initialise an OpenCL filter context.
Definition: opencl.c:147
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:225
get_video_buffer
static AVFrame * get_video_buffer(AVFilterLink *inlink, int w, int h)
Definition: vf_xfade_opencl.c:369
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
query_formats
static int query_formats(AVFilterContext *ctx)
Definition: aeval.c:243
uninit
static av_cold int uninit(AVCodecContext *avctx)
Definition: crystalhd.c:279
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Definition: opt.h:229
xfade_opencl_config_output
static int xfade_opencl_config_output(AVFilterLink *outlink)
Definition: vf_xfade_opencl.c:214
WIPELEFT
@ WIPELEFT
Definition: vf_xfade_opencl.c:34
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:234
WIPEUP
@ WIPEUP
Definition: vf_xfade_opencl.c:36
ff_opencl_filter_query_formats
int ff_opencl_filter_query_formats(AVFilterContext *avctx)
Return that all inputs and outputs support only AV_PIX_FMT_OPENCL.
Definition: opencl.c:28
xfade_opencl_inputs
static const AVFilterPad xfade_opencl_inputs[]
Definition: vf_xfade_opencl.c:402