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

Cannot import JPEG images with sampling factors not supported by jpgd #75349

Open
TheYellowArchitect opened this issue Mar 26, 2023 · 3 comments

Comments

@TheYellowArchitect
Copy link

TheYellowArchitect commented Mar 26, 2023

Godot version

4.0.1

System information

Arch Linux

Issue description

There are certain .jpg images where Godot just cannot import the image. The image is not corrupted, all file editors display it normally. And ofc, an X cross sign appears on the image file in godot's filesystem tab. No preview, nor loading it to some texture or sprite works.

This bug was not created in 4.0.1, I can confirm it was present since 4.0 beta14. I also tested 3.5.1, it exists there too.

Steps to reproduce

  1. Open empty project
  2. Import this:
    29284413

Minimal reproduction project

See above.

@jmb462
Copy link
Contributor

jmb462 commented Mar 26, 2023

Seems that this JPG file use not supported sampling factors causing jpeg_decoder::init_frame() to failed.

File godot\thirdparty\basis_universal\encoder\jpgd.cpp line 2528

m_comp_h_samp = {2, 1, 1, 0}
m_comp_v_samp = {2, 1, 2, 0} <= here, only value supported for the index 2 is 1.

Returning JPGD_UNSUPPORTED_SAMP_FACTORS error.

@Calinou
Copy link
Member

Calinou commented Mar 26, 2023

File godot\thirdparty\basis_universal\encoder\jpgd.cpp line 2528

That JPEG decoder is only used by Basis Universal – I'm not even sure if this code is used in Godot.

https://github.com/godotengine/godot/blob/master/thirdparty/jpeg-compressor/jpgd.cpp is the decoder actually used by Godot, though its code appears nearly identical.

@Calinou Calinou changed the title Cannot import certain .jpg images Cannot import JPEG images with sampling factors not supported by jpgd Mar 26, 2023
@jmb462
Copy link
Contributor

jmb462 commented Mar 26, 2023

Following step by step debugger leads me to the Basis Universal file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants