Skip to content
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

Read color info from JPX stream + fix color problem #4540 #4565

Merged
merged 2 commits into from
Apr 7, 2014

Conversation

fkaelberer
Copy link
Contributor

These are two commits that I accicently squashed into one.

The first one gets color information directly from the JPX stream, to define the color space in images.js.
This fixes #1303, #4407 (and all documents that are created with Acrobat 8 from JPX images).
I'm not 100% if this is how it is supposed to be done in image.js, so please have a look at that.

The other commit corrects the coefficient magnitudes in jpx.js and so fixes #4540.

Everything below Line 1000 in jpx.js is just minor cleanup.

I opened another PR concurrently to #4538, because I wanted to fix errors first, and make the performance oriented changes of #4538 optional.

Fix colors problem mozilla#4540 + minor cleanup

fix lint warnings
@Snuffleupagus
Copy link
Collaborator

/botio test

@pdfjsbot
Copy link

pdfjsbot commented Apr 5, 2014

From: Bot.io (Windows)


Received

Command cmd_test from @Snuffleupagus received. Current queue size: 0

Live output at: http://107.22.172.223:8877/adf3588fdb43dfb/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Apr 5, 2014

From: Bot.io (Linux)


Received

Command cmd_test from @Snuffleupagus received. Current queue size: 0

Live output at: http://107.21.233.14:8877/0a0169e6aff2311/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Apr 5, 2014

From: Bot.io (Windows)


Failed

Full output at http://107.22.172.223:8877/adf3588fdb43dfb/output.txt

Total script time: 14.43 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Regression tests: FAILED

Image differences available at: http://107.22.172.223:8877/adf3588fdb43dfb/reftest-analyzer.html#web=eq.log

@pdfjsbot
Copy link

pdfjsbot commented Apr 5, 2014

From: Bot.io (Linux)


Failed

Full output at http://107.21.233.14:8877/0a0169e6aff2311/output.txt

Total script time: 15.23 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Regression tests: FAILED

Image differences available at: http://107.21.233.14:8877/0a0169e6aff2311/reftest-analyzer.html#web=eq.log

@timvandermeij
Copy link
Contributor

Let's try this again.

/botio test

@pdfjsbot
Copy link

pdfjsbot commented Apr 5, 2014

From: Bot.io (Linux)


Received

Command cmd_test from @timvandermeij received. Current queue size: 0

Live output at: http://107.21.233.14:8877/a71f4ee1e84c6c0/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Apr 5, 2014

From: Bot.io (Windows)


Received

Command cmd_test from @timvandermeij received. Current queue size: 0

Live output at: http://107.22.172.223:8877/e08495009d4823c/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Apr 5, 2014

From: Bot.io (Windows)


Failed

Full output at http://107.22.172.223:8877/e08495009d4823c/output.txt

Total script time: 14.56 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Regression tests: FAILED

Image differences available at: http://107.22.172.223:8877/e08495009d4823c/reftest-analyzer.html#web=eq.log

@pdfjsbot
Copy link

pdfjsbot commented Apr 5, 2014

From: Bot.io (Linux)


Failed

Full output at http://107.21.233.14:8877/a71f4ee1e84c6c0/output.txt

Total script time: 15.24 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Regression tests: FAILED

Image differences available at: http://107.21.233.14:8877/a71f4ee1e84c6c0/reftest-analyzer.html#web=eq.log

@timvandermeij
Copy link
Contributor

/cc @yurydelendik: Could you look into closing the browsers again?

@Snuffleupagus
Copy link
Collaborator

This timeouts locally as well, so the failures seem to be caused by the patch.
Comparing, for example, lines: https://github.com/mozilla/pdf.js/pull/4565/files#diff-96fc2112f33495889188d418b229afcbL1632 and https://github.com/mozilla/pdf.js/pull/4565/files#diff-96fc2112f33495889188d418b229afcbR1665, I wonder if this could be caused by the removal of k = i * llWidth (and similarly below).

// var bits = ...
// var colorspace = ...
var dict = image.dict;
if (dict.get('Filter').name === 'JPXDecode') {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the Filter entry guaranteed to be present in the dictionary? If not, I suggest adding if (dict.has('Filter')) { above to prevent issues.

@fkaelberer
Copy link
Contributor Author

Sorry, I should have tested this.
The test fails at issue3371.pdf, which is encrypted. In this case,

var data = image.stream.bytes;
jpxImage.parseImageProperties(data, 0, data.length);

will fail, because data will contain the encrypted bytes. I'll try pass the stream instead to fix that.

@fkaelberer
Copy link
Contributor Author

I wonder if this could be caused by the removal of k = i * llWidth (and similarly below).

No, that was not the problem. Once all code that does not affect k is removed, it is more obvious to see that the assignment k = i * lhWidth is redundant.

k=0;
for (i = 0; i < lhHeight; i++) {
  k = i * lhWidth;
  for (j = 0; j < lhWidth; j++) {
    k++;
  }
}

@fkaelberer
Copy link
Contributor Author

All tests but S2.pdf should pass now.

@Snuffleupagus
Copy link
Collaborator

/botio test

@pdfjsbot
Copy link

pdfjsbot commented Apr 6, 2014

From: Bot.io (Linux)


Received

Command cmd_test from @Snuffleupagus received. Current queue size: 0

Live output at: http://107.21.233.14:8877/a0ed46ac055f9ca/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Apr 6, 2014

From: Bot.io (Linux)


Failed

Full output at http://107.21.233.14:8877/a0ed46ac055f9ca/output.txt

Total script time: 25.63 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Regression tests: FAILED

Image differences available at: http://107.21.233.14:8877/a0ed46ac055f9ca/reftest-analyzer.html#web=eq.log

@yurydelendik
Copy link
Contributor

(@Snuffleupagus don't try to re-run windows botio when Font tests: FAILED is observed -- node.js is not able to close an application on windows, which holds directory)

/botio-windows test

@Snuffleupagus
Copy link
Collaborator

(@yurydelendik Sorry, I didn't pay enough attention to which tests that actually failed!)

@yurydelendik
Copy link
Contributor

/botio-windows test

@pdfjsbot
Copy link

pdfjsbot commented Apr 7, 2014

From: Bot.io (Windows)


Received

Command cmd_test from @yurydelendik received. Current queue size: 0

Live output at: http://107.22.172.223:8877/d9cba8fc0c5f65d/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Apr 7, 2014

From: Bot.io (Windows)


Failed

Full output at http://107.22.172.223:8877/d9cba8fc0c5f65d/output.txt

Total script time: 21.69 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Regression tests: FAILED

Image differences available at: http://107.22.172.223:8877/d9cba8fc0c5f65d/reftest-analyzer.html#web=eq.log

@yurydelendik
Copy link
Contributor

/botio makeref

@pdfjsbot
Copy link

pdfjsbot commented Apr 7, 2014

From: Bot.io (Windows)


Received

Command cmd_makeref from @yurydelendik received. Current queue size: 0

Live output at: http://107.22.172.223:8877/37e70fcb5e373b8/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Apr 7, 2014

From: Bot.io (Linux)


Received

Command cmd_makeref from @yurydelendik received. Current queue size: 0

Live output at: http://107.21.233.14:8877/b6fd76fe93372b7/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Apr 7, 2014

From: Bot.io (Windows)


Failed

Full output at http://107.22.172.223:8877/37e70fcb5e373b8/output.txt

Total script time: 21.66 mins

  • Lint: Ignored
  • Make references: FAILED

@pdfjsbot
Copy link

pdfjsbot commented Apr 7, 2014

From: Bot.io (Linux)


Success

Full output at http://107.21.233.14:8877/b6fd76fe93372b7/output.txt

Total script time: 25.61 mins

  • Lint: Passed
  • Make references: Passed
  • Check references: Passed

@yurydelendik
Copy link
Contributor

Thank you for the patch

yurydelendik added a commit that referenced this pull request Apr 7, 2014
Read color info from JPX stream + fix color problem #4540
@yurydelendik yurydelendik merged commit 31c260a into mozilla:master Apr 7, 2014
@yurydelendik
Copy link
Contributor

/botio-windows makeref

@pdfjsbot
Copy link

pdfjsbot commented Apr 7, 2014

From: Bot.io (Windows)


Received

Command cmd_makeref from @yurydelendik received. Current queue size: 0

Live output at: http://107.22.172.223:8877/b64a05a3e20e07f/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Apr 7, 2014

From: Bot.io (Windows)


Success

Full output at http://107.22.172.223:8877/b64a05a3e20e07f/output.txt

Total script time: 22.67 mins

  • Lint: Ignored
  • Make references: Passed
  • Check references: Passed

@fkaelberer fkaelberer deleted the fixJPXparsing branch April 7, 2014 16:50
@Snuffleupagus Snuffleupagus mentioned this pull request Apr 7, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Slightly wrong colors in JPX decoder Bits per component missing in image: false
5 participants