-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Use ImageDecoder to decode cmyk jpeg images (bug 1965870) #19918
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
/botio test |
From: Bot.io (Windows)ReceivedCommand cmd_test from @calixteman received. Current queue size: 0 Live output at: http://54.193.163.58:8877/cea084a2bc7b6d8/output.txt |
From: Bot.io (Linux m4)ReceivedCommand cmd_test from @calixteman received. Current queue size: 0 Live output at: http://54.241.84.105:8877/00e240ae2a6a2ee/output.txt |
From: Bot.io (Linux m4)FailedFull output at http://54.241.84.105:8877/00e240ae2a6a2ee/output.txt Total script time: 30.57 mins
|
From: Bot.io (Windows)FailedFull output at http://54.193.163.58:8877/cea084a2bc7b6d8/output.txt Total script time: 61.89 mins
|
/botio-linux preview |
From: Bot.io (Linux m4)ReceivedCommand cmd_preview from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.241.84.105:8877/e4ab79863b04e50/output.txt |
From: Bot.io (Linux m4)SuccessFull output at http://54.241.84.105:8877/e4ab79863b04e50/output.txt Total script time: 0.96 mins Published |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Testing this locally it's obviously really fast, however it does seem to regress the improved colors from PR #19620 since the conversion used in cmyk_convert_bgra
appears to be too simplistic compared to using an actual ICC profile.
Edit: The colors even seem "worse" than with our DeviceCmykCS
implementation.
Hi! 🤖 The test below is automatically generated and could serve as a regression test for this PR because it:
import { JpegStream } from "../../src/core/jpeg_stream.js";
import { JpegImage } from "../../src/core/jpg.js";
describe("JpegImage", function () {
it("should support decoding CMYK JPEG images using ImageDecoder", async function () {
const cmykJpegData = new Uint8Array([0xff, 0xd8, 0xff, 0xe0, 0x00, 0x10,
0x4a, 0x46, 0x49, 0x46, 0x00, 0x01, 0x01, 0x01, 0x00, 0x60, 0x00, 0x60,
0x00, 0x00, 0xff, 0xc0, 0x00, 0x11, 0x08, 0x00, 0x10, 0x00, 0x10, 0x04,
0x01, 0x11, 0x00, 0x02, 0x11, 0x01, 0x03, 0x11, 0x01, 0x04, 0x11, 0x01,
0xff, 0xda, 0x00, 0x0c, 0x03, 0x01, 0x00, 0x02, 0x11, 0x03, 0x11, 0x00,
0x3f, 0x00, 0xd2, 0xcf, 0x20, 0xff, 0xd9]);
JpegStream.setOptions({ isImageDecoderSupported: true });
const jpegInfo = JpegImage.canUseImageDecoder(cmykJpegData);
const expected = { cmyk: true };
const actual = jpegInfo;
expect(actual).toEqual(expected);
});
}); If you find this regression test useful, feel free to insert it to your test suite. This is part of our research at the ZEST group of University of Zurich in collaboration with Mozilla. Click to see the test patch.diff --git a/jpg_spec.js b/jpg_spec.js
new file mode 100644
index 0000000..81499f1
--- /dev/null
+++ b/jpg_spec.js
@@ -0,0 +1,20 @@
+import { JpegStream } from "../../src/core/jpeg_stream.js";
+import { JpegImage } from "../../src/core/jpg.js";
+
+describe("JpegImage", function () {
+ it("should support decoding CMYK JPEG images using ImageDecoder", async function () {
+ const cmykJpegData = new Uint8Array([0xff, 0xd8, 0xff, 0xe0, 0x00, 0x10,
+ 0x4a, 0x46, 0x49, 0x46, 0x00, 0x01, 0x01, 0x01, 0x00, 0x60, 0x00, 0x60,
+ 0x00, 0x00, 0xff, 0xc0, 0x00, 0x11, 0x08, 0x00, 0x10, 0x00, 0x10, 0x04,
+ 0x01, 0x11, 0x00, 0x02, 0x11, 0x01, 0x03, 0x11, 0x01, 0x04, 0x11, 0x01,
+ 0xff, 0xda, 0x00, 0x0c, 0x03, 0x01, 0x00, 0x02, 0x11, 0x03, 0x11, 0x00,
+ 0x3f, 0x00, 0xd2, 0xcf, 0x20, 0xff, 0xd9]);
+ JpegStream.setOptions({ isImageDecoderSupported: true });
+
+ const jpegInfo = JpegImage.canUseImageDecoder(cmykJpegData);
+ const expected = { cmyk: true };
+ const actual = jpegInfo;
+
+ expect(actual).toEqual(expected);
+ });
+}); |
It depends on:
https://bugzilla.mozilla.org/show_bug.cgi?id=1965813