3 "#line 1 \"libavfilter/opencl/overlay.cl\"\n" 5 " * This file is part of FFmpeg.\n" 7 " * FFmpeg is free software; you can redistribute it and/or\n" 8 " * modify it under the terms of the GNU Lesser General Public\n" 9 " * License as published by the Free Software Foundation; either\n" 10 " * version 2.1 of the License, or (at your option) any later version.\n" 12 " * FFmpeg is distributed in the hope that it will be useful,\n" 13 " * but WITHOUT ANY WARRANTY; without even the implied warranty of\n" 14 " * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n" 15 " * Lesser General Public License for more details.\n" 17 " * You should have received a copy of the GNU Lesser General Public\n" 18 " * License along with FFmpeg; if not, write to the Free Software\n" 19 " * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA\n" 22 "__kernel void overlay_no_alpha(__write_only image2d_t dst,\n" 23 " __read_only image2d_t main,\n" 24 " __read_only image2d_t overlay,\n" 28 " const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |\n" 29 " CLK_FILTER_NEAREST);\n" 31 " int2 overlay_size = get_image_dim(overlay);\n" 32 " int2 loc = (int2)(get_global_id(0), get_global_id(1));\n" 34 " if (loc.x < x_position ||\n" 35 " loc.y < y_position ||\n" 36 " loc.x >= overlay_size.x + x_position ||\n" 37 " loc.y >= overlay_size.y + y_position) {\n" 38 " float4 val = read_imagef(main, sampler, loc);\n" 39 " write_imagef(dst, loc, val);\n" 41 " int2 loc_overlay = (int2)(x_position, y_position);\n" 42 " float4 val = read_imagef(overlay, sampler, loc - loc_overlay);\n" 43 " write_imagef(dst, loc, val);\n" 47 "__kernel void overlay_internal_alpha(__write_only image2d_t dst,\n" 48 " __read_only image2d_t main,\n" 49 " __read_only image2d_t overlay,\n" 53 " const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |\n" 54 " CLK_FILTER_NEAREST);\n" 56 " int2 overlay_size = get_image_dim(overlay);\n" 57 " int2 loc = (int2)(get_global_id(0), get_global_id(1));\n" 59 " if (loc.x < x_position ||\n" 60 " loc.y < y_position ||\n" 61 " loc.x >= overlay_size.x + x_position ||\n" 62 " loc.y >= overlay_size.y + y_position) {\n" 63 " float4 val = read_imagef(main, sampler, loc);\n" 64 " write_imagef(dst, loc, val);\n" 66 " int2 loc_overlay = (int2)(x_position, y_position);\n" 67 " float4 in_main = read_imagef(main, sampler, loc);\n" 68 " float4 in_overlay = read_imagef(overlay, sampler, loc - loc_overlay);\n" 69 " float4 val = in_overlay * in_overlay.w + in_main * (1.0f - in_overlay.w);\n" 70 " write_imagef(dst, loc, val);\n" 74 "__kernel void overlay_external_alpha(__write_only image2d_t dst,\n" 75 " __read_only image2d_t main,\n" 76 " __read_only image2d_t overlay,\n" 77 " __read_only image2d_t alpha,\n" 83 " const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |\n" 84 " CLK_FILTER_NEAREST);\n" 86 " int2 overlay_size = get_image_dim(overlay);\n" 87 " int2 loc = (int2)(get_global_id(0), get_global_id(1));\n" 89 " if (loc.x < x_position ||\n" 90 " loc.y < y_position ||\n" 91 " loc.x >= overlay_size.x + x_position ||\n" 92 " loc.y >= overlay_size.y + y_position) {\n" 93 " float4 val = read_imagef(main, sampler, loc);\n" 94 " write_imagef(dst, loc, val);\n" 96 " int2 loc_overlay = (int2)(x_position, y_position);\n" 97 " float4 in_main = read_imagef(main, sampler, loc);\n" 98 " float4 in_overlay = read_imagef(overlay, sampler, loc - loc_overlay);\n" 100 " int2 loc_alpha = (int2)(loc.x * alpha_adj_x,\n" 101 " loc.y * alpha_adj_y) - loc_overlay;\n" 102 " float4 in_alpha = read_imagef(alpha, sampler, loc_alpha);\n" 104 " float4 val = in_overlay * in_alpha.x + in_main * (1.0f - in_alpha.x);\n" 105 " write_imagef(dst, loc, val);\n" const char * ff_opencl_source_overlay