Skip to content

Read Adobe-wrapped Sony MakerNotes and 9405b lens data - #9539

Open
wilx wants to merge 4 commits into
Exiv2:mainfrom
wilx:fix-sony-9405b-read
Open

wilx wants to merge 4 commits into
Exiv2:mainfrom
wilx:fix-sony-9405b-read

Conversation

@wilx

@wilx wilx commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

Refs #2913.

Read Sony2 MakerNotes stored in Adobe DNG MakN records and expose distortion, vignetting, and chromatic-aberration arrays from supported 9405b layouts in native and converted files.

Preserve opaque MakerNote payloads during unrelated edits and reject changes to read-only derived fields. Unsupported layouts remain opaque; SR2, 2010h, and 9416 decoding are outside this change.

Tested with 189 focused cases across debug, no-XMP, sanitizers, and Meson; full debug CTest passes 8/8 suites. Coefficients and existing metadata were checked against ExifTool and baseline results on 17 samples.

AI assistance: OpenAI Codex assisted with implementation, tests, and this description.

Comment thread src/sonymn_int.cpp
if (required > encrypted.size() || parent.count() < required)
return;
for (size_t i = 0; i < required; ++i)
encrypted[i] = static_cast<byte>(parent.toUint32(i));
Comment thread src/sonymn_int.cpp
// Raw-only imports have no derived view; deleting an existing view alone is an edit.
const auto actual = sonyLensValues(data);
if (actual.empty()) {
const auto raw = data.findKey(ExifKey("Exif.Photo.MakerNote"));
@wilx
wilx force-pushed the fix-sony-9405b-read branch 2 times, most recently from a6b71ac to 390bc32 Compare November 4, 2026 23:25
@kmilos

kmilos commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator

Thanks for working on this. IMHO there are two separate PRs here, so let's please split them:

  1. Unwrapping the Sony makernotes from DNGs

  2. Parsing the 9504 tag structure

For the first I have my reservations - can't we do something simpler and more generic, along the lines of Pentax DNG makernotes vs PEF ones? I'm thinking this might not be specific to Sony and there will potentially be others to unwrap?

The second is so big that I'm afraid I won't have the bandwidth to review in depth, and will defer to other project members to decide whether we simply trust the AI re-implementation of exiftool...

wilx added 4 commits November 22, 2026 16:24
Decode headerless Sony2 MakN records with their saved byte order and
original offsets using bounded TIFF reading and existing Sony decoders.
Keep the complete Adobe private block opaque during unrelated writes and
reject edits to its read-only metadata view before source modification.

Add generated regressions for relocation, malformed records, resource
limits, metadata preservation, and rejected writes in CMake and Meson.

Refs Exiv2#2913.
Expose distortion, vignetting and chromatic-aberration arrays for
documented Sony 9405b layouts, including Adobe-wrapped MakerNotes.

Keep encrypted parents opaque and reject edits to derived fields before
encoding. Prepare Sony metadata once and leave other brands on the
existing encoding path.

Refs Exiv2#2913.
Apply clang-format 20 to align TIFF reader member comments after adding isolated Sony MakerNote state.
@wilx
wilx force-pushed the fix-sony-9405b-read branch from 390bc32 to 2bb73c8 Compare November 22, 2026 15:24
@mergify

mergify Bot commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue). If it does not match the queue conditions yet, it enters the queue once it does.

  • Queue this pull request once it meets the queue conditions

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.

3 participants