nothings / stb

stb single-file public domain libraries for C/C++
https://twitter.com/nothings
Other
26.55k stars 7.69k forks source link

Fix RGB->BGR channel flipping. First 4 pixels were being skipped. #1647

Open ryanrsrs opened 3 months ago

ryanrsrs commented 3 months ago

Caused first 4 pixels of every line to have bad colors. Not noticable unless the image has bright colors along the left edge.

jeffrbig2 commented 3 months ago

Gad, the scalar paths of the channel flipping weren't being tested. Sorry, will update. What platform were you on that the SIMD path wasn't selected, btw...?

ryanrsrs commented 3 months ago

"armv7l" i.e. 32-bit ARM Raspberry Pi Zero 2 W.

Code was compiled with CFLAGS including: -march=native -Os -DSTBIR_USE_FMA -mfpu=neon-vfpv4 -mfp16-format=ieee

Here is my makefile: https://github.com/ryanrsrs/console-jpeg/blob/main/Makefile

I tried with and without -DSTBIR_NO_SIMD, but I think this scalar path was always being used. Should it be NEON?

jeffrbig2 commented 3 months ago

Oh right, that path has no simd path now. Let me do your fix and add one...