3 Channel uint8 Image reading in NPP


I have successfully set up NPP on my C2D machine with GTX 470 installed. NPP is configured for VS2008 (Win7 64 bit).

Now the problem is that I want to read JPG and PNG image formats using FreeImage functions provided. This is the sequence of my calls:

  1. Load a JPG (3Channel uint 8 datatype) image from image file.

  2. Allocate device memory to port data to device (I use “nppiMalloc_8u_C3” which I hope is the right choice?)

  3. Copy data into the device

  4. Call my own kernel (just a simple kernel for testing purpose)

  5. Bring data back into host pointer of type: Npp8u

  6. Save image back into the result image file created using FreeImage functions.


I print the 4 corner pixel values ( R,G,B ) after reading the image from host and it prints OK BUT when the data comes back it only has 50% of the image values and the rest are zero.

I would really appreciate if any sample code could show how to read, manipulate (write/call kernel) and write the result image back into the file.