Skip to content

Conversation

@nico
Copy link
Contributor

@nico nico commented Nov 16, 2025

Files in random access organization first store all segment headers,
followed by all segment data. (In conctrast, the usual sequential
organization writes each segment's header and data in one piece.)

For that reason, files in random access organization must end
with an end_of_file segment, while it's optional for files in sequential
organization.

Almost all jbig2 decoders in existence can only read jbig2 data when
it's part of a PDF. JBIG2 data in a PDF is in the "embedded"
organization, which is like the sequential organization without the file
header. That means it's a bit difficult to test if random access files
are correct. Having said that, jbig2dec decodes the files we're
writing fine.

@github-actions github-actions bot added the 👀 pr-needs-review PR needs review from a maintainer or community member label Nov 16, 2025
nico added 3 commits November 16, 2025 20:50
We now store each segment's encoded data on the encoding context.
This will be useful for implementing writing files in the random
access organization, and it will hopefully also be useful in cases
where we need to partially decode the file we're about to write
(for example when refining whole text or halftone regions, or when
refining the current page).

This requires a few more copies than before, but it's small amounts
of data. `compile.sh` time does not change measurably with this.

No behavior change.
Files in random access organization first store all segment headers,
followed by all segment data. (In contrast, the usual sequential
organization writes each segment's header and data in one piece.)

For that reason, files in random access organization *must* end
with an end_of_file segment, while it's optional for files in sequential
organization.

Almost all jbig2 decoders in existence can only read jbig2 data when
it's part of a PDF. JBIG2 data in a PDF is in the "embedded"
organization, which is like the sequential organization without the file
header. That means it's a bit difficult to test if random access files
are correct. Having said that, `jbig2dec` decodes the files we're
writing fine.
@nico nico merged commit 3bab839 into SerenityOS:master Nov 17, 2025
12 checks passed
@nico nico deleted the jbig2-random branch November 17, 2025 12:33
@github-actions github-actions bot removed the 👀 pr-needs-review PR needs review from a maintainer or community member label Nov 17, 2025
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.

1 participant