1 // This file is part of OpenCV project.
2 // It is subject to the license terms in the LICENSE file found in the top-level directory
3 // of this distribution and at http://opencv.org/license.html.
5 // Copyright (C) 2014, Itseez, Inc., all rights reserved.
6 // Third party copyrights are property of their respective owners.
10 __kernel void sumConvert(__global const uchar * src1ptr, int src1_step, int src1_offset,
11 __global const uchar * src2ptr, int src2_step, int src2_offset,
12 __global uchar * dstptr, int dst_step, int dst_offset, int dst_rows, int dst_cols,
13 coeffT scale, coeffT delta)
15 int x = get_global_id(0);
16 int y = get_global_id(1);
18 if (y < dst_rows && x < dst_cols)
20 int src1_index = mad24(y, src1_step, mad24(x, (int)sizeof(srcT), src1_offset));
21 int src2_index = mad24(y, src2_step, mad24(x, (int)sizeof(srcT), src2_offset));
22 int dst_index = mad24(y, dst_step, mad24(x, (int)sizeof(dstT), dst_offset));
24 __global const srcT * src1 = (__global const srcT *)(src1ptr + src1_index);
25 __global const srcT * src2 = (__global const srcT *)(src2ptr + src2_index);
26 __global dstT * dst = (__global dstT *)(dstptr + dst_index);
29 dst[0] = convertToDT( mad24((WT)(scale), convertToWT(src1[0]) + convertToWT(src2[0]), (WT)(delta)) );
31 dst[0] = convertToDT( mad((WT)(scale), convertToWT(src1[0]) + convertToWT(src2[0]), (WT)(delta)) );