From 300bdaad9e3bb2b79bc91e68da11c4b9535637ca Mon Sep 17 00:00:00 2001 From: Konstantin Kopachev Date: Tue, 25 Sep 2018 11:46:32 -0700 Subject: [PATCH] Bring back YCbCrX in pack and unpack --- Tests/test_lib_pack.py | 6 ++++++ src/libImaging/Pack.c | 1 + src/libImaging/Unpack.c | 1 + 3 files changed, 8 insertions(+) diff --git a/Tests/test_lib_pack.py b/Tests/test_lib_pack.py index 0b1a43880..3479013d9 100644 --- a/Tests/test_lib_pack.py +++ b/Tests/test_lib_pack.py @@ -151,6 +151,10 @@ class TestLibPack(PillowTestCase): self.assert_pack("YCbCr", "YCbCr", 3, (1, 2, 3), (4, 5, 6), (7, 8, 9)) self.assert_pack("YCbCr", "YCbCr;L", 3, (1, 4, 7), (2, 5, 8), (3, 6, 9)) + self.assert_pack( + "YCbCr", "YCbCrX", + b'\x01\x02\x03\xff\x05\x06\x07\xff\t\n\x0b\xff', + (1, 2, 3), (5, 6, 7), (9, 10, 11)) self.assert_pack( "YCbCr", "YCbCrK", b'\x01\x02\x03\xff\x05\x06\x07\xff\t\n\x0b\xff', @@ -467,6 +471,8 @@ class TestLibUnpack(PillowTestCase): "YCbCr", "YCbCr;L", 3, (1, 4, 7), (2, 5, 8), (3, 6, 9)) self.assert_unpack( "YCbCr", "YCbCrK", 4, (1, 2, 3), (5, 6, 7), (9, 10, 11)) + self.assert_unpack( + "YCbCr", "YCbCrX", 4, (1, 2, 3), (5, 6, 7), (9, 10, 11)) def test_LAB(self): self.assert_unpack( diff --git a/src/libImaging/Pack.c b/src/libImaging/Pack.c index 6d42d8491..5c298c6c5 100644 --- a/src/libImaging/Pack.c +++ b/src/libImaging/Pack.c @@ -608,6 +608,7 @@ static struct { /* video (YCbCr) */ {"YCbCr", "YCbCr", 24, ImagingPackRGB}, {"YCbCr", "YCbCr;L", 24, packRGBL}, + {"YCbCr", "YCbCrX", 32, copy4}, {"YCbCr", "YCbCrK", 32, copy4}, {"YCbCr", "Y", 8, band0}, {"YCbCr", "Cb", 8, band1}, diff --git a/src/libImaging/Unpack.c b/src/libImaging/Unpack.c index 56be12e07..e9921d2ca 100644 --- a/src/libImaging/Unpack.c +++ b/src/libImaging/Unpack.c @@ -1428,6 +1428,7 @@ static struct { /* video (YCbCr) */ {"YCbCr", "YCbCr", 24, ImagingUnpackRGB}, {"YCbCr", "YCbCr;L", 24, unpackRGBL}, + {"YCbCr", "YCbCrX", 32, copy4}, {"YCbCr", "YCbCrK", 32, copy4}, /* LAB Color */