Recently I use VME to derive MVs information and I need Write Source and Reference image into memory. I use clEnqueueMapImage to do this operation as follows: (host to device side)
size_t pitch;
unsigned char* dst = (unsigned char*)clEnqueueMapImage(queue, srcImage, CL_TRUE,CL_MAP_WRITE, offset, region, &pitch,0, 0, NULL, NULL, &err);
unsigned char* src = YBuffer;
for(i, i<height; i++)
{
memcpy(dst, src, sizeof(unsigned char)*width);
src+=src_pitch;
dst += pitch;
}
clEnqueueUnmapMemObject(queue, srcImage, dst,0, NULL, NULL);
The simulation results show wrong data. all MVs are a fix value (-64, -48). However when I use clEnqueueWriteImage, the result is correct. I don't know if the usage of Map/Unmap operation not correct? Thanks a lot.