NVIDIA / DALI

A GPU-accelerated library containing highly optimized building blocks and an execution engine for data processing to accelerate deep learning training and inference applications.
https://docs.nvidia.com/deeplearning/dali/user-guide/docs/index.html
Apache License 2.0
5.06k stars 615 forks source link

Is it possible to decode lossless jpeg with the format of "num_components == 2 and color space == JCS_UNKNOWN" #5560

Open yayaxinyu opened 1 month ago

yayaxinyu commented 1 month ago

Describe the question.

Describe the question.

num_components == 2 and color space == JCS_UNKNOWN

Is there any way for nvJPEG to support lossless jpeg decode with the format of num_components == 2 and color space == JCS_UNKNOWN ? JCS_UNKNOWN was defined by libjpeg-turbo.

num_components == 1 and color space == JCS_GRAYSCALE

I have already used nvJPEG to decoded losslesss jpeg with the format of 1 components and gray color space, as the official sample as below:

And it can decoded successfully with nvJPEG.

Check for duplicates

zohebk-nv commented 1 month ago

nvjpeg can support 2 component lossless jpeg files as long as both the components use the same huffman table

yayaxinyu commented 1 month ago

So, is there any example about generate the 2 component lossless jpeg file that both the components use the same huffman table? I'm not very clear how to use libjpeg-turbo to generate it, I just write a simple c++ demo about generate a 2 component jpeg file with libjpeg-turbo, but nvjpeg can't decode it correctly. And, with the url below, it only show the way to generate 1 component jpeg file. https://github.com/NVIDIA/DALI_extra/blob/v1.39.0/db/single/reference/jpeg_lossless/generating.py

zohebk-nv commented 1 month ago

I tried to create a sample lossless jpeg file with lossless libjpeg-turbo for a 3 channel and it was using a single huffman table. Would it be possible for you share the 2 channel lossless jpeg file that nvjpeg fails to decode and also the c++ demo? I can take a look.