How to use NPP library for JPEG encoding?


I am trying to use NPP library for JPEG encoding.

I have a RGB domain image. Then I Use nppiRGBToYCbCr_8u_C3R to convert RGB to YCbCr.

Converts given quantization tables with the quality factor by nppiQuantFwdRawTableInit_JPEG_8u.

Converts raw quantization table to a forward quantization table by nppiQuantFwdTableInit_JPEG_8u16u.

Finally, uses nppiDCTQuantFwd8x8LS_JPEG_8u16s_C1R to do forward DCT, quantization and level shift part of the JPEG encoding.

After calling nppiDCTQuantFwd8x8LS_JPEG_8u16s_C1R, the data can be saved as JPEG directly? Or it should be processed with “Entropy coding”?

The Y, Cb, Cr plane is separated for forward DCT. How do I write final data as a JPEG file?(I found FreeImage_Save in sample code. Can I use it?)

Thanks for any advise.