FFmpeg
Loading...
Searching...
No Matches
colorkey.c
Go to the documentation of this file.
1// Generated from libavfilter/opencl/colorkey.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 colorkey_blend(\n"
25" __read_only image2d_t src,\n"
26" __write_only image2d_t dst,\n"
27" float4 colorkey_rgba,\n"
28" float similarity,\n"
29" float blend\n"
30") {\n"
31" int2 loc = (int2)(get_global_id(0), get_global_id(1));\n"
32" float4 pixel = read_imagef(src, sampler, loc);\n"
33" float diff = distance(pixel.xyz, colorkey_rgba.xyz);\n"
34"\n"
35" pixel.s3 = clamp((diff - similarity) / blend, 0.0f, 1.0f);\n"
36" write_imagef(dst, loc, pixel);\n"
37"}\n"
38"\n"
39"__kernel void colorkey(\n"
40" __read_only image2d_t src,\n"
41" __write_only image2d_t dst,\n"
42" float4 colorkey_rgba,\n"
43" float similarity\n"
44") {\n"
45" int2 loc = (int2)(get_global_id(0), get_global_id(1));\n"
46" float4 pixel = read_imagef(src, sampler, loc);\n"
47" float diff = distance(pixel.xyz, colorkey_rgba.xyz);\n"
48"\n"
49" pixel.s3 = (diff > similarity) ? 1.0f : 0.0f;\n"
50" write_imagef(dst, loc, pixel);\n"
51"}\n"
52;
const char * ff_source_colorkey_cl
Definition colorkey.c:2