FFmpeg
4.3
libavfilter
opencl
neighbor.c
Go to the documentation of this file.
1
// Generated from libavfilter/opencl/neighbor.cl
2
const
char
*
ff_opencl_source_neighbor
=
3
"#line 1 \"libavfilter/opencl/neighbor.cl\"\n"
4
"/*\n"
5
" * Copyright (c) 2018 Danil Iashchenko\n"
6
" *\n"
7
" * This file is part of FFmpeg.\n"
8
" *\n"
9
" * FFmpeg is free software; you can redistribute it and/or\n"
10
" * modify it under the terms of the GNU Lesser General Public\n"
11
" * License as published by the Free Software Foundation; either\n"
12
" * version 2.1 of the License, or (at your option) any later version.\n"
13
" *\n"
14
" * FFmpeg is distributed in the hope that it will be useful,\n"
15
" * but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
16
" * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n"
17
" * Lesser General Public License for more details.\n"
18
" *\n"
19
" * You should have received a copy of the GNU Lesser General Public\n"
20
" * License along with FFmpeg; if not, write to the Free Software\n"
21
" * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA\n"
22
" */\n"
23
"\n"
24
"\n"
25
"__kernel void erosion_global(__write_only image2d_t dst,\n"
26
" __read_only image2d_t src,\n"
27
" float threshold,\n"
28
" __constant int *coord)\n"
29
"{\n"
30
" const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |\n"
31
" CLK_ADDRESS_CLAMP_TO_EDGE |\n"
32
" CLK_FILTER_NEAREST);\n"
33
"\n"
34
" int2 loc = (int2)(get_global_id(0), get_global_id(1));\n"
35
"\n"
36
" float4 px = read_imagef(src, sampler, loc);\n"
37
" float limit = px.x - threshold;\n"
38
" if (limit < 0) {\n"
39
" limit = 0;\n"
40
" }\n"
41
"\n"
42
" for (int i = -1; i <= 1; i++) {\n"
43
" for (int j = -1; j <= 1; j++) {\n"
44
" if (coord[(j + 1) * 3 + (i + 1)] == 1) {\n"
45
" float4 cur = read_imagef(src, sampler, loc + (int2)(i, j));\n"
46
" if (cur.x < px.x) {\n"
47
" px = cur;\n"
48
" }\n"
49
" }\n"
50
" }\n"
51
" }\n"
52
" if (limit > px.x) {\n"
53
" px = (float4)(limit);\n"
54
" }\n"
55
" write_imagef(dst, loc, px);\n"
56
"}\n"
57
"\n"
58
"\n"
59
"__kernel void dilation_global(__write_only image2d_t dst,\n"
60
" __read_only image2d_t src,\n"
61
" float threshold,\n"
62
" __constant int *coord)\n"
63
"{\n"
64
" const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |\n"
65
" CLK_ADDRESS_CLAMP_TO_EDGE |\n"
66
" CLK_FILTER_NEAREST);\n"
67
"\n"
68
" int2 loc = (int2)(get_global_id(0), get_global_id(1));\n"
69
"\n"
70
" float4 px = read_imagef(src, sampler, loc);\n"
71
" float limit = px.x + threshold;\n"
72
" if (limit > 1) {\n"
73
" limit = 1;\n"
74
" }\n"
75
"\n"
76
" for (int i = -1; i <= 1; i++) {\n"
77
" for (int j = -1; j <= 1; j++) {\n"
78
" if (coord[(j + 1) * 3 + (i + 1)] == 1) {\n"
79
" float4 cur = read_imagef(src, sampler, loc + (int2)(i, j));\n"
80
" if (cur.x > px.x) {\n"
81
" px = cur;\n"
82
" }\n"
83
" }\n"
84
" }\n"
85
" }\n"
86
" if (limit < px.x) {\n"
87
" px = (float4)(limit);\n"
88
" }\n"
89
" write_imagef(dst, loc, px);\n"
90
"}\n"
91
;
ff_opencl_source_neighbor
const char * ff_opencl_source_neighbor
Definition:
neighbor.c:2
Generated on Tue Jun 16 2020 05:18:01 for FFmpeg by
1.8.17