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

Simplify Jbig2Image.decodeInteger() #4773

Merged
merged 1 commit into from
May 18, 2014

Conversation

fkaelberer
Copy link
Contributor

The nested braches look a little bit strange, but the new code is actually easier to compare to the spec.

@timvandermeij
Copy link
Contributor

/botio test

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

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

Live output at: http://107.22.172.223:8877/3f14d18f9ea041f/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux)


Received

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

Live output at: http://107.21.233.14:8877/8d0f2858890fce6/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Success

Full output at http://107.22.172.223:8877/3f14d18f9ea041f/output.txt

Total script time: 23.64 mins

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

@pdfjsbot
Copy link

From: Bot.io (Linux)


Success

Full output at http://107.21.233.14:8877/8d0f2858890fce6/output.txt

Total script time: 26.01 mins

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

@fkaelberer
Copy link
Contributor Author

If I pulled readBits() out of the scope of decodeInteger(), I'd have to make decoder, contexts, and prev global, which I'd prefer to avoid.

Whichever version I use (old, inlined readBits(), 'global' readBits()), the speed difference between any of the versions neglectible. Most calls are made by decodeTextRegion() which, among other things, calls decodeInteger() 6000 times and takes 35-37ms no matter which version I use.
For comparison, decoder.readBit() is called 13M times on the same page.

So since speed doesn't really matter here, I'd rather keep the simplest version and leave it like it is.

@yurydelendik
Copy link
Contributor

Let's go for simpler version. Thank you for the patch.

yurydelendik added a commit that referenced this pull request May 18, 2014
Simplify Jbig2Image.decodeInteger()
@yurydelendik yurydelendik merged commit c0419d7 into mozilla:master May 18, 2014
@fkaelberer fkaelberer deleted the shorterDecodeInt branch May 18, 2014 13:48
@p01
Copy link
Contributor

p01 commented May 19, 2014

That sounds reasonable. Good job on making this code easier to read/maintain!

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.

5 participants