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

Handling jpx images with multiple precincts per resolution level #5479

Closed
wants to merge 16 commits into from

Conversation

plroit
Copy link
Contributor

@plroit plroit commented Nov 9, 2014

As discussed in the comment thread for issue 5475
introduced a small change at how codeblocks of each resolution are mapped to their precincts,
for the non-degenerate case.
Has been tested with large images (5K x 3K approx.) RGB, multiple quality layers, 6 resolution levels
with the following test cases:

  1. No precincts at all (single default precinct for each resolution level)
  2. Multiple precincts per resolution level with varying sizes for each resolution
  3. Precincts with a size larger than the image (should be the similar to the degenerate case).

@Snuffleupagus
Copy link
Collaborator

Please remove the second commit, since it doesn't contain anything that's needed for this PR.
Also, please update the code so that it passes lint (run node make lint locally), see the Style Guide.
Once you've addressed these comments, please squash the commits: https://github.com/mozilla/pdf.js/wiki/Squashing-Commits.

@CodingFabian
Copy link
Contributor

i can confirm that this commit makes https://www.dropbox.com/s/wnkhdtqgpduk5fl/cabs_1tile_bw_puniform_lrcp.pdf?dl=0 render correctly. well done!
We should add the pdf as regression test.

Besides that the linting errors are that your comment lines are too long (80 char limit) and we use === instead of ==

@Snuffleupagus
Copy link
Collaborator

We should add the pdf as regression test.

Ideally yes, but we need to obtain permission first. I've just asked about this in the issue.
(In this case a linked test is unfortunately not such a great idea, since the file is only available from a Dropbox which means a very uncertain future availability.)

@CodingFabian
Copy link
Contributor

this looks good. can you please squash the commits? (https://github.com/mozilla/pdf.js/wiki/Squashing-Commits)

Allow localization of the placement of percent signs in the zoom box
…oadingBar

Fix loadingBar hiding when disableAutoFetch is enabled (issue 3590)
Prevent text selection in Presentation Mode (bug 1018882)
@@ -498,7 +515,9 @@ var JpxImage = (function JpxImageClosure() {
precinctHeight: precinctHeight,
numprecinctswide: numprecinctswide,
numprecinctshigh: numprecinctshigh,
numprecincts: numprecincts
numprecincts: numprecincts,
cblkGroupWidth:cblkGroupWidth,
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: space after ':'

@yurydelendik yurydelendik self-assigned this Nov 11, 2014
// (u, v) = (ceil(x/2), ceil(y/2)) where (x, y) and (u, v) are the
// coordinates of a point in the LL band and child subband, respectively.
var isZeroRes = resolution.resLevel === 0;
var cblkGroupWidth = 1 << (dimensions.PPx + (isZeroRes ? 0 : -1));
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you rename cblkGroupWidth to subbandCodeblockWidth and cblkGroupHeight to subbandCodeblockHeight?

Per "B.7 Division of the sub-bands into code-blocks": "The code-block size for each sub-band at a particular resolution level is determined as 2^xcb ́ by 2^ycb ́ ...."

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi,
Section B. 6 specifies how to divide a resolution level into rectangular blocks called precincts, and section B.7 specifies how to divide a subband into rectangular blocks called codeblocks. Surprisingly, there is no direct specification of how to map codeblocks into precincts. That is why the Jasper library had to establish a new term, called _Codeblock-Group_ to derive the correct mapping, and I have decided to use this variable name.
For this reason I have to disagree with you about the naming, but I will change it if you should insist.

Please note that subbandCodeblockWidth/Height is a misleading variable name, since it does not describe neither the codeblock dimensions nor the subbands' dimensions.
What it should describe is the number of samples in a subband that map to a whole precinct.
Maybe a more descriptive name is subbandSamplesPerPrecinctWidth/Height ?

Paul

Copy link
Contributor

Choose a reason for hiding this comment

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

Okay, subbandSamplesPerPrecinctWidth is good too (but takes more space and might add more code lines). If it's too ugly, will subbandWidthPerPrecinct work?

@yurydelendik
Copy link
Contributor

Looks good after comments above addressed and commits squashed.

@plroit
Copy link
Contributor Author

plroit commented Nov 13, 2014

I am new to Git, so squashing the commits did not go very smoothly,
please make sure that the commit history looks like what you had in mind.

Thank you, Paul

@plroit plroit closed this Nov 13, 2014
@plroit plroit reopened this Nov 13, 2014
@CodingFabian
Copy link
Contributor

yeah looks quite a mess :-) the main issue is that you did the changes on master, rather an issue branch :)
I am going to save your work and make a new PR, but I think you can manage to recover from it. What I would do is: save your work, re-clone, make a branch and create a new pr.

@yurydelendik
Copy link
Contributor

Fixed by #5485

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants