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 ctx->duration_pts = av_rescale_q(ctx->duration, AV_TIME_BASE_Q, outlink->time_base);
252 if (!ctx->duration_pts)
253 ctx->duration_pts = 1;
254 if (ctx->offset)
255 ctx->offset_pts = av_rescale_q(ctx->offset, AV_TIME_BASE_Q, outlink->time_base);
256
257 return 0;
258}
259
261{
262 XFadeOpenCLContext *ctx = avctx->priv;
263 AVFilterLink *outlink = avctx->outputs[0];
264 AVFrame *in = NULL;
265 int ret = 0, status;
266 int64_t pts;
267
268 FF_FILTER_FORWARD_STATUS_BACK_ALL(outlink, avctx);
269
270 if (ctx->xfade_is_over) {
271 ret = ff_inlink_consume_frame(avctx->inputs[1], &in);
272 if (ret < 0) {
273 return ret;
274 } else if (ret > 0) {
275 in->pts = (in->pts - ctx->last_pts) + ctx->pts;
276 return ff_filter_frame(outlink, in);
277 } else if (ff_inlink_acknowledge_status(avctx->inputs[1], &status, &pts)) {
278 ff_outlink_set_status(outlink, status, ctx->pts);
279 return 0;
280 } else if (!ret) {
281 if (ff_outlink_frame_wanted(outlink)) {
283 return 0;
284 }
285 }
286 }
287
288 if (ff_inlink_queued_frames(avctx->inputs[0]) > 0) {
289 ctx->xf[0] = ff_inlink_peek_frame(avctx->inputs[0], 0);
290 if (ctx->xf[0]) {
291 if (ctx->first_pts == AV_NOPTS_VALUE) {
292 ctx->first_pts = ctx->xf[0]->pts;
293 }
294 ctx->pts = ctx->xf[0]->pts;
295 if (ctx->first_pts + ctx->offset_pts > ctx->xf[0]->pts) {
296 ctx->xf[0] = NULL;
297 ctx->need_second = 0;
298 ret = ff_inlink_consume_frame(avctx->inputs[0], &in);
299 if (ret < 0)
300 return ret;
301 return ff_filter_frame(outlink, in);
302 }
303
304 ctx->need_second = 1;
305 }
306 }
307
308 if (ctx->xf[0] && ff_inlink_queued_frames(avctx->inputs[1]) > 0) {
309 ret = ff_inlink_consume_frame(avctx->inputs[0], &ctx->xf[0]);
310 if (ret < 0)
311 return ret;
312 ret = ff_inlink_consume_frame(avctx->inputs[1], &ctx->xf[1]);
313 if (ret < 0) {
314 av_frame_free(&ctx->xf[0]);
315 return ret;
316 }
317
318 ctx->last_pts = ctx->xf[1]->pts;
319 ctx->pts = ctx->xf[0]->pts;
320 if (ctx->xf[0]->pts - (ctx->first_pts + ctx->offset_pts) > ctx->duration_pts)
321 ctx->xfade_is_over = 1;
322 ret = xfade_frame(avctx, ctx->xf[0], ctx->xf[1]);
323 av_frame_free(&ctx->xf[0]);
324 av_frame_free(&ctx->xf[1]);
325 return ret;
326 }
327
328 if (ff_inlink_queued_frames(avctx->inputs[0]) > 0 &&
329 ff_inlink_queued_frames(avctx->inputs[1]) > 0) {
330 ff_filter_set_ready(avctx, 100);
331 return 0;
332 }
333
334 if (ff_outlink_frame_wanted(outlink)) {
335 if (!ctx->eof[0] && ff_outlink_get_status(avctx->inputs[0])) {
336 ctx->eof[0] = 1;
337 ctx->xfade_is_over = 1;
338 }
339 if (!ctx->eof[1] && ff_outlink_get_status(avctx->inputs[1])) {
340 ctx->eof[1] = 1;
341 }
342 if (!ctx->eof[0] && !ctx->xf[0])
344 if (!ctx->eof[1] && (ctx->need_second || ctx->eof[0]))
346 if (ctx->eof[0] && ctx->eof[1] && (
347 ff_inlink_queued_frames(avctx->inputs[0]) <= 0 ||
348 ff_inlink_queued_frames(avctx->inputs[1]) <= 0))
350 return 0;
351 }
352
353 return FFERROR_NOT_READY;
354}
355
357{
358 XFadeOpenCLContext *ctx = avctx->priv;
359 cl_int cle;
360
361 if (ctx->kernel) {
362 cle = clReleaseKernel(ctx->kernel);
363 if (cle != CL_SUCCESS)
364 av_log(avctx, AV_LOG_ERROR, "Failed to release "
365 "kernel: %d.\n", cle);
366 }
367
368 if (ctx->command_queue) {
369 cle = clReleaseCommandQueue(ctx->command_queue);
370 if (cle != CL_SUCCESS)
371 av_log(avctx, AV_LOG_ERROR, "Failed to release "
372 "command queue: %d.\n", cle);
373 }
374
376}
377
378static AVFrame *get_video_buffer(AVFilterLink *inlink, int w, int h)
379{
380 XFadeOpenCLContext *s = inlink->dst->priv;
381
382 return s->xfade_is_over || !s->need_second ?
383 ff_null_get_video_buffer (inlink, w, h) :
385}
386
387#define OFFSET(x) offsetof(XFadeOpenCLContext, x)
388#define FLAGS (AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_VIDEO_PARAM)
389
391 { "transition", "set cross fade transition", OFFSET(transition), AV_OPT_TYPE_INT, {.i64=1}, 0, NB_TRANSITIONS-1, FLAGS, .unit = "transition" },
392 { "custom", "custom transition", 0, AV_OPT_TYPE_CONST, {.i64=CUSTOM}, 0, 0, FLAGS, .unit = "transition" },
393 { "fade", "fade transition", 0, AV_OPT_TYPE_CONST, {.i64=FADE}, 0, 0, FLAGS, .unit = "transition" },
394 { "wipeleft", "wipe left transition", 0, AV_OPT_TYPE_CONST, {.i64=WIPELEFT}, 0, 0, FLAGS, .unit = "transition" },
395 { "wiperight", "wipe right transition", 0, AV_OPT_TYPE_CONST, {.i64=WIPERIGHT}, 0, 0, FLAGS, .unit = "transition" },
396 { "wipeup", "wipe up transition", 0, AV_OPT_TYPE_CONST, {.i64=WIPEUP}, 0, 0, FLAGS, .unit = "transition" },
397 { "wipedown", "wipe down transition", 0, AV_OPT_TYPE_CONST, {.i64=WIPEDOWN}, 0, 0, FLAGS, .unit = "transition" },
398 { "slideleft", "slide left transition", 0, AV_OPT_TYPE_CONST, {.i64=SLIDELEFT}, 0, 0, FLAGS, .unit = "transition" },
399 { "slideright", "slide right transition", 0, AV_OPT_TYPE_CONST, {.i64=SLIDERIGHT}, 0, 0, FLAGS, .unit = "transition" },
400 { "slideup", "slide up transition", 0, AV_OPT_TYPE_CONST, {.i64=SLIDEUP}, 0, 0, FLAGS, .unit = "transition" },
401 { "slidedown", "slide down transition", 0, AV_OPT_TYPE_CONST, {.i64=SLIDEDOWN}, 0, 0, FLAGS, .unit = "transition" },
402 { "source", "set OpenCL program source file for custom transition", OFFSET(source_file), AV_OPT_TYPE_STRING, {.str = NULL}, .flags = FLAGS },
403 { "kernel", "set kernel name in program file for custom transition", OFFSET(kernel_name), AV_OPT_TYPE_STRING, {.str = NULL}, .flags = FLAGS },
404 { "duration", "set cross fade duration", OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64=1000000}, 0, 60000000, FLAGS },
405 { "offset", "set cross fade start relative to first input stream", OFFSET(offset), AV_OPT_TYPE_DURATION, {.i64=0}, INT64_MIN, INT64_MAX, FLAGS },
406 { NULL }
407};
408
410
412 {
413 .name = "main",
414 .type = AVMEDIA_TYPE_VIDEO,
415 .get_buffer.video = get_video_buffer,
416 .config_props = &ff_opencl_filter_config_input,
417 },
418 {
419 .name = "xfade",
420 .type = AVMEDIA_TYPE_VIDEO,
421 .get_buffer.video = get_video_buffer,
422 .config_props = &ff_opencl_filter_config_input,
423 },
424};
425
427 {
428 .name = "default",
429 .type = AVMEDIA_TYPE_VIDEO,
430 .config_props = &xfade_opencl_config_output,
431 },
432};
433
435 .p.name = "xfade_opencl",
436 .p.description = NULL_IF_CONFIG_SMALL("Cross fade one video with another video."),
437 .p.priv_class = &xfade_opencl_class,
438 .p.flags = AVFILTER_FLAG_HWDEVICE,
439 .priv_size = sizeof(XFadeOpenCLContext),
446 .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
447};
#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:1653
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:1472
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition avfilter.c:1073
int ff_outlink_frame_wanted(AVFilterLink *link)
Test if a frame is wanted on an output link.
Definition avfilter.c:1695
size_t ff_inlink_queued_frames(AVFilterLink *link)
Get the number of frames available on the link.
Definition avfilter.c:1488
AVFrame * ff_inlink_peek_frame(AVFilterLink *link, size_t idx)
Access a frame in the link fifo without consuming it.
Definition avfilter.c:1566
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:1525
void ff_inlink_request_frame(AVFilterLink *link)
Mark that a frame is wanted on the link.
Definition avfilter.c:1628
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:596
#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:399
#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:193
#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:97
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:3484
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:279
AVFilterLink ** inputs
array of pointers to input links
Definition avfilter.h:287
AVFilterPad * input_pads
array of input pads
Definition avfilter.h:286
void * priv
private data for use by the filter
Definition avfilter.h:294
AVFilterLink ** outputs
array of pointers to output links
Definition avfilter.h:291
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:479
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
Definition frame.h:581
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition frame.h:500
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:90
AVFrame * ff_default_get_video_buffer(AVFilterLink *link, int w, int h)
Definition video.c:85