Repository navigation
JPXDecode: read the JP2 container and codestream header - #31
Draft
MPCoreDeveloper wants to merge 1 commit into
Draft
MPCoreDeveloper wants to merge 1 commit into
MPCoreDeveloper wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The first stage of
JPXDecode, per ADR-005. It reads the container and the main header of a JPEG 2000 image:jp2cbox (32-bit and 64-bit box lengths), or a raw J2K codestream that starts with SOC.JpxDecoder.TryReadHeaderstates those values and refuses a container without a codestream, a main header without SIZ or COD, and a codestream whose fields are out of range.Fixtures
OpenJPEG's, through Pillow, under
tests/SharpCorePDF.Tests/Assets/jpx/:jpx-5-3.jp2andjpx-9-7.jp2for the two transforms andjpx-5-3.j2kfor the raw form, each 32 x 32, three 8-bit components, five decomposition levels, no colour transform. The expected.binfiles are Pillow's decode of the same files, kept for the pixel stage.Not in this stage
The pixels: the packet headers and the tag trees, the EBCOT bit-plane passes with the MQ arithmetic decoder, the inverse 5/3 and 9/7 wavelets, and the reversible/irreversible colour transform. ADR-005's JPX acceptance is a bit-exact reversible decode, so this is a draft: merging it alone would add a tested foundation that no production path calls yet.
Validation
dotnet build SharpCorePDF.slnx -c Release: 0 warnings, 0 errorsJpxDecoderTests: 6/6net10.0andnet11.0