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