RetroArch
RetroArch copied to clipboard
Android: jpeg loading is broken.
Description
Jpg luts loads fine on pc, but have issues on Android.
-Edit: the issue is general and happens even on image display core. example file here, some jpgs loads fine tho: https://raw.githubusercontent.com/kokoko3k/koko-aio-slang/main/textures/overlays/gba.jpg
Expected behavior
Same behaviour between pc and mobile, possibly the best of all.
Actual behavior
On pc it works good, on mobile it does not so.
Android:
PC:
Steps to reproduce the bug
- use this preset On PC https://github.com/kokoko3k/koko-aio-slang/blob/main/presets-ng/Handhelds/GameboyAdvance-Overlay.slangp
- use the same on android
- Spot differences
Version/Commit
You can find this information under Information/System Information
-
RetroArch: 1581ece Mar 17, 2023
-
OS: Android 10
Looks like maybe it's not handling semi-alpha properly?
What's semi-alpha in jpg? I don't think i enabled anything like that in gimp, it is just a background picture, so no apha use intended.
it needs alpha to let the game come through, right? or are you mixing them based on texcoord or something? Most of the png borders use alpha for the viewport and then mix(screen, border, border.a).
Yes, this is a Jpg, no alpha involved. I just paint the content over it, that way i can have 350KB instead of 1.9MB.
I just tried to load the following image via retroarch image display core and the artifacts are still there as well, so the issue is not bound to shader ecosystem:
https://raw.githubusercontent.com/kokoko3k/koko-aio-slang/main/textures/overlays/gba.jpg
This would hopefully simplify the bug reproduction.
You need to use PNG if you want transparency
You need to use PNG if you want transparency
But i dont want transparency, my intent is to use a jpg since i DONT need transparency, so that i can keep filesize low.
Other than that, the issue seems to be deeper; jpg loading is completely broken on android, not just the shader luts, it is all described.
Inspecting the zones where artifacts are shown reveals that the artifacts appear where some components are set to 0.0, so It seems i found a workaround; highering the image black level to +5 via gimp and then export it to jpg, makes the glitches go away.
This works in image viewer and in lut loading by the shader, as I suspect they share the same texture load function; of course the issue persists and this is just a lucky workaround.
Ah-hah! Same problem is behind #16927 . I checked it by modding the image attached in that issue with imagemagick:
convert-im6 bad_color_on_Android.jpg +level 10%,100% bad_color_adjusted.jpg
The resulting image loads nicely. (But does not look the same, of course.)
I took a look at the included RJPEG code, but it is not likely that the problem is in the decoding part (and also it was customized quite a bit, so getting the changes from upstream is non-trivial).
I took a look at the included RJPEG code, but it is not likely that the problem is in the decoding part
Why do you think that?
It is common for all platforms, and I see no similar issue reported against upstream (stb_image). On the other hand, it is weird that it is only JPGs, I have not spent so much time so far on this part of RA code.