JpegNPP with opengl

I am trying to modify JPEGNPP from the CUDA samples to load JPEG images and use it in the OpenGL program. The JPEGNPP loads JPEG image, rescales it, and saves the output. What I need is just load/decode the JPEG image, and get the raw image data.

I know nppiDCTQuantInv8x8LS_JPEG_16s8u_C1R_NEW command performs inverse transform and saves the data into 8x8 blocks. How do I get raw image data from it?

Thanks

This function takes as paramater Npp8u array that will hold the result. It’s third parameter, Npp8u *srcImage[3] array. Now, each array will hold values for each color. JPEGs are usually in YCbCr colorspace that means srcImage[0] holds array for Y (black and white picture), srcImage[1] holds data for Cb and srcimage[2] for Cr. To use it as RGB you will have to perform color conversion minding the sampling. Usually JPEG uses subsampling 4:2:2 type. Fortunately Nvidia provides NPP functions to perform color conversion for us (see documentation) minding correct sampling ratio. You will have to check what sampling ratio does your image though.