Skip to content

Instantly share code, notes, and snippets.

@beelsebob
Forked from dennda/gist:1251545
Created September 29, 2011 18:53
Show Gist options
  • Select an option

  • Save beelsebob/1251582 to your computer and use it in GitHub Desktop.

Select an option

Save beelsebob/1251582 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