Unpack a 3-byte flat block (all pixels same value)
| 3857 | |
| 3858 | // Unpack a 3-byte flat block (all pixels same value) |
| 3859 | static void UnpackB44FlatBlock(unsigned short dst[16], const unsigned char src[3]) { |
| 3860 | unsigned short t = (static_cast<unsigned short>(src[0]) << 8) | src[1]; |
| 3861 | |
| 3862 | // Convert from ordered-magnitude to half-float |
| 3863 | unsigned short h; |
| 3864 | if (t & 0x8000) { |
| 3865 | h = t & 0x7fff; |
| 3866 | } else { |
| 3867 | h = ~t; |
| 3868 | } |
| 3869 | |
| 3870 | for (int i = 0; i < 16; i++) { |
| 3871 | dst[i] = h; |
| 3872 | } |
| 3873 | } |
| 3874 | |
| 3875 | static bool DecompressB44(unsigned char *outPtr, size_t outBufSize, |
| 3876 | const unsigned char *inPtr, size_t inLen, |