Skip to content

Conversation

@gunnar-ifp
Copy link

This fixes an issue with a missed logged error + loop breaking if an erroneous read falls onto a skipped row.

It also improves the speed at least by factor twice (due to sign test instead of bit masking and boolean flag for subsampling).
It will be even faster with regions, as there was a poor design choice of full inner loop computations even if x was below startX.

(The method wasn't very slow to begin with, though.)

optimized from1Bit():
- Fixed an uncaught abort on failure if subsampling is enabled and the row was being skipped.
- Optimized bit to byte expansion by explicitly starting at startx instead of looping over bytes, using the integer sign to  extract bits instead of a mask, and not calculating subsampling unless necessary.
@THausherr
Copy link
Contributor

Do you have a file that shows the speed increase / how did you test? I tried with the file from https://issues.apache.org/jira/browse/PDFBOX-2123 and didn't really notice a difference with PDFDebugger (but it's difficult to make benchmarks).

@gunnar-ifp
Copy link
Author

Yeah as I wrote in the initial comment, it's not really slow. I simply timed the method itself in the sourcecode with System nanoseconds and for the big mask it went down from 55 to something 25ish. Once you go through a few pages of that Alfa catalog PDF you can see consisten times. As I said it wasn't really slow. It was just very wasteful in the original version with not calculating start offsets and all.

And the error if readLen!=rowLen was not caught with subsampling if the line was left out.

@asfgit asfgit closed this in fe38dd1 Jun 24, 2021
@THausherr
Copy link
Contributor

Fixed in https://issues.apache.org/jira/browse/PDFBOX-5224, thank you!

@gunnar-ifp gunnar-ifp deleted the imagereader-from1bit branch November 24, 2021 16:22
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.

2 participants