PDA

View Full Version : Webcam - Image vs. Mapped Buffer



wscrosswy
05-25-2011, 10:16 AM
So this is more of a general question. I'm doing some image processing on a webcam feed, so speed is crucial. I've been using Images, as pixel-wise access in kernels is faster than for buffers, but Images have the added overhead of needing to execute two copy commands to transfer the data to/from memory. Another way to do this would be to use mapped buffers - this would take a speed hit on the kernel side, but removes the need for the two memory transfers. Has anybody experienced/played with this tradeoff? Any advice?

Thanks in advance,
Spencer

david.garcia
05-25-2011, 02:40 PM
Why not use mapped images? clEnqueueMapImage()/clEnqueueUnmapMemObject(). Just make sure to allocate your images with CL_MEM_ALLOC_HOST_PTR or CL_MEM_USE_HOST_PTR.

wscrosswy
05-26-2011, 10:05 AM
Wow - not sure how I missed that one. That works perfectly! Why would one NOT want to always use this??