-
Notifications
You must be signed in to change notification settings - Fork 10k
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
[api-minor] Add a jpx decoder based on OpenJPEG 2.5.2 #17946
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/518a08770381d35/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/9c917df0ca2f57d/output.txt |
From: Bot.io (Linux m4)FailedFull output at http://54.241.84.105:8877/9c917df0ca2f57d/output.txt Total script time: 1.15 mins
Image differences available at: http://54.241.84.105:8877/9c917df0ca2f57d/reftest-analyzer.html#web=eq.log |
From: Bot.io (Windows)FailedFull output at http://54.193.163.58:8877/518a08770381d35/output.txt Total script time: 2.48 mins
Image differences available at: http://54.193.163.58:8877/518a08770381d35/reftest-analyzer.html#web=eq.log |
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.
I'm positive about replacing our own decoder with OpenJPEG: it fixes a whole lot of issues, it reduces maintenance and the upstream project seems well-tested, widely used and more performing because it's written in C. I have looked at most of the code, but not everything in full detail yet because the code might change when these first comments are addressed. Overall this is really nice work so far!
/botio test |
From: Bot.io (Linux m4)ReceivedCommand cmd_test from @calixteman received. Current queue size: 0 Live output at: http://54.241.84.105:8877/fcd0be7e6af1c55/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_test from @calixteman received. Current queue size: 0 Live output at: http://54.193.163.58:8877/a61426cf4d09fd4/output.txt |
From: Bot.io (Linux m4)FailedFull output at http://54.241.84.105:8877/fcd0be7e6af1c55/output.txt Total script time: 0.96 mins
Image differences available at: http://54.241.84.105:8877/fcd0be7e6af1c55/reftest-analyzer.html#web=eq.log |
From: Bot.io (Windows)FailedFull output at http://54.193.163.58:8877/a61426cf4d09fd4/output.txt Total script time: 3.25 mins
Image differences available at: http://54.193.163.58:8877/a61426cf4d09fd4/reftest-analyzer.html#web=eq.log |
/botio test |
From: Bot.io (Linux m4)ReceivedCommand cmd_test from @calixteman received. Current queue size: 0 Live output at: http://54.241.84.105:8877/1edb483aecab386/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_test from @calixteman received. Current queue size: 0 Live output at: http://54.193.163.58:8877/3a9c099d983add0/output.txt |
From: Bot.io (Linux m4)FailedFull output at http://54.241.84.105:8877/1edb483aecab386/output.txt Total script time: 0.86 mins
Image differences available at: http://54.241.84.105:8877/1edb483aecab386/reftest-analyzer.html#web=eq.log |
From: Bot.io (Windows)FailedFull output at http://54.193.163.58:8877/3a9c099d983add0/output.txt Total script time: 2.59 mins
Image differences available at: http://54.193.163.58:8877/3a9c099d983add0/reftest-analyzer.html#web=eq.log |
/botio test |
From: Bot.io (Linux m4)ReceivedCommand cmd_test from @calixteman received. Current queue size: 0 Live output at: http://54.241.84.105:8877/6b9cd46fa294c49/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_test from @calixteman received. Current queue size: 0 Live output at: http://54.193.163.58:8877/49552a9bba056f7/output.txt |
From: Bot.io (Linux m4)FailedFull output at http://54.241.84.105:8877/6b9cd46fa294c49/output.txt Total script time: 26.82 mins
Image differences available at: http://54.241.84.105:8877/6b9cd46fa294c49/reftest-analyzer.html#web=eq.log |
From: Bot.io (Windows)FailedFull output at http://54.193.163.58:8877/49552a9bba056f7/output.txt Total script time: 39.25 mins
Image differences available at: http://54.193.163.58:8877/49552a9bba056f7/reftest-analyzer.html#web=eq.log |
The decoder is compiled in WASM: https://github.com/mozilla/pdf.js.openjpeg Fixes mozilla#17289, mozilla#17061, mozilla#16485, mozilla#13051, mozilla#6365, mozilla#4648, mozilla#12213.
/botio test |
From: Bot.io (Linux m4)ReceivedCommand cmd_test from @calixteman received. Current queue size: 0 Live output at: http://54.241.84.105:8877/a5e13aa5dc488e0/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_test from @calixteman received. Current queue size: 0 Live output at: http://54.193.163.58:8877/cc8aadccf39d4bd/output.txt |
From: Bot.io (Linux m4)FailedFull output at http://54.241.84.105:8877/a5e13aa5dc488e0/output.txt Total script time: 27.54 mins
Image differences available at: http://54.241.84.105:8877/a5e13aa5dc488e0/reftest-analyzer.html#web=eq.log |
From: Bot.io (Windows)FailedFull output at http://54.193.163.58:8877/cc8aadccf39d4bd/output.txt Total script time: 39.29 mins
Image differences available at: http://54.193.163.58:8877/cc8aadccf39d4bd/reftest-analyzer.html#web=eq.log |
/botio makeref |
From: Bot.io (Windows)ReceivedCommand cmd_makeref from @calixteman received. Current queue size: 0 Live output at: http://54.193.163.58:8877/e499df6758716c2/output.txt |
From: Bot.io (Linux m4)ReceivedCommand cmd_makeref from @calixteman received. Current queue size: 0 Live output at: http://54.241.84.105:8877/b3d83cbb8825120/output.txt |
From: Bot.io (Linux m4)SuccessFull output at http://54.241.84.105:8877/b3d83cbb8825120/output.txt Total script time: 19.35 mins
|
From: Bot.io (Windows)SuccessFull output at http://54.193.163.58:8877/e499df6758716c2/output.txt Total script time: 24.39 mins
|
I also think this version of the patch is really nice; thank you for doing this! I only have one question, which may or may not need a follow-up issue/PR depending on which guarantees we give about the image decoder package's API stability. Previously, from what I can gather, for all image decoders we basically guaranteed one public method was always available and served as the only entrypoint to the module, namely It could be argued that the previous APIs also weren't really well-defined because for example I think we could quite easily avoid any breakage of the "official" @calixteman @Snuffleupagus What do you think? Would it be a good idea to rename |
Coming to think of this again, I actually think we should change this, not only to make the API equal to before but also because e.g. our JPX fuzzer relies on this API; see https://github.com/mozilla/pdf.js/blob/master/test/fuzz/jpx_image.fuzz.js#L21. Sorry for not noticing this earlier; I'll prepare a patch for that today and also try to extend the tests (since that will also help for e.g. changing the implementation of the other custom decoders we have). |
I tend to overlook the non-Firefox use of pdf.js, sorry about that. |
A simple renaming would unfortunately not be sufficient, since all the methods are now |
Yes, that is indeed a problem. I have written a test to assert that the expected public API is present, and that one now correctly fails on For example, previously Even if we were to revert to an object without static methods, it still wouldn't be a fully backwards-compatible change because we don't have e.g. the Line 54 in fb07755
I'm not sure what's best here. I see a couple of options:
I don't really see a point in doing the second option in combination with letting In short, all options are API-breaking, but some to a lesser extent. I'm wondering if for all of them What do you think? I'm tempted to go for option one here myself, simply because I think the API from this patch is better than what we had before. |
Or maybe just do "nothing" here, and accept this as-is since our image-decoders never had "identical" shapes, given that we've made worse changes in The question is really how much the stand-alone |
That's a fair point. I also don't think there are many users, and besides I'm not sure if we ever really made any API guarantees for this code anyway. I'm probably overthinking the problem here, and we can always make further adjustments later if the need arises. In that case I'll only make a patch to fix the fuzzer code because that is currently broken after this PR, and after that all code in this repository should work again. I do think the new |
I was trying to see an xray that I got recently (happy to email it privately if it helps), which fails to decode on the demo with: ``` JPX Error: Unsupported COD options (selectiveArithmeticCodingBypass) jpx.js:339:23 ``` So this tries to update to openjpeg via mozilla/pdf.js#17946, which should support it. However: * It's very WIP (the image decodes correctly on the worker, but I only see black on the canvas, however I see correct metadata). * I haven't updated all the references to the other decoders. * It loads the non-jpeg decoders as a module which I can't test, but probably breaks them. I also need to update the sync decoders, which likely doesn't work. I don't think I'll have time to finish this, but posting it here in case it saves someone time or someone has the time to finish it up. Thanks.
I was trying to see an xray that I got recently (happy to email it privately if it helps), which fails to decode on the demo with: ``` JPX Error: Unsupported COD options (selectiveArithmeticCodingBypass) jpx.js:339:23 ``` So this tries to update to openjpeg via mozilla/pdf.js#17946, which should support it. However: * It's very WIP (the image decodes correctly on the worker, but I only see black on the canvas, however I see correct metadata). * I haven't updated all the references to the other decoders. * It loads the non-jpeg decoders as a module which I can't test, but probably breaks them. I also need to update the sync decoders, which likely doesn't work. I don't think I'll have time to finish this, but posting it here in case it saves someone time or someone has the time to finish it up. Thanks.
The decoder is compiled in WASM:
https://github.com/mozilla/pdf.js.openjpeg
Fixes #17289, #17061, #16485, #13051, #6365, #4648, #12213.