FFmpeg  4.3.7
avgblur.c
Go to the documentation of this file.
1 // Generated from libavfilter/opencl/avgblur.cl
3 "#line 1 \"libavfilter/opencl/avgblur.cl\"\n"
4 "/*\n"
5 " * Copyright (c) 2018 Dylan Fernando\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 avgblur_horiz(__write_only image2d_t dst,\n"
26 " __read_only image2d_t src,\n"
27 " int rad)\n"
28 "{\n"
29 " const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |\n"
30 " CLK_FILTER_NEAREST);\n"
31 " int2 loc = (int2)(get_global_id(0), get_global_id(1));\n"
32 " int2 size = (int2)(get_global_size(0), get_global_size(1));\n"
33 "\n"
34 " int count = 0;\n"
35 " float4 acc = (float4)(0,0,0,0);\n"
36 "\n"
37 " for (int xx = max(0, loc.x - rad); xx < min(loc.x + rad + 1, size.x); xx++) {\n"
38 " count++;\n"
39 " acc += read_imagef(src, sampler, (int2)(xx, loc.y));\n"
40 " }\n"
41 "\n"
42 " write_imagef(dst, loc, acc / count);\n"
43 "}\n"
44 "\n"
45 "__kernel void avgblur_vert(__write_only image2d_t dst,\n"
46 " __read_only image2d_t src,\n"
47 " int radv)\n"
48 "{\n"
49 " const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |\n"
50 " CLK_FILTER_NEAREST);\n"
51 " int2 loc = (int2)(get_global_id(0), get_global_id(1));\n"
52 " int2 size = (int2)(get_global_size(0), get_global_size(1));\n"
53 "\n"
54 " int count = 0;\n"
55 " float4 acc = (float4)(0,0,0,0);\n"
56 "\n"
57 " for (int yy = max(0, loc.y - radv); yy < min(loc.y + radv + 1, size.y); yy++) {\n"
58 " count++;\n"
59 " acc += read_imagef(src, sampler, (int2)(loc.x, yy));\n"
60 " }\n"
61 "\n"
62 " write_imagef(dst, loc, acc / count);\n"
63 "}\n"
64 ;
const char * ff_opencl_source_avgblur
Definition: avgblur.c:2