blob: bd9e4520c1732d8957c2359617f9165bb3c937f6 [file] [log] [blame]
wangfei7e0436e2015-04-15 19:22:36 +08001/*
2 * function: kernel_gamma
3 * input: image2d_t as read only
4 * output: image2d_t as write only
5 * table: gamma table.
6 */
7"__kernel void kernel_gamma (__read_only image2d_t input, __write_only image2d_t output, __global float *table) "
8"{ "
9" int x = get_global_id (0); "
10" int y = get_global_id (1); "
11" sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_NONE | CLK_FILTER_NEAREST; "
12" int2 pos = (int2)(x, y); "
13" float4 pixel_in,pixel_out; "
14" pixel_in = read_imagef(input, sampler, pos); "
15" pixel_out.x = table[convert_int(pixel_in.x*255.0)]/255.0; "
16" pixel_out.y = table[convert_int(pixel_in.y*255.0)]/255.0; "
17" pixel_out.z = table[convert_int(pixel_in.z*255.0)]/255.0; "
18" pixel_out.w = 0.0; "
19" write_imagef(output, pos, pixel_out); "
20"} "
21