Created
August 8, 2011 13:30
-
-
Save victoroliv2/1131744 to your computer and use it in GitHub Desktop.
bc_kernel
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const char* kernel_source[] = | |
{ | |
"sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE | \n", | |
" CLK_ADDRESS_NONE | \n", | |
" CLK_FILTER_NEAREST; \n", | |
"__kernel void kernel_bc(__read_only image2d_t in, \n", | |
" __write_only image2d_t out, \n", | |
" float brightness, \n", | |
" float contrast) \n", | |
"{ \n", | |
" int2 gid = (int2)(get_global_id(0), get_global_id(1)); \n", | |
" float4 in_v = read_imagef(in, sampler, gid); \n", | |
" float4 out_v; \n", | |
" out_v.xyz = (in_v.xyz - 0.5f) * contrast + brightness + 0.5f;\n", | |
" out_v.w = in_v.w; \n", | |
" write_imagef(out, gid, out_v); \n", | |
"} \n", | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment