Created
March 2, 2017 19:41
-
-
Save cwood1967/40902aeef56dfe3ac24748173e515e59 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
short[] image = new short[size]; | |
int index = 0; | |
for (int i = 0; i < fileBytes.length; i += 5) { | |
int s = 2; | |
int t0 = (fileBytes[i] & 0x00FF) << s; | |
int t1 = (fileBytes[i + 1] & 0x00FF) << s; | |
int t2 = (fileBytes[i + 2] & 0x00FF) << s; | |
int t3 = (fileBytes[i + 3] & 0x00FF) << s; | |
int lsb = (fileBytes[i + 4] & 0x00FF) << s; | |
t0 += (lsb & 3); | |
t1 += (lsb & 12) >> 2; | |
t2 += (lsb & 48) >> 4; | |
t3 += (lsb & 192) >> 6; | |
image[index] = (short)(t0 << 0); | |
image[index + 1] = (short)(t1 << 0); | |
image[index + 2] = (short)(t2 << 0); | |
image[index + 3] = (short)(t3 << 0); | |
index += 4; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment