Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JPEG decoder unexpected marker (RST3) in otherwise valid JPG #22

Open
markeel opened this issue Apr 16, 2023 · 0 comments
Open

JPEG decoder unexpected marker (RST3) in otherwise valid JPG #22

markeel opened this issue Apr 16, 2023 · 0 comments

Comments

@markeel
Copy link

markeel commented Apr 16, 2023

When loading and transforming JPG file created by a user (assume using their phone, but really do not know), the file generated had a marker detected by the jpgd.cpp:1079. I determined which one it was by instrumenting the code until I determined which marker it was.

Other applications (Gimp, Nautilus, Windows Explorer) all display the file and show the image fine.

This was originally discovered as jpeg-compressor is used within the Godot Game Engine which is the tooling used to develop the application.

I suspect that this marker is ignored by most other decoders including stb.

When I used the following command I had success:

$ ./jpge -s bad_file.jpg /tmp/test.jpg 90
jpge/jpgd example app
Source file: "bad_file.jpg", image resolution: 3264x1592, actual comps: 3
Writing JPEG image to file: /tmp/test.jpg
Compressed file size: 945102, bits/pixel: 1.455
Using stbi_load
Compression time: 58.637ms, Decompression time: 24.518ms
Error Max: 20.000000, Mean: 2.633543, Mean^2: 5.956933, RMSE: 2.440683, PSNR: 40.380577
Success.

When I tested decompression I got a failure:

$ ./jpge -d bad_file.jpg /tmp/test2.tga
jpge/jpgd example app
Using jpgd::decompress_jpeg_image_from_file
Failed loading JPEG file "bad_file.jpg"!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant