Re:Farbfeld – A suckless image format
by userbinator on Friday January 15, 2016 @07:08AM
(#10908751)
People are making the (valid) assumption that LE is far more common than BE.
On x86 swapping endianness is one instruction (BSWAP), but AFAIK it can't be SIMD'd easily. Given that SIMD is one of the things that can greatly speed up image processing, I don't think it "won't hurt performance too much"...
Re:Farbfeld – A suckless image format
by nightcracker on Friday January 15, 2016 @08:56AM
(#10909278)
For SIMD you can use _mm<width>_shuffle_epi8 to swap endianness in a single cycle.
how come people assume there are only Little Endian machines. This mmap-technique wouldn't work on Big Endian like this, this is inaccetable!
However, you can still mmap and properly call ntohs() on each color channel value (if you access it). These functions won't hurt performance too much anyway, if at all. If you show me a measurable difference between using LE and BE, I owe you a beer, okay? :)