diff options
author | Paul B Mahol <onemda@gmail.com> | 2020-01-23 16:29:34 +0100 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2020-02-02 14:08:56 +0100 |
commit | cd823dadf9d14133e215e0ab94e7900e4283af10 (patch) | |
tree | bac610a24fda31564fd22f949161ea99f270d2bc /doc/filters.texi | |
parent | 84286789e638d8f3fadbf30800aac64016b7cb3a (diff) | |
download | ffmpeg-cd823dadf9d14133e215e0ab94e7900e4283af10.tar.gz |
avfilter: add xfade opencl filter
Diffstat (limited to 'doc/filters.texi')
-rw-r--r-- | doc/filters.texi | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/doc/filters.texi b/doc/filters.texi index cbff407189..d342e57472 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -21448,6 +21448,103 @@ Apply a strong blur of both luma and chroma parameters: @end example @end itemize +@section xfade_opencl + +Cross fade two videos with custom transition effect by using OpenCL. + +It accepts the following options: + +@table @option +@item transition +Set one of possible transition effects. + +@table @option +@item custom +Select custom transition effect, the actual transition description +will be picked from source and kernel options. + +@item fade +@item wipeleft +@item wiperight +@item wipeup +@item wipedown +@item slideleft +@item slideright +@item slideup +@item slidedown + +Default transition is fade. +@end table + +@item source +OpenCL program source file for custom transition. + +@item kernel +Set name of kernel to use for custom transition from program source file. + +@item duration +Set duration of video transition. + +@item offset +Set time of start of transition relative to first video. +@end table + +The program source file must contain a kernel function with the given name, +which will be run once for each plane of the output. Each run on a plane +gets enqueued as a separate 2D global NDRange with one work-item for each +pixel to be generated. The global ID offset for each work-item is therefore +the coordinates of a pixel in the destination image. + +The kernel function needs to take the following arguments: +@itemize +@item +Destination image, @var{__write_only image2d_t}. + +This image will become the output; the kernel should write all of it. + +@item +First Source image, @var{__read_only image2d_t}. +Second Source image, @var{__read_only image2d_t}. + +These are the most recent images on each input. The kernel may read from +them to generate the output, but they can't be written to. + +@item +Transition progress, @var{float}. This value is always between 0 and 1 inclusive. +@end itemize + +Example programs: + +@itemize +@item +Apply dots curtain transition effect: +@verbatim +__kernel void blend_images(__write_only image2d_t dst, + __read_only image2d_t src1, + __read_only image2d_t src2, + float progress) +{ + const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE | + CLK_FILTER_LINEAR); + int2 p = (int2)(get_global_id(0), get_global_id(1)); + float2 rp = (float2)(get_global_id(0), get_global_id(1)); + float2 dim = (float2)(get_image_dim(src1).x, get_image_dim(src1).y); + rp = rp / dim; + + float2 dots = (float2)(20.0, 20.0); + float2 center = (float2)(0,0); + float2 unused; + + float4 val1 = read_imagef(src1, sampler, p); + float4 val2 = read_imagef(src2, sampler, p); + bool next = distance(fract(rp * dots, &unused), (float2)(0.5, 0.5)) < (progress / distance(rp, center)); + + write_imagef(dst, p, next ? val1 : val2); +} +@end verbatim + +@end itemize + @c man end OPENCL VIDEO FILTERS @chapter VAAPI Video Filters |