Skip to content

Instantly share code, notes, and snippets.

@victoroliv2
Created August 8, 2011 13:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save victoroliv2/1131744 to your computer and use it in GitHub Desktop.
Save victoroliv2/1131744 to your computer and use it in GitHub Desktop.
bc_kernel
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