FFmpeg
Loading...
Searching...
No Matches
avgblur.c
Go to the documentation of this file.
1// Generated from libavfilter/opencl/avgblur.cl
3"/*\n"
4" * Copyright (c) 2018 Dylan Fernando\n"
5" *\n"
6" * This file is part of FFmpeg.\n"
7" *\n"
8" * FFmpeg is free software; you can redistribute it and/or\n"
9" * modify it under the terms of the GNU Lesser General Public\n"
10" * License as published by the Free Software Foundation; either\n"
11" * version 2.1 of the License, or (at your option) any later version.\n"
12" *\n"
13" * FFmpeg is distributed in the hope that it will be useful,\n"
14" * but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
15" * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n"
16" * Lesser General Public License for more details.\n"
17" *\n"
18" * You should have received a copy of the GNU Lesser General Public\n"
19" * License along with FFmpeg; if not, write to the Free Software\n"
20" * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA\n"
21" */\n"
22"\n"
23"\n"
24"__kernel void avgblur_horiz(__write_only image2d_t dst,\n"
25" __read_only image2d_t src,\n"
26" int rad)\n"
27"{\n"
28" const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |\n"
29" CLK_FILTER_NEAREST);\n"
30" int2 loc = (int2)(get_global_id(0), get_global_id(1));\n"
31" int2 size = (int2)(get_global_size(0), get_global_size(1));\n"
32"\n"
33" int count = 0;\n"
34" float4 acc = (float4)(0,0,0,0);\n"
35"\n"
36" for (int xx = max(0, loc.x - rad); xx < min(loc.x + rad + 1, size.x); xx++) {\n"
37" count++;\n"
38" acc += read_imagef(src, sampler, (int2)(xx, loc.y));\n"
39" }\n"
40"\n"
41" write_imagef(dst, loc, acc / count);\n"
42"}\n"
43"\n"
44"__kernel void avgblur_vert(__write_only image2d_t dst,\n"
45" __read_only image2d_t src,\n"
46" int radv)\n"
47"{\n"
48" const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |\n"
49" CLK_FILTER_NEAREST);\n"
50" int2 loc = (int2)(get_global_id(0), get_global_id(1));\n"
51" int2 size = (int2)(get_global_size(0), get_global_size(1));\n"
52"\n"
53" int count = 0;\n"
54" float4 acc = (float4)(0,0,0,0);\n"
55"\n"
56" for (int yy = max(0, loc.y - radv); yy < min(loc.y + radv + 1, size.y); yy++) {\n"
57" count++;\n"
58" acc += read_imagef(src, sampler, (int2)(loc.x, yy));\n"
59" }\n"
60"\n"
61" write_imagef(dst, loc, acc / count);\n"
62"}\n"
63;
const char * ff_source_avgblur_cl
Definition avgblur.c:2