-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
implement CalRGB color space #5165
Conversation
Could you also provide test PDF document(s) ? |
Of course :) It was already included but I forgot to add the test.manifest changes. I've update the patch with that now. And if one compares pdf.js and acrobat then for the most part they are almost the same. Only on few pages acrobat goes to disco. |
I'll update the patch a bit more, so don't merge just yet. |
Addressed the review nits from @timvandermeij. Thanks for the review! |
/botio-linux preview |
From: Bot.io (Linux)ReceivedCommand cmd_preview from @timvandermeij received. Current queue size: 0 Live output at: http://107.21.233.14:8877/8a76ae3d32067fe/output.txt |
From: Bot.io (Linux)SuccessFull output at http://107.21.233.14:8877/8a76ae3d32067fe/output.txt Total script time: 0.76 mins Published
|
/botio test |
From: Bot.io (Linux)ReceivedCommand cmd_test from @timvandermeij received. Current queue size: 0 Live output at: http://107.21.233.14:8877/aa1c1de090e4bd9/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_test from @timvandermeij received. Current queue size: 0 Live output at: http://107.22.172.223:8877/13ac6169e22edee/output.txt |
From: Bot.io (Windows)FailedFull output at http://107.22.172.223:8877/13ac6169e22edee/output.txt Total script time: 19.77 mins
Image differences available at: http://107.22.172.223:8877/13ac6169e22edee/reftest-analyzer.html#web=eq.log |
From: Bot.io (Linux)FailedFull output at http://107.21.233.14:8877/aa1c1de090e4bd9/output.txt Total script time: 22.55 mins
Image differences available at: http://107.21.233.14:8877/aa1c1de090e4bd9/reftest-analyzer.html#web=eq.log |
{ "id": "calrgb", | ||
"file": "pdfs/calrgb.pdf", | ||
"md5": "29e6f9dc529523cbed41401eb1b4165e", | ||
"rounds": 1, |
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.
Let's specify lastPage=8 -- 36 pages is too many
Looks good. However it will be nice to see less objects created in the function, i.e. move const matrix definitions outsize, and accept destination matrix as parameter vs returning new one: |
whats causing the failure for 1597? all other pdf viewers render the white as ffffff not as fefeff. Even pdfjs before the patch did. is that rounding issue? is there an alpha layer above it? |
@yurydelendik, I created those temp matrices as you suggested. On the positive side I was able to nuke three functions and on the negative side few places became a little less readable but only a little. Overall I think it is better. Btw, do you want me to hoist the const matrices outside of the CalRGBCS class? There would be then even less object creation but they would be global then and I don't know if it makes any difference performance wise. What would be the best way to test the gains from this temp matrices optimization? Speed and memory wise? @CodingFabian, I'll check what's going on there. And I'll squash the commits if Yury thinks my changes are ok. |
will look as:
or even:
I'm afraid we cannot effectively measure speed/memory on any of the PDF. However, you can modify getRgb to run convertToRgb hundreds thousand times and clock the execution time. Using Float32Array/Float32Array instead of JS Array might speed up the execution as well. |
var LMS_Flat = tempLMS_FlatMatrix; | ||
|
||
matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_Flat, | ||
tempBradfordInverseMatrix); |
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.
result instead of tempBradfordInverseMatrix can be used here
Yes, it looks better like that. I'll make the changes. Did you have an opinion about the location of the const matrices? I.e is it better to have them inside the class? |
Yes, inside of class closure is fine (as you have them now) |
I've made the temp matrix changes. I'll still check that one regression failure and I'll also modify the test pdf so that 8 pages long. |
Really nice. Not sure, but making the arrays typed might give you some perf improvements, e.g. |
@yurydelendik, I changed all the matrices to typed arrays and I updated the test pdf to be more compact. It currently has 17 pages and when I ran the browsertest it took 10 seconds. I can add the last page = 8 to the test manifest if you think it is still needed. @CodingFabian, It was as you suspected a rounding error. The value for red was 254,999.., which was then truncated to 254. I modified the code to use Math.round and now it is 255. |
Our reftest hardness stores images of every page, we are trying to not burden it with unneeded memory usage. |
Both whitespace and blackspace support are implemented.
Sure, I preemptively moved all the interesting pages to the front and more esoteric pages to the end, so it's cool with me. Patch updated. |
Awesome. This looks good. /botio test |
From: Bot.io (Windows)ReceivedCommand cmd_test from @yurydelendik received. Current queue size: 0 Live output at: http://107.22.172.223:8877/7f30cc69e0ffcd8/output.txt |
From: Bot.io (Linux)ReceivedCommand cmd_test from @yurydelendik received. Current queue size: 0 Live output at: http://107.21.233.14:8877/62302241cef33d8/output.txt |
From: Bot.io (Windows)FailedFull output at http://107.22.172.223:8877/7f30cc69e0ffcd8/output.txt Total script time: 19.73 mins
Image differences available at: http://107.22.172.223:8877/7f30cc69e0ffcd8/reftest-analyzer.html#web=eq.log |
From: Bot.io (Linux)FailedFull output at http://107.21.233.14:8877/62302241cef33d8/output.txt Total script time: 22.59 mins
Image differences available at: http://107.21.233.14:8877/62302241cef33d8/reftest-analyzer.html#web=eq.log |
/botio makeref |
From: Bot.io (Windows)ReceivedCommand cmd_makeref from @yurydelendik received. Current queue size: 0 Live output at: http://107.22.172.223:8877/59644205210b29a/output.txt |
From: Bot.io (Linux)ReceivedCommand cmd_makeref from @yurydelendik received. Current queue size: 0 Live output at: http://107.21.233.14:8877/c5b4be44d593c86/output.txt |
From: Bot.io (Windows)SuccessFull output at http://107.22.172.223:8877/59644205210b29a/output.txt Total script time: 21.31 mins
|
From: Bot.io (Linux)SuccessFull output at http://107.21.233.14:8877/c5b4be44d593c86/output.txt Total script time: 22.48 mins
|
implement CalRGB color space
Thank you |
Super, 1 year's worth of effort comes into fruition :) CalGray blackpoint should be farely easy now. Crossreferencing #252. |
Both whitespace and blackspace support are implemented.