CESNET/GPUJPEG

Crash with JPG Image

Closed this issue · 13 comments

Back_01

I am using GPUJPEG with various images but for some reason this one doesn't now want to work and give weird crash, in my code I try the gpujpeg binary and I have similar issue:

11.2/install/bin/gpujpeg -d Back_01.jpg Back.rgb
GPUJPEG rev 234bf44

CUDA driver version:   11.2
CUDA runtime version:  11.2
Using Device #0:       GeForce RTX 2080 Ti (c.c. 7.5)

Decoding Image [Back_01.jpg] to 444-u8-p012 RGB
Load Image:                0.88 ms
[GPUJPEG] [Error] APP14 marker length should be 14 but 38 was presented!
[GPUJPEG] [Error] Decoder failed when decoding image data!
Failed to decode image [Back_01.jpg]!
11.2/install/bin/gpujpeg --convert Back_01.jpg Back_02.jpg
GPUJPEG rev 234bf44
CUDA driver version:   11.2
CUDA runtime version:  11.2
Using Device #0:       GeForce RTX 2080 Ti (c.c. 7.5)
[GPUJPEG] [Error] GPUJPEG conversions are currently defunct, report to developers if needed!

Any idea why this texture is so problematic ?

Thanks

Yes, I've looked at the image and it is unclear why does the APP14 Adobe marker lenght 38, not 14 as in the only spec that I've found. Anyways, I've "fixed" it in a way that problems with APP14 marker are ignored. The attached image, however, has a SOF2 marker indicating that it is progressive Huffman encoded JPEG and thus cannot be decoded by UG, anyway.

Question 2 - do you intend to use somehow the --convert option? It is currently defunct from some point due to further development. I think there is only a little use for this – it is basically decode+encode (so it could not have solved the problem, anyway).

Thanks, @MartinPulec
Let me give it a try to change the format to make it work in this case.

For the convert I am not using it, it was just for testing if that could help.

Ok now I have this message :

GPUJPEG rev 144791f
[GPUJPEG] [Warning] APP14 Adobe marker length should be 14 but 38 was presented!
Unsupported encoding process!

back_1
I used opencv to resave the file, I try to decode with GPUPJEG but I have an error

GPUJPEG rev 144791f
CUDA driver version:   11.2
CUDA runtime version:  11.2
Using Device #0:       GeForce RTX 2080 Ti (c.c. 7.5)

Decoding Image [/mnt/slbox/PersonalFolders/Tony/back_1.jpg] to 444-u8-p012 RGB
Load Image:                1.95 ms
Floating point exception (core dumped)

Interesting, how do you call it? Running:

gpujpeg -d back_1.jpg out.r

works fine for me, running gpujpeg -d back_1.jpg out.rgb yields:

gpujpeg: /home/toor/gpujpeg-devel/src/gpujpeg_postprocessor.cu:368: int gpujpeg_preprocessor_decoder_init(gpujpeg_coder*): Assertion `coder->param_image.comp_count == 3' failed.

Which is more or less correct – decoding grayscale to RGB is currently not supported (would you need it?), but it should print more user-friendly message, indeed.

Anyways, -d back_1 out.pnm fails with the same error as RGB which is perhaps incorrect - it should decode to 1 channel PNM.

Anyways, -d back_1 out.pnm fails with the same error as RGB which is perhaps incorrect - it should decode to 1 channel PNM.

This should be now fixed.

Hi @MartinPulec let me try again for me the crash happen when trying to get the .rgb but will try one more time

Hi @MartinPulec still have the same issue with gpujpeg:

gpujpeg144791f10486758abf4a48be9b2d24f6e6e4f90b_cuda11.2/install/bin/gpujpeg -d back.jpg back.rgb
GPUJPEG rev 144791f
CUDA driver version:   11.2
CUDA runtime version:  11.2
Using Device #0:       GeForce RTX 2080 Ti (c.c. 7.5)

Decoding Image [back.jpg] to 444-u8-p012 RGB
Load Image:                0.91 ms
Floating point exception (core dumped)

After using the latest master no crash but still failed :

gpujpegfc8bef797b7491ac9e31ab8b3c01054aa09f5e8e_cuda11.2/install/bin/gpujpeg -d back.jpg back.rgb
GPUJPEG rev fc8bef7
CUDA driver version:   11.2
CUDA runtime version:  11.2
Using Device #0:       GeForce RTX 2080 Ti (c.c. 7.5)

Decoding Image [back.jpg] to 444-u8-p012 RGB
Load Image:                0.87 ms
[GPUJPEG] [Error] Decoding single component JPEG allowed only to single component output format!
[GPUJPEG] [Error] Failed to init postprocessor!
[GPUJPEG] [Error] Decoder failed when decoding image data!
Failed to decode image [back.jpg]!

After using the latest master no crash but still failed

Yes, that is intended - there is no postprocessor to convert a single component to RGB. It can decode to grayscale (either .r or PAM/PNM suffix). Is the conversion from grayscale to RGB important for you? If so, I guess it can be implemented.

Hi Martin,
You could add this feature that will be nice, but I think my code must have a bug, in theory I am looking the params of the texture before decoding it to be sure if it’s 3 channel or 1 channel.
I will take a look and keep you posted

Hi @MartinPulec,

So after checking more carefully my code, its indeed a trouble because I am assuming the texture was 3 channel without checking first.

I made a change to my code to handle it properly.

Thanks and Happy Thanksgiving.

Ok, I think that the 1->3 channel conversion can be eventually added - it is clearly very straightforward for both RGB and YCbCr. It just may need some tweaks in the logic.