FFmpeg
Loading...
Searching...
No Matches
remap.c
Go to the documentation of this file.
1// Generated from libavfilter/opencl/remap.cl
2const char *ff_source_remap_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 linear_sampler = (CLK_NORMALIZED_COORDS_FALSE |\n"
22" CLK_FILTER_LINEAR);\n"
23"\n"
24"const sampler_t nearest_sampler = (CLK_NORMALIZED_COORDS_FALSE |\n"
25" CLK_FILTER_NEAREST);\n"
26"\n"
27"__kernel void remap_near(__write_only image2d_t dst,\n"
28" __read_only image2d_t src,\n"
29" __read_only image2d_t xmapi,\n"
30" __read_only image2d_t ymapi,\n"
31" float4 fill_color)\n"
32"{\n"
33" int2 p = (int2)(get_global_id(0), get_global_id(1));\n"
34" int2 dimi = get_image_dim(src);\n"
35" float2 dimf = (float2)(dimi.x, dimi.y);\n"
36" float4 val;\n"
37" int2 mi;\n"
38" float m;\n"
39"\n"
40" float4 xmap = read_imagef(xmapi, nearest_sampler, p);\n"
41" float4 ymap = read_imagef(ymapi, nearest_sampler, p);\n"
42" float2 pos = (float2)(xmap.x, ymap.x);\n"
43" pos.xy = pos.xy * 65535.f;\n"
44"\n"
45" mi = ((pos >= (float2)(0.f, 0.f)) * (pos < dimf) * (p <= dimi));\n"
46" m = mi.x && mi.y;\n"
47" val = mix(fill_color, read_imagef(src, nearest_sampler, pos), m);\n"
48"\n"
49" write_imagef(dst, p, val);\n"
50"}\n"
51"\n"
52"__kernel void remap_linear(__write_only image2d_t dst,\n"
53" __read_only image2d_t src,\n"
54" __read_only image2d_t xmapi,\n"
55" __read_only image2d_t ymapi,\n"
56" float4 fill_color)\n"
57"{\n"
58" int2 p = (int2)(get_global_id(0), get_global_id(1));\n"
59" int2 dimi = get_image_dim(src);\n"
60" float2 dimf = (float2)(dimi.x, dimi.y);\n"
61" float4 val;\n"
62" int2 mi;\n"
63" float m;\n"
64"\n"
65" float4 xmap = read_imagef(xmapi, nearest_sampler, p);\n"
66" float4 ymap = read_imagef(ymapi, nearest_sampler, p);\n"
67" float2 pos = (float2)(xmap.x, ymap.x);\n"
68" pos.xy = pos.xy * 65535.f;\n"
69"\n"
70" mi = ((pos >= (float2)(0.f, 0.f)) * (pos < dimf) * (p <= dimi));\n"
71" m = mi.x && mi.y;\n"
72" val = mix(fill_color, read_imagef(src, linear_sampler, pos), m);\n"
73"\n"
74" write_imagef(dst, p, val);\n"
75"}\n"
76;
const char * ff_source_remap_cl
Definition remap.c:2