Cuda NPP can not process certain image correctly

hi all,

I’m new to CUDA NPP. Trying to play with its sample code.

i tried jpegNPP under NVIDIA_CUDA-5.5_Samples/7_CUDALibraries/jpegNPP, it works perfect with its sample image(Growth_of_cubic_bacteria_25x16.jpg) but failed with some test image.

The out put image is corrupted but not seeing any error.

I’m using CUDA 5.5 and 6, no lucky, all the same result.

The command i’m using is:
./jpegNPP -input=input.jpg -output=output.jpg -scale=0.9

The source image is:


The output image is:

Any suggestion is appreciated.

Thanks,
Will

I am not familiar with this example application, but it is quite possible that the example code has limitations in order to simplify the code and not obscure basic principles of operations of NPP that it tries to demonstrate. In particular, the code as-is may place restrictions on image size or image encoding variants.

If after a review of the code you come to the conclusion that the images you are trying to process should be handled correctly by the code, but are not, you may want to consider filing a bug using the bug reporting form linked from the registered developer website.

found the issue. The sample code is using the original huffman table to do the encoding/decoding. However the original image is highly optimized by jpegmini. after resize the result data may not fit the original huffman table. that causes this issue. change huffman table to the one published with jpeg standard solved this issue.

What does that actually mean? Could you post the code diff?

As far as I can tell, the jpegNPP demo reads the Huffman table from the jpeg file. So I suppose the problem has to do with the following:

  • the length of the aCodes and aTable arrays in the HuffmanTable struct;
  • the way the readHuffmanTables and writeHuffmanTable functions are written.

Unfortunately, I know pretty much nothing about JPEG so I don’t know how to quickly fix this stuff myself. It would take me quite a bit of time to learn the JPEG file format and how compression/decompression works; I simply don’t have that kind of time at the moment.