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

Consider BGRA instead of RGBA #34

Closed
nigeltao opened this issue Nov 27, 2021 · 3 comments
Closed

Consider BGRA instead of RGBA #34

nigeltao opened this issue Nov 27, 2021 · 3 comments

Comments

@nigeltao
Copy link

Speaking of Windows (#24)... IIUC the default Windows color order is BGRA (not RGBA) and likewise for Linux (X11) and I think MacOS / iOS too. Can't remember what Android is.

Anway, if we're talking of finalizing the file format (#28), consider QOI producing BGRA, not RGBA. Especially as QOI is about being fast to decode, this would avoid what libpng calls the PNG_TRANSFORM_BGR step.

Transforming BGRA <-> RGBA is cheap, especially with SIMD, but it's not free.

@dougallj
Copy link

As far as I can tell RGBA isn't part of the format? Looking at the decoder, I think you could just change unsigned char r, g, b, a; to unsigned char b, g, r, a; in the qoi_rgba_t definition to decode straight to BGRA, without changing the format, and presumably for free.

@floooh
Copy link

floooh commented Nov 27, 2021

I'd suggest keeping the (default) color channel order as it is, as it's the same as in stb_image.h, and (more importantly) some older 3D APIs (like WebGL) don't directly support creating textures in BGRA format.

@phoboslab
Copy link
Owner

The file format for QOI will not change anymore. See #37 for more info.

Ideas for a successor to QOI should be discussed here: https://github.com/nigeltao/qoi2-bikeshed/issues

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

4 participants