FFmpeg
Loading...
Searching...
No Matches
xfade.c
Go to the documentation of this file.
1// Generated from libavfilter/opencl/xfade.cl
2const char *ff_source_xfade_cl =
3"/*\n"
4" * This file is part of FFmpeg.\n"
5" *\n"
6" * FFmpeg is free software; you can redistribute it and/or\n"
7" * modify it under the terms of the GNU Lesser General Public\n"
8" * License as published by the Free Software Foundation; either\n"
9" * version 2.1 of the License, or (at your option) any later version.\n"
10" *\n"
11" * FFmpeg is distributed in the hope that it will be useful,\n"
12" * but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
13" * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n"
14" * Lesser General Public License for more details.\n"
15" *\n"
16" * You should have received a copy of the GNU Lesser General Public\n"
17" * License along with FFmpeg; if not, write to the Free Software\n"
18" * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA\n"
19" */\n"
20"\n"
21"const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |\n"
22" CLK_FILTER_NEAREST);\n"
23"\n"
24"__kernel void fade(__write_only image2d_t dst,\n"
25" __read_only image2d_t src1,\n"
26" __read_only image2d_t src2,\n"
27" float progress)\n"
28"{\n"
29" int2 p = (int2)(get_global_id(0), get_global_id(1));\n"
30"\n"
31" float4 val1 = read_imagef(src1, sampler, p);\n"
32" float4 val2 = read_imagef(src2, sampler, p);\n"
33"\n"
34" write_imagef(dst, p, mix(val2, val1, progress));\n"
35"}\n"
36"\n"
37"__kernel void wipeleft(__write_only image2d_t dst,\n"
38" __read_only image2d_t src1,\n"
39" __read_only image2d_t src2,\n"
40" float progress)\n"
41"{\n"
42" int s = (int)(get_image_dim(src1).x * progress);\n"
43" int2 p = (int2)(get_global_id(0), get_global_id(1));\n"
44"\n"
45" float4 val1 = read_imagef(src1, sampler, p);\n"
46" float4 val2 = read_imagef(src2, sampler, p);\n"
47"\n"
48" write_imagef(dst, p, p.x > s ? val2 : val1);\n"
49"}\n"
50"\n"
51"__kernel void wiperight(__write_only image2d_t dst,\n"
52" __read_only image2d_t src1,\n"
53" __read_only image2d_t src2,\n"
54" float progress)\n"
55"{\n"
56" int s = (int)(get_image_dim(src1).x * (1.f - progress));\n"
57" int2 p = (int2)(get_global_id(0), get_global_id(1));\n"
58"\n"
59" float4 val1 = read_imagef(src1, sampler, p);\n"
60" float4 val2 = read_imagef(src2, sampler, p);\n"
61"\n"
62" write_imagef(dst, p, p.x > s ? val1 : val2);\n"
63"}\n"
64"\n"
65"__kernel void wipeup(__write_only image2d_t dst,\n"
66" __read_only image2d_t src1,\n"
67" __read_only image2d_t src2,\n"
68" float progress)\n"
69"{\n"
70" int s = (int)(get_image_dim(src1).y * progress);\n"
71" int2 p = (int2)(get_global_id(0), get_global_id(1));\n"
72"\n"
73" float4 val1 = read_imagef(src1, sampler, p);\n"
74" float4 val2 = read_imagef(src2, sampler, p);\n"
75"\n"
76" write_imagef(dst, p, p.y > s ? val2 : val1);\n"
77"}\n"
78"\n"
79"__kernel void wipedown(__write_only image2d_t dst,\n"
80" __read_only image2d_t src1,\n"
81" __read_only image2d_t src2,\n"
82" float progress)\n"
83"{\n"
84" int s = (int)(get_image_dim(src1).y * (1.f - progress));\n"
85" int2 p = (int2)(get_global_id(0), get_global_id(1));\n"
86"\n"
87" float4 val1 = read_imagef(src1, sampler, p);\n"
88" float4 val2 = read_imagef(src2, sampler, p);\n"
89"\n"
90" write_imagef(dst, p, p.y > s ? val1 : val2);\n"
91"}\n"
92"\n"
93"void slide(__write_only image2d_t dst,\n"
94" __read_only image2d_t src1,\n"
95" __read_only image2d_t src2,\n"
96" float progress,\n"
97" int2 direction)\n"
98"{\n"
99" int w = get_image_dim(src1).x;\n"
100" int h = get_image_dim(src1).y;\n"
101" int2 wh = (int2)(w, h);\n"
102" int2 uv = (int2)(get_global_id(0), get_global_id(1));\n"
103" int2 pi = (int2)(progress * w, progress * h);\n"
104" int2 p = uv + pi * direction;\n"
105" int2 f = p % wh;\n"
106"\n"
107" f = f + (int2)(w, h) * (int2)(f.x < 0, f.y < 0);\n"
108" float4 val1 = read_imagef(src1, sampler, f);\n"
109" float4 val2 = read_imagef(src2, sampler, f);\n"
110" write_imagef(dst, uv, mix(val1, val2, (p.y >= 0) * (h > p.y) * (p.x >= 0) * (w > p.x)));\n"
111"}\n"
112"\n"
113"__kernel void slidedown(__write_only image2d_t dst,\n"
114" __read_only image2d_t src1,\n"
115" __read_only image2d_t src2,\n"
116" float progress)\n"
117"{\n"
118" int2 direction = (int2)(0, 1);\n"
119" slide(dst, src1, src2, progress, direction);\n"
120"}\n"
121"\n"
122"__kernel void slideup(__write_only image2d_t dst,\n"
123" __read_only image2d_t src1,\n"
124" __read_only image2d_t src2,\n"
125" float progress)\n"
126"{\n"
127" int2 direction = (int2)(0, -1);\n"
128" slide(dst, src1, src2, progress, direction);\n"
129"}\n"
130"\n"
131"__kernel void slideleft(__write_only image2d_t dst,\n"
132" __read_only image2d_t src1,\n"
133" __read_only image2d_t src2,\n"
134" float progress)\n"
135"{\n"
136" int2 direction = (int2)(-1, 0);\n"
137" slide(dst, src1, src2, progress, direction);\n"
138"}\n"
139"\n"
140"__kernel void slideright(__write_only image2d_t dst,\n"
141" __read_only image2d_t src1,\n"
142" __read_only image2d_t src2,\n"
143" float progress)\n"
144"{\n"
145" int2 direction = (int2)(1, 0);\n"
146" slide(dst, src1, src2, progress, direction);\n"
147"}\n"
148;
const char * ff_source_xfade_cl
Definition xfade.c:2