Skip to content

Instantly share code, notes, and snippets.

@dennda
Created September 29, 2011 18:41
Show Gist options
  • Save dennda/1251545 to your computer and use it in GitHub Desktop.
Save dennda/1251545 to your computer and use it in GitHub Desktop.
uint8 *fourchan = (uint8*) malloc(sizeof(uint8) * width * height * 4);
short cur;
short *subscript = (short*) imgData;
for (int i = 0; i < width * height; i++) {
cur = (subscript[i] + 1000) / (int) pow(2., sizeof(short)/2.);
fourchan[i*4] = (uint8) cur;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment