Hello @all,
iam working with OpenCL since around 2 months. I already solved a lot or problems by moving existing code
from c++ to OpenCL. But no i stuck on a relay simple operation by moving a array-pointer ???
Maybe somebody was already dealing with the same problem and can help me !!
The Existing C++ Code :
int height = 200;
int width = 200;
int yPos = 0;
int *y = new int[width*height];
int *buff = new int[width*height];
int pich = width;
w2 = (width + 7) / 8; // 25
for (int h=0; h < height; h++) {
for (int w=0; w < w2; w++) {
y[yPos++] = buff[w];
}
buff += pitch;
}
My OpenCL implementation currently “Not Working” :!:
In the original implementation every filed up to height*w2 of “y” is filled, done
by increasing yPos.
The OpenCL implementation leaves fields empty :(, and i can just not find the workaround :roll: :oops:
__kernel void convert(__global const unsigned char* buff,__global unsigned char* y) {
int x = get_global_id(0); // width globalWorkSize[0] = 200;
int y = get_global_id(1); // height globalWorkSize[1] = 200;
int w2 = (get_global_size(0) + 7) / 8;
long pos = y * get_global_size(0) + ( x ) ;
if ( x < w2 )
y[pos] = buff[pos];
}