Repository navigation
Conversation
Contributor
Author
|
@DichenZhang1, thanks for incorporating this into feat/preserve-xmp-metadata. I checked the branch after #494 and confirmed that the merge handler and all seven regression cases from this PR are covered, including the ISO-only path. #494 also replaces the earlier size restriction with Extended XMP support. Closing this as superseded by the feature branch. |
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.
Preserve captions, keywords, rights, and other descriptive content in the supplied or selected XMP packet when encoding an Ultra HDR JPEG with
UHDR_WRITE_XMP=ON, while updating its gain-map information to match the output.Currently, equivalent RDF namespace prefixes can cause descriptive metadata to disappear even though encoding succeeds. Reusing existing XMP can also leave duplicate Container directories and an outdated gain-map length.
This uses the bundled XML reader to identify properties by namespace URI, preserve unrelated packet content, and replace the primary Container:Directory and hdrgm:Version properties with current generated metadata. It handles both explicitly supplied XMP and XMP inherited from a compressed base JPEG. No new dependency or public C API change is introduced.
Tests cover namespace aliases, inherited and explicit XMP, replacement of descriptive values, changed gain-map sizes, comments/CDATA, xpacket wrappers, unrelated RDF resources, and malformed or oversized input. Local synthetic JPEG files were also checked for preserved metadata values, correct directory lengths, and successful HDR decoding.
Local validation on macOS arm64: full CMake/CTest suites pass in dual, XMP-only, and ISO-only modes; all 11 focused ASan/UBSan tests pass. The inherited-XMP regression fails against the original feature-branch code.
Additional local checks exercised six real Adobe-origin XMP packets on small synthetic JPEG carriers: 48 operations across inherited input, explicit input, getter reuse with changed gain-map size, and replacement in dual and XMP-only modes. Independent checks verified retained properties, current directory lengths, and successful HDR decoding. Linux, Android, macOS, and Windows CI pass on the current commit.
ISO-only passthrough remains unchanged. JPEG extraction still selects the first standard XMP packet; descriptive content in later packets and Extended XMP are outside this change. Packets the bundled reader cannot safely merge return
UHDR_CODEC_INVALID_PARAMinstead of silently losing their contents.Targets
feat/preserve-xmp-metadata, following #471 and contributing to #469.