-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
Fix searching for end of inline (EI) images with ASCII85Decode filters (bug 1077808) #5383
Conversation
/botio-linux preview |
From: Bot.io (Linux)ReceivedCommand cmd_preview from @Snuffleupagus received. Current queue size: 0 Live output at: http://107.21.233.14:8877/a716f99d5968d46/output.txt |
From: Bot.io (Linux)SuccessFull output at http://107.21.233.14:8877/a716f99d5968d46/output.txt Total script time: 0.80 mins Published
|
/botio test |
From: Bot.io (Windows)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://107.22.172.223:8877/2dd802736ea69ac/output.txt |
From: Bot.io (Linux)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://107.21.233.14:8877/4bc0931aadc8d7e/output.txt |
From: Bot.io (Windows)FailedFull output at http://107.22.172.223:8877/2dd802736ea69ac/output.txt Total script time: 2.90 mins
Image differences available at: http://107.22.172.223:8877/2dd802736ea69ac/reftest-analyzer.html#web=eq.log |
From: Bot.io (Linux)SuccessFull output at http://107.21.233.14:8877/4bc0931aadc8d7e/output.txt Total script time: 22.94 mins
|
if (isName(filter)) { | ||
filterNames = [filter.name]; | ||
} else if (isArray(filter)) { | ||
for (i = 0, ii = filter.length; i < ii; ++i) { |
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.
not sure how long that list typically is. but i think that you could move this code to a separate function which directly checks every element and does a quick return if one is found. This should be shorter in code and execution time.
something like this:
https://gist.github.com/CodingFabian/0731224202f8447cb805
Hmm, we had that at one point Snuffleupagus@c68dbd7#diff-6947033678b93d106e25614dd972e66fL123 . We need to verify why we need to revert that decision. |
/botio-windows preview |
From: Bot.io (Windows)ReceivedCommand cmd_preview from @yurydelendik received. Current queue size: 0 Live output at: http://107.22.172.223:8877/e8072358c6db18e/output.txt |
From: Bot.io (Windows)SuccessFull output at http://107.22.172.223:8877/e8072358c6db18e/output.txt Total script time: 0.98 mins Published
|
I verified. It regresses the ADP stuff. Can you add at the last "if" check condition to do that only for ASCII85. |
After thinking some more about this, I believe that it may not be such a great idea to rely only on the existence of white-space before the |
That's fine as well. Can you extract/refactor searching into two separate functions: for non-ASCII85 (which will just scan for '~') and regular search? In the future we can improve searching so other filter types, e.g. for HEX we can jump by 2*length first or walk-by-tags for JPX/JBIG/JPEG. P.S. no need creating getFirstFilterName closure-function. |
I wonder if we can add e.g. |
@yurydelendik I've attempted to refactor this along the lines you suggested above. Please let me know if this is going in the right direction! |
Yes, that looks good. One thing: I looks like after default search your stream stop after 'EI', but for AHx and A85 before. Will that be a problem? |
I thought about that, but since the tests passed it seemed fine. It's really good that you asked though, because I found that it does break things. One indication that something went wrong was that text selection stopped working. |
/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/12f3a8ad7e6ea18/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/ce386f97d099350/output.txt |
From: Bot.io (Windows)FailedFull output at http://107.22.172.223:8877/12f3a8ad7e6ea18/output.txt Total script time: 3.02 mins
Image differences available at: http://107.22.172.223:8877/12f3a8ad7e6ea18/reftest-analyzer.html#web=eq.log |
/botio-windows test |
From: Bot.io (Windows)ReceivedCommand cmd_test from @yurydelendik received. Current queue size: 0 Live output at: http://107.22.172.223:8877/7ae97467b69cff2/output.txt |
From: Bot.io (Linux)SuccessFull output at http://107.21.233.14:8877/ce386f97d099350/output.txt Total script time: 24.11 mins
|
From: Bot.io (Windows)SuccessFull output at http://107.22.172.223:8877/7ae97467b69cff2/output.txt Total script time: 20.67 mins
|
@Snuffleupagus, looks good, can you squash commits? |
Done. |
/botio test |
From: Bot.io (Windows)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://107.22.172.223:8877/07879f16db8599f/output.txt |
From: Bot.io (Linux)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://107.21.233.14:8877/f9f6d80a0ab59ee/output.txt |
From: Bot.io (Windows)SuccessFull output at http://107.22.172.223:8877/07879f16db8599f/output.txt Total script time: 16.83 mins
|
From: Bot.io (Linux)SuccessFull output at http://107.21.233.14:8877/f9f6d80a0ab59ee/output.txt Total script time: 22.73 mins
|
var FF = 0xFF, D9 = 0xD9; | ||
var startPos = stream.pos, ch, length; | ||
while ((ch = stream.getByte()) !== -1) { | ||
if (ch === FF && stream.peekByte() === D9) { |
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.
Thinking out loud: I don't remember if you need to ignore (0xFF 0xFF)*2 0xF9
sequences
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've removed this part of the patch, since I'd rather get the main part landed now in order to fix https://bugzilla.mozilla.org/show_bug.cgi?id=1077808 (given that the PR has been open for over two months).
Once this PR is merged, I can submit a followup which changes the inline JPEG image case.
…s (bug 1077808) This patch changes searching for the end of inline image streams to rely on the EOD marker for the filters: ASCII85Decode and ASCIIHexDecode.
/botio test |
From: Bot.io (Windows)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://107.22.172.223:8877/23f11e1868ea98f/output.txt |
From: Bot.io (Linux)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://107.21.233.14:8877/aa49c65b9e8845f/output.txt |
From: Bot.io (Windows)SuccessFull output at http://107.22.172.223:8877/23f11e1868ea98f/output.txt Total script time: 17.20 mins
|
From: Bot.io (Linux)SuccessFull output at http://107.21.233.14:8877/aa49c65b9e8845f/output.txt Total script time: 22.48 mins
|
/botio makeref |
From: Bot.io (Windows)ReceivedCommand cmd_makeref from @yurydelendik received. Current queue size: 1 Live output at: http://107.22.172.223:8877/0bf6c17cb2af150/output.txt |
From: Bot.io (Linux)ReceivedCommand cmd_makeref from @yurydelendik received. Current queue size: 1 Live output at: http://107.21.233.14:8877/a55ffed65370b00/output.txt |
Thank you for the patch |
Fix searching for end of inline (EI) images with ASCII85Decode filters (bug 1077808)
From: Bot.io (Windows)SuccessFull output at http://107.22.172.223:8877/0bf6c17cb2af150/output.txt Total script time: 17.22 mins
|
From: Bot.io (Linux)SuccessFull output at http://107.21.233.14:8877/a55ffed65370b00/output.txt Total script time: 22.70 mins
|
Fix searching for end of inline (EI) images with ASCII85Decode filters (bug 1077808)
Based on http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/PDF32000_2008.pdf#page=33, this is a tentative patch to fix https://bugzilla.mozilla.org/show_bug.cgi?id=1077808.