FFmpeg
Loading...
Searching...
No Matches
vf_xfade_opencl.c
Go to the documentation of this file.
1/*
2 * This file is part of FFmpeg.
3 *
4 * FFmpeg is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * FFmpeg is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with FFmpeg; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19#include "libavutil/log.h"
20#include "libavutil/opt.h"
21#include "libavutil/pixdesc.h"
22
23#include "avfilter.h"
24#include "filters.h"
25#include "opencl.h"
26#include "opencl_source.h"
27#include "video.h"
28
42
68
70 enum AVPixelFormat main_format,
71 enum AVPixelFormat xfade_format)
72{
73 XFadeOpenCLContext *ctx = avctx->priv;
74 cl_int cle;
75 const AVPixFmtDescriptor *main_desc;
76 int err, main_planes;
77 const char *kernel_name;
78
79 main_desc = av_pix_fmt_desc_get(main_format);
80 if (main_format != xfade_format) {
81 av_log(avctx, AV_LOG_ERROR, "Input formats are not same.\n");
82 return AVERROR(EINVAL);
83 }
84
85 main_planes = 0;
86 for (int i = 0; i < main_desc->nb_components; i++)
87 main_planes = FFMAX(main_planes,
88 main_desc->comp[i].plane + 1);
89
90 ctx->nb_planes = main_planes;
91
92 if (ctx->transition == CUSTOM) {
93 err = ff_opencl_filter_load_program_from_file(avctx, ctx->source_file);
94 } else {
96 }
97 if (err < 0)
98 return err;
99
100 ctx->command_queue = clCreateCommandQueue(ctx->ocf.hwctx->context,
101 ctx->ocf.hwctx->device_id,
102 0, &cle);
103 CL_FAIL_ON_ERROR(AVERROR(EIO), "Failed to create OpenCL "
104 "command queue %d.\n", cle);
105
106 switch (ctx->transition) {
107 case CUSTOM: kernel_name = ctx->kernel_name; break;
108 case FADE: kernel_name = "fade"; break;
109 case WIPELEFT: kernel_name = "wipeleft"; break;
110 case WIPERIGHT: kernel_name = "wiperight"; break;
111 case WIPEUP: kernel_name = "wipeup"; break;
112 case WIPEDOWN: kernel_name = "wipedown"; break;
113 case SLIDELEFT: kernel_name = "slideleft"; break;
114 case SLIDERIGHT: kernel_name = "slideright"; break;
115 case SLIDEUP: kernel_name = "slideup"; break;
116 case SLIDEDOWN: kernel_name = "slidedown"; break;
117 default:
118 err = AVERROR_BUG;
119 goto fail;
120 }
121
122 ctx->kernel = clCreateKernel(ctx->ocf.program, kernel_name, &cle);
123 CL_FAIL_ON_ERROR(AVERROR(EIO), "Failed to create kernel %d.\n", cle);
124
125 ctx->initialised = 1;
126
127 return 0;
128
129fail:
130 if (ctx->command_queue)
131 clReleaseCommandQueue(ctx->command_queue);
132 if (ctx->kernel)
133 clReleaseKernel(ctx->kernel);
134 return err;
135}
136
138{
139 AVFilterLink *outlink = avctx->outputs[0];
140 XFadeOpenCLContext *ctx = avctx->priv;
141 AVFrame *output;
142 cl_int cle;
143 cl_float progress = av_clipf(1.f - ((cl_float)(ctx->pts - ctx->first_pts - ctx->offset_pts) / ctx->duration_pts), 0.f, 1.f);
144 size_t global_work[2];
145 int kernel_arg = 0;
146 int err, plane;
147
148 if (!ctx->initialised) {
149 AVHWFramesContext *main_fc =
150 (AVHWFramesContext*)a->hw_frames_ctx->data;
151 AVHWFramesContext *xfade_fc =
152 (AVHWFramesContext*)b->hw_frames_ctx->data;
153
154 err = xfade_opencl_load(avctx, main_fc->sw_format,
155 xfade_fc->sw_format);
156 if (err < 0)
157 return err;
158 }
159
160 output = ff_get_video_buffer(outlink, outlink->w, outlink->h);
161 if (!output) {
162 err = AVERROR(ENOMEM);
163 goto fail;
164 }
165
166 for (plane = 0; plane < ctx->nb_planes; plane++) {
167 cl_mem mem;
168 kernel_arg = 0;
169
170 mem = (cl_mem)output->data[plane];
171 CL_SET_KERNEL_ARG(ctx->kernel, kernel_arg, cl_mem, &mem);
172 kernel_arg++;
173
174 mem = (cl_mem)ctx->xf[0]->data[plane];
175 CL_SET_KERNEL_ARG(ctx->kernel, kernel_arg, cl_mem, &mem);
176 kernel_arg++;
177
178 mem = (cl_mem)ctx->xf[1]->data[plane];
179 CL_SET_KERNEL_ARG(ctx->kernel, kernel_arg, cl_mem, &mem);
180 kernel_arg++;
181
182 CL_SET_KERNEL_ARG(ctx->kernel, kernel_arg, cl_float, &progress);
183 kernel_arg++;
184
185 err = ff_opencl_filter_work_size_from_image(avctx, global_work,
186 output, plane, 0);
187 if (err < 0)
188 goto fail;
189
190 cle = clEnqueueNDRangeKernel(ctx->command_queue, ctx->kernel, 2, NULL,
191 global_work, NULL, 0, NULL, NULL);
192 CL_FAIL_ON_ERROR(AVERROR(EIO), "Failed to enqueue xfade kernel "
193 "for plane %d: %d.\n", plane, cle);
194 }
195
196 cle = clFinish(ctx->command_queue);
197 CL_FAIL_ON_ERROR(AVERROR(EIO), "Failed to finish command queue: %d.\n", cle);
198
199 err = av_frame_copy_props(output, ctx->xf[0]);
200 if (err < 0)
201 goto fail;
202
203 output->pts = ctx->pts;
204
205 return ff_filter_frame(outlink, output);
206
207fail:
208 av_frame_free(&output);
209 return err;
210}
211
213{
214 AVFilterContext *avctx = outlink->src;
215 XFadeOpenCLContext *ctx = avctx->priv;
216 AVFilterLink *inlink0 = avctx->inputs[0];
217 AVFilterLink *inlink1 = avctx->inputs[1];
218 FilterLink *il = ff_filter_link(inlink0);
219 FilterLink *ol = ff_filter_link(outlink);
220 int err;
221
222 err = ff_opencl_filter_config_output(outlink);
223 if (err < 0)
224 return err;
225
226 if (inlink0->w != inlink1->w || inlink0->h != inlink1->h) {
227 av_log(avctx, AV_LOG_ERROR, "First input link %s parameters "
228 "(size %dx%d) do not match the corresponding "
229 "second input link %s parameters (size %dx%d)\n",
230 avctx->input_pads[0].name, inlink0->w, inlink0->h,
231 avctx->input_pads[1].name, inlink1->w, inlink1->h);
232 return AVERROR(EINVAL);
233 }
234
235 if (inlink0->time_base.num != inlink1->time_base.num ||
236 inlink0->time_base.den != inlink1->time_base.den) {
237 av_log(avctx, AV_LOG_ERROR, "First input link %s timebase "
238 "(%d/%d) do not match the corresponding "
239 "second input link %s timebase (%d/%d)\n",
240 avctx->input_pads[0].name, inlink0->time_base.num, inlink0->time_base.den,
241 avctx->input_pads[1].name, inlink1->time_base.num, inlink1->time_base.den);
242 return AVERROR(EINVAL);
243 }
244
245 ctx->first_pts = ctx->last_pts = ctx->pts = AV_NOPTS_VALUE;
246
247 outlink->time_base = inlink0->time_base;
248 outlink->sample_aspect_ratio = inlink0->sample_aspect_ratio;
249 ol->frame_rate = il->frame_rate;
250
251 if (ctx->duration)
252 ctx->duration_pts = av_rescale_q(ctx->duration, AV_TIME_BASE_Q, outlink->time_base);
253 if (ctx->offset)
254 ctx->offset_pts = av_rescale_q(ctx->offset, AV_TIME_BASE_Q, outlink->time_base);
255
256 return 0;
257}
258
260{
261 XFadeOpenCLContext *ctx = avctx->priv;
262 AVFilterLink *outlink = avctx->outputs[0];
263 AVFrame *in = NULL;
264 int ret = 0, status;
265 int64_t pts;
266
267 FF_FILTER_FORWARD_STATUS_BACK_ALL(outlink, avctx);
268
269 if (ctx->xfade_is_over) {
270 ret = ff_inlink_consume_frame(avctx->inputs[1], &in);
271 if (ret < 0) {
272 return ret;
273 } else if (ret > 0) {
274 in->pts = (in->pts - ctx->last_pts) + ctx->pts;
275 return ff_filter_frame(outlink, in);
276 } else if (ff_inlink_acknowledge_status(avctx->inputs[1], &status, &pts)) {
277 ff_outlink_set_status(outlink, status, ctx->pts);
278 return 0;
279 } else if (!ret) {
280 if (ff_outlink_frame_wanted(outlink)) {
282 return 0;
283 }
284 }
285 }
286
287 if (ff_inlink_queued_frames(avctx->inputs[0]) > 0) {
288 ctx->xf[0] = ff_inlink_peek_frame(avctx->inputs[0], 0);
289 if (ctx->xf[0]) {
290 if (ctx->first_pts == AV_NOPTS_VALUE) {
291 ctx->first_pts = ctx->xf[0]->pts;
292 }
293 ctx->pts = ctx->xf[0]->pts;
294 if (ctx->first_pts + ctx->offset_pts > ctx->xf[0]->pts) {
295 ctx->xf[0] = NULL;
296 ctx->need_second = 0;
297 ret = ff_inlink_consume_frame(avctx->inputs[0], &in);
298 if (ret < 0)
299 return ret;
300 return ff_filter_frame(outlink, in);
301 }
302
303 ctx->need_second = 1;
304 }
305 }
306
307 if (ctx->xf[0] && ff_inlink_queued_frames(avctx->inputs[1]) > 0) {
308 ret = ff_inlink_consume_frame(avctx->inputs[0], &ctx->xf[0]);
309 if (ret < 0)
310 return ret;
311 ret = ff_inlink_consume_frame(avctx->inputs[1], &ctx->xf[1]);
312 if (ret < 0) {
313 av_frame_free(&ctx->xf[0]);
314 return ret;
315 }
316
317 ctx->last_pts = ctx->xf[1]->pts;
318 ctx->pts = ctx->xf[0]->pts;
319 if (ctx->xf[0]->pts - (ctx->first_pts + ctx->offset_pts) > ctx->duration_pts)
320 ctx->xfade_is_over = 1;
321 ret = xfade_frame(avctx, ctx->xf[0], ctx->xf[1]);
322 av_frame_free(&ctx->xf[0]);
323 av_frame_free(&ctx->xf[1]);
324 return ret;
325 }
326
327 if (ff_inlink_queued_frames(avctx->inputs[0]) > 0 &&
328 ff_inlink_queued_frames(avctx->inputs[1]) > 0) {
329 ff_filter_set_ready(avctx, 100);
330 return 0;
331 }
332
333 if (ff_outlink_frame_wanted(outlink)) {
334 if (!ctx->eof[0] && ff_outlink_get_status(avctx->inputs[0])) {
335 ctx->eof[0] = 1;
336 ctx->xfade_is_over = 1;
337 }
338 if (!ctx->eof[1] && ff_outlink_get_status(avctx->inputs[1])) {
339 ctx->eof[1] = 1;
340 }
341 if (!ctx->eof[0] && !ctx->xf[0])
343 if (!ctx->eof[1] && (ctx->need_second || ctx->eof[0]))
345 if (ctx->eof[0] && ctx->eof[1] && (
346 ff_inlink_queued_frames(avctx->inputs[0]) <= 0 ||
347 ff_inlink_queued_frames(avctx->inputs[1]) <= 0))
349 return 0;
350 }
351
352 return FFERROR_NOT_READY;
353}
354
356{
357 XFadeOpenCLContext *ctx = avctx->priv;
358 cl_int cle;
359
360 if (ctx->kernel) {
361 cle = clReleaseKernel(ctx->kernel);
362 if (cle != CL_SUCCESS)
363 av_log(avctx, AV_LOG_ERROR, "Failed to release "
364 "kernel: %d.\n", cle);
365 }
366
367 if (ctx->command_queue) {
368 cle = clReleaseCommandQueue(ctx->command_queue);
369 if (cle != CL_SUCCESS)
370 av_log(avctx, AV_LOG_ERROR, "Failed to release "
371 "command queue: %d.\n", cle);
372 }
373
375}
376
377static AVFrame *get_video_buffer(AVFilterLink *inlink, int w, int h)
378{
379 XFadeOpenCLContext *s = inlink->dst->priv;
380
381 return s->xfade_is_over || !s->need_second ?
382 ff_null_get_video_buffer (inlink, w, h) :
384}
385
386#define OFFSET(x) offsetof(XFadeOpenCLContext, x)
387#define FLAGS (AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_VIDEO_PARAM)
388
390 { "transition", "set cross fade transition", OFFSET(transition), AV_OPT_TYPE_INT, {.i64=1}, 0, NB_TRANSITIONS-1, FLAGS, .unit = "transition" },
391 { "custom", "custom transition", 0, AV_OPT_TYPE_CONST, {.i64=CUSTOM}, 0, 0, FLAGS, .unit = "transition" },
392 { "fade", "fade transition", 0, AV_OPT_TYPE_CONST, {.i64=FADE}, 0, 0, FLAGS, .unit = "transition" },
393 { "wipeleft", "wipe left transition", 0, AV_OPT_TYPE_CONST, {.i64=WIPELEFT}, 0, 0, FLAGS, .unit = "transition" },
394 { "wiperight", "wipe right transition", 0, AV_OPT_TYPE_CONST, {.i64=WIPERIGHT}, 0, 0, FLAGS, .unit = "transition" },
395 { "wipeup", "wipe up transition", 0, AV_OPT_TYPE_CONST, {.i64=WIPEUP}, 0, 0, FLAGS, .unit = "transition" },
396 { "wipedown", "wipe down transition", 0, AV_OPT_TYPE_CONST, {.i64=WIPEDOWN}, 0, 0, FLAGS, .unit = "transition" },
397 { "slideleft", "slide left transition", 0, AV_OPT_TYPE_CONST, {.i64=SLIDELEFT}, 0, 0, FLAGS, .unit = "transition" },
398 { "slideright", "slide right transition", 0, AV_OPT_TYPE_CONST, {.i64=SLIDERIGHT}, 0, 0, FLAGS, .unit = "transition" },
399 { "slideup", "slide up transition", 0, AV_OPT_TYPE_CONST, {.i64=SLIDEUP}, 0, 0, FLAGS, .unit = "transition" },
400 { "slidedown", "slide down transition", 0, AV_OPT_TYPE_CONST, {.i64=SLIDEDOWN}, 0, 0, FLAGS, .unit = "transition" },
401 { "source", "set OpenCL program source file for custom transition", OFFSET(source_file), AV_OPT_TYPE_STRING, {.str = NULL}, .flags = FLAGS },
402 { "kernel", "set kernel name in program file for custom transition", OFFSET(kernel_name), AV_OPT_TYPE_STRING, {.str = NULL}, .flags = FLAGS },
403 { "duration", "set cross fade duration", OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64=1000000}, 0, 60000000, FLAGS },
404 { "offset", "set cross fade start relative to first input stream", OFFSET(offset), AV_OPT_TYPE_DURATION, {.i64=0}, INT64_MIN, INT64_MAX, FLAGS },
405 { NULL }
406};
407
409
411 {
412 .name = "main",
413 .type = AVMEDIA_TYPE_VIDEO,
414 .get_buffer.video = get_video_buffer,
415 .config_props = &ff_opencl_filter_config_input,
416 },
417 {
418 .name = "xfade",
419 .type = AVMEDIA_TYPE_VIDEO,
420 .get_buffer.video = get_video_buffer,
421 .config_props = &ff_opencl_filter_config_input,
422 },
423};
424
426 {
427 .name = "default",
428 .type = AVMEDIA_TYPE_VIDEO,
429 .config_props = &xfade_opencl_config_output,
430 },
431};
432
434 .p.name = "xfade_opencl",
435 .p.description = NULL_IF_CONFIG_SMALL("Cross fade one video with another video."),
436 .p.priv_class = &xfade_opencl_class,
437 .p.flags = AVFILTER_FLAG_HWDEVICE,
438 .priv_size = sizeof(XFadeOpenCLContext),
445 .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
446};
#define FADE(name, type)
Definition af_afade.c:185
const FFFilter ff_vf_xfade_opencl
static AVFormatContext * ctx
static AVFrame * get_video_buffer(AVFilterLink *inlink, int w, int h)
Definition avf_concat.c:205
int ff_outlink_get_status(AVFilterLink *link)
Get the status on an output link.
Definition avfilter.c:1648
int ff_inlink_acknowledge_status(AVFilterLink *link, int *rstatus, int64_t *rpts)
Test and acknowledge the change of status on the link.
Definition avfilter.c:1467
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition avfilter.c:1068
int ff_outlink_frame_wanted(AVFilterLink *link)
Test if a frame is wanted on an output link.
Definition avfilter.c:1690
size_t ff_inlink_queued_frames(AVFilterLink *link)
Get the number of frames available on the link.
Definition avfilter.c:1483
AVFrame * ff_inlink_peek_frame(AVFilterLink *link, size_t idx)
Access a frame in the link fifo without consuming it.
Definition avfilter.c:1561
void ff_filter_set_ready(AVFilterContext *filter, unsigned priority)
Mark a filter ready and schedule it for activation.
Definition avfilter.c:229
int ff_inlink_consume_frame(AVFilterLink *link, AVFrame **rframe)
Take a frame from the link's FIFO and update the link's stats.
Definition avfilter.c:1520
void ff_inlink_request_frame(AVFilterLink *link)
Mark that a frame is wanted on the link.
Definition avfilter.c:1623
Main libavfilter public API header.
#define i(width, name, range_min, range_max)
Definition cbs_h264.c:63
#define s(width, name)
Definition cbs_vp9.c:198
#define FLAGS
Definition cmdutils.c:598
#define av_clipf
Definition common.h:145
#define NULL
Definition coverity.c:32
long long int64_t
Definition coverity.c:34
int(* init)(AVBSFContext *ctx)
Definition dts2pts.c:608
static int64_t duration
Definition ffplay.c:330
#define fail
Definition test.h:479
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition opt.h:298
@ AV_OPT_TYPE_DURATION
Underlying C type is int64_t.
Definition opt.h:318
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition opt.h:258
@ 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:275
#define AVFILTER_FLAG_HWDEVICE
The filter can create hardware frames using AVFilterContext.hw_device_ctx.
Definition avfilter.h:187
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
Definition error.h:52
#define AVERROR_EOF
End of file.
Definition error.h:57
#define AVERROR(e)
Definition error.h:45
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition frame.c:64
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
Definition frame.c:599
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition log.h:210
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
@ AVMEDIA_TYPE_VIDEO
Definition avutil.h:200
#define AV_NOPTS_VALUE
Undefined timestamp value.
Definition avutil.h:247
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
Definition avutil.h:263
int a
#define b
Definition input.c:43
static av_cold void uninit(AVBitStreamFilterContext *ctx)
static int activate(AVBitStreamFilterContext *ctx)
unsigned offset
Definition libaomenc.c:763
#define FILTER_INPUTS(array)
Definition filters.h:264
#define FILTER_OUTPUTS(array)
Definition filters.h:265
#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:208
static void ff_outlink_set_status(AVFilterLink *link, int status, int64_t pts)
Set the status field of a link from the source filter.
Definition filters.h:629
#define FFERROR_NOT_READY
Filters implementation helper functions and internal structures.
Definition filters.h:34
#define FF_FILTER_FORWARD_STATUS_BACK_ALL(outlink, filter)
Forward the status on an output link to all input links.
Definition filters.h:652
static FilterLink * ff_filter_link(AVFilterLink *link)
Definition filters.h:199
#define FILTER_SINGLE_PIXFMT(pix_fmt_)
Definition filters.h:254
#define AVFILTER_DEFINE_CLASS(fname)
Definition filters.h:478
#define av_cold
Definition attributes.h:117
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition internal.h:88
uint8_t w
Definition llvidencdsp.c:39
#define FFMAX(a, b)
Definition macros.h:47
void ff_opencl_filter_uninit(AVFilterContext *avctx)
Uninitialise an OpenCL filter context.
Definition opencl.c:144
int ff_opencl_filter_load_program(AVFilterContext *avctx, const char **program_source_array, int nb_strings)
Load a new OpenCL program from strings in memory.
Definition opencl.c:159
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
int ff_opencl_filter_init(AVFilterContext *avctx)
Initialise an OpenCL filter context.
Definition opencl.c:135
int ff_opencl_filter_work_size_from_image(AVFilterContext *avctx, size_t *work_size, AVFrame *frame, int plane, int block_alignment)
Find the work size needed needed for a given plane of an image.
Definition opencl.c:266
int ff_opencl_filter_config_output(AVFilterLink *outlink)
Create a suitable hardware frames context for the output.
Definition opencl.c:83
int ff_opencl_filter_load_program_from_file(AVFilterContext *avctx, const char *filename)
Load a new OpenCL program from a file.
Definition opencl.c:207
#define CL_SET_KERNEL_ARG(kernel, arg_num, type, arg)
set argument to specific Kernel.
Definition opencl.h:61
#define CL_FAIL_ON_ERROR(errcode,...)
A helper macro to handle OpenCL errors.
Definition opencl.h:74
const char * ff_source_xfade_cl
AVOptions.
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition pixdesc.c:3460
AVPixelFormat
Pixel format.
Definition pixfmt.h:71
@ AV_PIX_FMT_OPENCL
Hardware surfaces for OpenCL.
Definition pixfmt.h:358
int plane
Which of the 4 planes contains the component.
Definition pixdesc.h:34
An instance of a filter.
Definition avfilter.h:273
AVFilterLink ** inputs
array of pointers to input links
Definition avfilter.h:281
AVFilterPad * input_pads
array of input pads
Definition avfilter.h:280
void * priv
private data for use by the filter
Definition avfilter.h:288
AVFilterLink ** outputs
array of pointers to output links
Definition avfilter.h:285
A filter pad used for either input or output.
Definition filters.h:40
const char * name
Pad name.
Definition filters.h:46
This structure describes decoded (raw) audio or video data.
Definition frame.h:472
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
Definition frame.h:574
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition frame.h:493
This struct describes a set or pool of "hardware" frames (i.e.
Definition hwcontext.h:118
enum AVPixelFormat sw_format
The pixel format identifying the actual data layout of the hardware frames.
Definition hwcontext.h:213
AVOption.
Definition opt.h:428
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition pixdesc.h:69
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
Definition pixdesc.h:105
uint8_t nb_components
The number of components each pixel has, (1-4)
Definition pixdesc.h:71
int num
Numerator.
Definition rational.h:59
int den
Denominator.
Definition rational.h:60
const char * kernel_name
cl_command_queue command_queue
const char * source_file
OpenCLFilterContext ocf
#define av_log(a,...)
static int64_t pts
XFadeTransitions
Definition vf_xfade.c:29
@ WIPELEFT
Definition vf_xfade.c:32
@ SLIDEUP
Definition vf_xfade.c:38
@ SLIDEDOWN
Definition vf_xfade.c:39
@ WIPEDOWN
Definition vf_xfade.c:35
@ CUSTOM
Definition vf_xfade.c:30
@ NB_TRANSITIONS
Definition vf_xfade.c:89
@ WIPERIGHT
Definition vf_xfade.c:33
@ SLIDELEFT
Definition vf_xfade.c:36
@ SLIDERIGHT
Definition vf_xfade.c:37
@ WIPEUP
Definition vf_xfade.c:34
static const AVOption xfade_opencl_options[]
static int xfade_frame(AVFilterContext *avctx, AVFrame *a, AVFrame *b)
static int xfade_opencl_config_output(AVFilterLink *outlink)
static AVFrame * get_video_buffer(AVFilterLink *inlink, int w, int h)
static const AVFilterPad xfade_opencl_inputs[]
static int xfade_opencl_load(AVFilterContext *avctx, enum AVPixelFormat main_format, enum AVPixelFormat xfade_format)
static const AVFilterPad xfade_opencl_outputs[]
static int xfade_opencl_activate(AVFilterContext *avctx)
#define OFFSET(x)
static av_cold void xfade_opencl_uninit(AVFilterContext *avctx)
AVFrame * ff_null_get_video_buffer(AVFilterLink *link, int w, int h)
Definition video.c:44
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
Definition video.c:89
AVFrame * ff_default_get_video_buffer(AVFilterLink *link, int w, int h)
Definition video.c:84