[gimp/gimp-2-10] plug-ins: fix #6200 DDS BC5 compression/decompression has Red and Blue swapped.
- From: Jacob Boerema <jboerema src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-10] plug-ins: fix #6200 DDS BC5 compression/decompression has Red and Blue swapped.
- Date: Wed, 6 Jan 2021 03:50:28 +0000 (UTC)
commit 204c6fa8a561838be18456b5d179c548c3e43868
Author: Jacob Boerema <jgboerema gmail com>
Date: Tue Jan 5 17:38:43 2021 -0500
plug-ins: fix #6200 DDS BC5 compression/decompression has Red and Blue swapped.
(cherry picked from commit efa899ad157505fe00bc943b9974035221bd4e6a)
plug-ins/file-dds/dxt.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/plug-ins/file-dds/dxt.c b/plug-ins/file-dds/dxt.c
index 440875b453..bbea32b271 100644
--- a/plug-ins/file-dds/dxt.c
+++ b/plug-ins/file-dds/dxt.c
@@ -1137,8 +1137,12 @@ compress_BC5 (unsigned char *dst,
y = (i / ((w + 3) >> 2)) << 2;
p = dst + BLOCK_OFFSET(x, y, w, 16);
extract_block(src, x, y, w, h, block);
- encode_alpha_block_BC3(p, block, -2);
- encode_alpha_block_BC3(p + 8, block, -1);
+ /* Pixels are ordered as BGRA (see write_layer)
+ * First we encode red -1+3: channel 2;
+ * then we encode green -2+3: channel 1.
+ */
+ encode_alpha_block_BC3(p, block, -1);
+ encode_alpha_block_BC3(p + 8, block, -2);
}
}
@@ -1506,8 +1510,8 @@ dxt_decompress (unsigned char *dst,
}
else if (format == DDS_COMPRESS_BC5)
{
- decode_alpha_block_BC3(block, s + 8, width);
- decode_alpha_block_BC3(block + 1, s, width);
+ decode_alpha_block_BC3(block, s, width);
+ decode_alpha_block_BC3(block + 1, s + 8, width);
s += 16;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]