Jpeg decoding result using NPP library

Hello.

I have noticed that there is a question in implementing the Jpeg Encoder by referring to the jpegNPP sample code in the CUDA Toolkit.

We are using the Nvidia GPU to develop a process of HEVC decoding → jpeg encoding using NPP lib,
There is a problem that the result image of the jpeg encoder using NPP is slightly different from the original image.

I was able to check the following facts during various tests.
  1. Perform jpeg decoding → jpeg encoding with jpegNPP (sample code)
: obtain the same image as the original
  2. hevc decoding (using Nvidia Video SDK API) → jpegNPP Refer to the sample code and perform jpeg encoding:
: obtain a slightly brighter image than the original.
  3. Dump the raw pixel which is decoded by hevc decoder
: obtain the same image as the original
  4. Dump the raw pixel after jpeg decoding within jpegNPP(sample code)
: obtain a slightly brighter image than the original.

(The original used here is a 4096x4096 jpeg file, and the image used for hevc decoding was converted to jpeg-> hevc using ffmpeg libx265.)

I guess that there is a problem with the coefficients of the DCT in the NPP library.
If possible, I would like to ask you to check the above, and if it have an issue in the NPP library, could I ask for an update library?

Please leave an answer if you have any data or questions you need for analysis!

Thank you.

1 Like

Have you figured it out?

@rajhlinux Hello

I do not remember exactly what I did for this issue, perhaps I took a colorspace conversion for jpegNPP (It’s not a nvjpeg library).

As I remembered that jpegNPP at that time generates NV12 format an image data and I should convert it NV12 to Full range of YUV420p format by a colorspace conversion. In order to convert colorspace, I implement it using CUDA programming by own code.

I’m not sure you will not use jpegNPP, I guess use nvjpeg instead of your work, I think you don’t need to worry about this kind of color-tone problem.

I hope you get some point by this reply and thanks for your interesting about it.

1 Like

Thanks for the reply.

I was originally curious about if the CUDA GPU can do jpeg decoding, particularity the Huffman decoding phase.

https://docs.nvidia.com/cuda/archive/10.2/export/npp/group__image__compression.html

It’s sad I’d not be helpful for your curiosity about Huffman decoding phase on GPU.
But I found that this is the document of Image compression library that involved in CUDA 10.2 Toolkit and it says there are a way of “Hybrid CPU+GPU JPEG Huffman decoding”.

The CUDA 10.2 Toolkit is quite old thing, so you need to check your compatibility in advance.

1 Like

Thanks for your reply.

I saw that nvJPEG 12.6 doc will do huffman decoding in GPU under certain conditions:

NVJPEG_BACKEND_GPU_HYBRID - Uses GPU for Huffman decoding. nvjpegDecodeBatched will use GPU decoding for baseline JPEG images with interleaved scan when batch size is greater than 50. The decoupled APIs will use GPU assisted Huffman decoding.

Reference:
nvJPEG

Know anything about this?

Thanks

@rajhlinux

Unfortunately, I have no idea about the NVJPEG_BACKEND_GPU_HYBRID for huffman decoding. 😭
Thanks