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

Jbig2 optimizations #4434

Merged
merged 9 commits into from
Mar 14, 2014
Merged

Jbig2 optimizations #4434

merged 9 commits into from
Mar 14, 2014

Conversation

p01
Copy link
Contributor

@p01 p01 commented Mar 10, 2014

~13% speed improvement in JBIG2 decoding.

Measured 10x the decoding time of ten 33M pixels JBIG2 images:
Average decoding time went from ~1440ms to ~1270ms in Opera, and ~1240ms to ~1060ms in Aurora

@Snuffleupagus
Copy link
Collaborator

This might depend on PR #4431.

@p01
Copy link
Contributor Author

p01 commented Mar 11, 2014

This PR doesn't really depend on #4431 but I pushed a micro optimization to the ArithmeticDecoder that would then benefit both JBIG2 and JPX

@yurydelendik
Copy link
Contributor

The #4431 was merged, could you rebase your changes?

@p01
Copy link
Contributor Author

p01 commented Mar 13, 2014

Thanks. Done.

@@ -105,7 +105,7 @@ var Jbig2Image = (function Jbig2ImageClosure() {
offset = 340;
break;
default:
v = v * 2 + bit;
v = (v << 1) | bit;
Copy link
Contributor

Choose a reason for hiding this comment

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

This shall stay unsigned. Please add a note of danger this getting this singed, or use ((v << 1) | bit) >>> 0

@yurydelendik
Copy link
Contributor

/botio test

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

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

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

@pdfjsbot
Copy link

From: Bot.io (Linux)


Received

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

Live output at: http://107.21.233.14:8877/9ccf874ff811d88/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Success

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

Total script time: 37.23 mins

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

p01 added 9 commits March 13, 2014 17:37
Moved the switch(combinationOperator) outside the width and height loops
Check bitmap[i][j] before applying the switch(combinationOperator)
ltp can only become truthy if predition is true.
…ner loop

There is no need to slow down the inner loop with a test for ltp as it can only
change if prediction is true in which case it only changes in the outer loop.
@pdfjsbot
Copy link

From: Bot.io (Linux)


Success

Full output at http://107.21.233.14:8877/9ccf874ff811d88/output.txt

Total script time: 25.95 mins

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

@yurydelendik
Copy link
Contributor

/botio test

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

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

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

@pdfjsbot
Copy link

From: Bot.io (Linux)


Received

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

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

@pdfjsbot
Copy link

From: Bot.io (Linux)


Success

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

Total script time: 25.80 mins

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

@pdfjsbot
Copy link

From: Bot.io (Windows)


Success

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

Total script time: 37.14 mins

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

yurydelendik added a commit that referenced this pull request Mar 14, 2014
@yurydelendik yurydelendik merged commit 8266225 into mozilla:master Mar 14, 2014
@yurydelendik
Copy link
Contributor

Thank you for the patch

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.

4 participants