Skip to content

Commit

Permalink
Merge pull request #1 from radarhere/unpack-bgra16
Browse files Browse the repository at this point in the history
Updated BGRA comments
  • Loading branch information
gmarkall committed Apr 3, 2022
2 parents e500dcf + 29c122f commit 80af77d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/libImaging/Unpack.c
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,7 @@ ImagingUnpackBGR15(UINT8 *out, const UINT8 *in, int pixels) {
void
ImagingUnpackBGRA15(UINT8 *out, const UINT8 *in, int pixels) {
int i, pixel;
/* RGB, reversed bytes, 5/5/5/1 bits per pixel */
/* RGB, rearranged channels, 5/5/5/1 bits per pixel */
for (i = 0; i < pixels; i++) {
pixel = in[0] + (in[1] << 8);
out[B] = (pixel & 31) * 255 / 31;
Expand Down Expand Up @@ -1056,7 +1056,7 @@ unpackABGR(UINT8 *_out, const UINT8 *in, int pixels) {
static void
unpackBGRA(UINT8 *_out, const UINT8 *in, int pixels) {
int i;
/* RGBA, reversed bytes */
/* RGBA, rearranged channels */
for (i = 0; i < pixels; i++) {
UINT32 iv = MAKE_UINT32(in[2], in[1], in[0], in[3]);
memcpy(_out, &iv, sizeof(iv));
Expand All @@ -1068,7 +1068,7 @@ unpackBGRA(UINT8 *_out, const UINT8 *in, int pixels) {
static void
unpackBGRA16L(UINT8 *_out, const UINT8 *in, int pixels) {
int i;
/* 16-bit RGBA, little-endian order, reversed words */
/* 16-bit RGBA, little-endian order, rearranged channels */
for (i = 0; i < pixels; i++) {
UINT32 iv = MAKE_UINT32(in[5], in[3], in[1], in[7]);
memcpy(_out, &iv, sizeof(iv));
Expand All @@ -1080,7 +1080,7 @@ unpackBGRA16L(UINT8 *_out, const UINT8 *in, int pixels) {
static void
unpackBGRA16B(UINT8 *_out, const UINT8 *in, int pixels) {
int i;
/* 16-bit RGBA, big-endian order, reversed words */
/* 16-bit RGBA, big-endian order, rearranged channels */
for (i = 0; i < pixels; i++) {
UINT32 iv = MAKE_UINT32(in[4], in[2], in[0], in[6]);
memcpy(_out, &iv, sizeof(iv));
Expand Down

0 comments on commit 80af77d

Please sign in to comment.