-
-
Notifications
You must be signed in to change notification settings - Fork 75
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
SPNG_FMT_PNG is big-endian even while little-endian system #230
Comments
Which means endianness does not affect the order of channels in a pixel, just the byte order of 16-bit values. Because PNG only stores 16-bit values as big-endian |
Thank you for the clarification regarding 16 bit color depth. The motivation for this discussion then is that Windows bitmaps are "ARGB" or "RGB" in a "word-order scheme". I believe the historically accurate terminology used here is little-endian, but I won't argue it. Since ARGB is only planned we can just consider the RGB case. A block of memory cannot just be provided to the encoder with a pointer, but instead the memory needs to be byte-order swapped first. Back to the link you provided:
And if such an annoying copying operation such as byte-order swapping is required anyways then "ARGB" support, which is planned, wouldn't be much help because you already have to swap bytes around anyways to get the byte-order expected by the encoder. So in one sense it ties back to ARGB support and in the other sense it's a request to support "word-order scheme". |
ARGB is planned for this exact use case, so it would be a word-order format (probably named |
yeah sounds good, i would just note that some API call that format BGRA since that's what it is in byte-order. |
Hi, Back on topic:
best regards,
|
The documentation states:
And then in spng.h for
spng_format
it says:But then just under that
I'm not sure what host-endian is supposed to mean here. Intuitively I assume it's the same thing as native endian. But on a little-endian system the decoder output is still in big-endian. In other words, for a basic 32-bit RGBA PNG on a little-endian system,
SPNG_FMT_RGBA8
,SPNG_FMT_PNG
andSPNG_FMT_RAW
are all identical.It's hard to interpret if this is intended since "always in byte-order" hints at always big-endian, but then there is a distinction made between "host-endian" and "big-endian" right after that. Is it true that there is only big-endian output?
Edit: I just realized that perhaps the distinction that I am not seeing is that the endianess might only apply to 16-bit color depth?
The text was updated successfully, but these errors were encountered: