Download modules/imgproc/src/opencl/accumulate.cl from tgollogly/test: direct link, hf CLI and curl.
- Browser
- Download file 2.97 kB
-
https://huggingface.co/tgollogly/test/resolve/main/modules/imgproc/src/opencl/accumulate.cl
- Command line
-
hf download hf://tgollogly/test/modules/imgproc/src/opencl/accumulate.cl
-
curl -L -o accumulate.cl https://huggingface.co/tgollogly/test/resolve/main/modules/imgproc/src/opencl/accumulate.cl
2.97 kB
| // This file is part of OpenCV project. | |
| // It is subject to the license terms in the LICENSE file found in the top-level directory | |
| // of this distribution and at http://opencv.org/license.html. | |
| // Copyright (C) 2014, Advanced Micro Devices, Inc., all rights reserved. | |
| // Third party copyrights are property of their respective owners. | |
| __kernel void accumulate(__global const uchar * srcptr, int src_step, int src_offset, | |
| __global const uchar * src2ptr, int src2_step, int src2_offset, | |
| __global uchar * dstptr, int dst_step, int dst_offset, int dst_rows, int dst_cols | |
| , dstT1 alpha | |
| , __global const uchar * mask, int mask_step, int mask_offset | |
| ) | |
| { | |
| int x = get_global_id(0); | |
| int y = get_global_id(1) * rowsPerWI; | |
| if (x < dst_cols) | |
| { | |
| int src_index = mad24(y, src_step, mad24(x, SRC_TSIZE, src_offset)); | |
| int mask_index = mad24(y, mask_step, mask_offset + x); | |
| mask += mask_index; | |
| int src2_index = mad24(y, src2_step, mad24(x, SRC_TSIZE, src2_offset)); | |
| int dst_index = mad24(y, dst_step, mad24(x, DST_TSIZE, dst_offset)); | |
| for (int i = 0; i < rowsPerWI; ++i) | |
| if (y < dst_rows) | |
| { | |
| __global const srcT1 * src = (__global const srcT1 *)(srcptr + src_index); | |
| __global const srcT1 * src2 = (__global const srcT1 *)(src2ptr + src2_index); | |
| __global dstT1 * dst = (__global dstT1 *)(dstptr + dst_index); | |
| if (mask[0]) | |
| for (int c = 0; c < cn; ++c) | |
| { | |
| dst[c] += convertToDT(src[c]); | |
| dstT1 val = convertToDT(src[c]); | |
| dst[c] = fma(val, val, dst[c]); | |
| dst[c] = fma(convertToDT(src[c]), convertToDT(src2[c]), dst[c]); | |
| dst[c] = fma(1 - alpha, dst[c], src[c] * alpha); | |
| } | |
| src_index += src_step; | |
| src2_index += src2_step; | |
| mask += mask_step; | |
| dst_index += dst_step; | |
| ++y; | |
| } | |
| } | |
| } | |