Skip to content

fix(makernotes): correct Apple MakerNote PrintConv tables to match ExifTool 13.59 - #418

Closed
swackhamer wants to merge 1 commit into
mainfrom
fix/apple-makernote-printconv-parity
Closed

fix(makernotes): correct Apple MakerNote PrintConv tables to match ExifTool 13.59#418
swackhamer wants to merge 1 commit into
mainfrom
fix/apple-makernote-printconv-parity

Conversation

@swackhamer

Copy link
Copy Markdown
Collaborator

Summary

Five Apple MakerNote PrintConv tables in src/parsers/tiff/makernotes/apple.rs disagreed with ExifTool 13.59's Apple.pm, found while reviving unreachable test files (PR #404 chain). Ground truth: Apple.pm from the ExifTool 13.59 source tree.

  • DECODE_IMAGE_CAPTURE_TYPE (0x0014 ImageCaptureType) — worst offender, disagreed on every shared key. 10 (common on modern iPhones) printed "Screenshot" instead of "Photo"; 1 printed "Portrait" instead of "ProRAW"; 2 printed "Panorama" instead of "Portrait". ExifTool's 11/12 were missing. Trimmed to ExifTool's {1,2,10,11,12}.
  • DECODE_CAMERA_TYPE (0x002e CameraType) — omitted 0 "Back Wide Angle" and invented five values. Trimmed to ExifTool's {0,1,6}.
  • DECODE_OIS_MODE (0x000f OISMode) — Apple.pm declares no PrintConv at all (# seen: 2,3,5); ExifTool prints the raw integer. Removed the invented decoder; the tag now prints the raw value.
  • DECODE_GREEN_GHOST_MITIGATION (0x003F) and DECODE_SNR_TYPE (0x0026) — both Unknown => 1 in Apple.pm with no PrintConv, so ExifTool omits them by default (only shown with -u). Both tags are now suppressed, mirroring the existing Unknown => 1 handling in sigma.rs.

Also caught by auditing the rest of the file's const_decoder! tables:

  • DECODE_SEMANTIC_STYLE (0x0040) had no basis in Apple.pm either — the real tag uses ValueConv => \&ConvertPLIST (binary plist), not an integer enum — so its five invented labels are replaced with the raw extracted value.
  • DECODE_PORTRAIT_MODE, DECODE_SCENE_TYPE, DECODE_LENS_MODEL were dead code (defined, never called from parse_entry, zero correspondence to any Apple.pm tag) — deleted outright.

This folds in the already-fixed DECODE_HDR_TYPE (0x000a HDRImageType) from fix/salvage-apple-samsung-makernote-tests, since both trace to the same root-cause audit.

Per AGENTS.md: a plausible-but-wrong value under a real ExifTool tag name is worse than an absent tag, since nothing downstream can tell it's wrong — omit rather than approximate. Unmapped PrintConv values now fall through to "Unknown (N)" instead of an invented label, matching ExifTool's own unmapped-value behavior.

src/parsers/tiff/makernotes/registries/apple.rs's doc comments and #[cfg(test)] assertions (which pinned the old fabricated values) are corrected alongside the tables, and the raw-fallback/suppression tags are switched from register_simple_i16 to register_raw.

Test plan

  • cargo build --lib — compiles clean
  • cargo test --lib apple:: — 26/26 passing (includes new tests pinning unmapped values to "Unknown (N)", raw-value printing for OISMode/SemanticStyle, and suppression for GreenGhostMitigationStatus/SignalToNoiseRatioType)
  • cargo fmt --all
  • cargo clippy --all-features -- -D warnings — clean

…ifTool 13.59

Five of Apple.pm's Main-table PrintConv tables in apple.rs disagreed with
ExifTool 13.59, invented labels, or decoded tags ExifTool leaves as raw
integers:

- DECODE_IMAGE_CAPTURE_TYPE (0x0014): disagreed on every shared key. Value 10
  (common on modern iPhones) printed "Screenshot" instead of "Photo"; 1
  printed "Portrait" instead of "ProRAW"; 2 printed "Panorama" instead of
  "Portrait". ExifTool's 11/12 were missing entirely.
- DECODE_CAMERA_TYPE (0x002e): omitted 0 "Back Wide Angle" and invented five
  values (Back Wide/Ultra Wide/Telephoto/Telephoto 2x, Front TrueDepth) that
  don't exist in Apple.pm.
- DECODE_OIS_MODE (0x000f): Apple.pm declares no PrintConv here at all
  (comment: "seen: 2,3,5"), so ExifTool prints the raw integer. The table
  invented Off/On/Cinematic Mode/Action Mode.
- DECODE_GREEN_GHOST_MITIGATION (0x003F) and DECODE_SNR_TYPE (0x0026): both
  `Unknown => 1` in Apple.pm with no PrintConv, so ExifTool omits them by
  default (shown only with -u). Both previously always emitted an invented
  label. Now suppressed, mirroring the `Unknown => 1` handling already used
  in sigma.rs.

Also found by the same audit: DECODE_SEMANTIC_STYLE (0x0040) had no basis in
Apple.pm either -- that tag's real ValueConv is a binary-plist decode
(ConvertPLIST), not a simple int enum -- so its five invented labels are
replaced with the raw value. DECODE_PORTRAIT_MODE, DECODE_SCENE_TYPE, and
DECODE_LENS_MODEL were unused dead code with zero correspondence to any
Apple.pm tag, so they're deleted outright.

Per AGENTS.md: a plausible-but-wrong value under a real ExifTool tag name is
worse than an absent one, since nothing downstream can tell it's wrong.
Unmapped PrintConv values now fall through to "Unknown (N)" instead of an
invented label.

Follows the shape of the already-landed DECODE_HDR_TYPE fix on
fix/salvage-apple-samsung-makernote-tests (cce3404), which is folded into
this branch since both trace to the same root-cause audit.
@swackhamer

Copy link
Copy Markdown
Collaborator Author

Closing without merging: this branch is now fully superseded by #394 ("find the MakerNote IFD, then read its binary plists"), which landed on `main` after this PR was opened.

#394 is a complete rewrite of `apple.rs` that already fixes every issue this PR addressed — HDRImageType (3/4), ImageCaptureType (1/2/10/11/12), CameraType (0/1/6), OISMode (no PrintConv, raw value), and correctly omits the `Unknown => 1` tags (`SignalToNoiseRatioType`, `GreenGhostMitigationStatus`, etc.) — and goes further: it implements real binary-plist decoding for `SemanticStyle`/`SemanticStyleRenderingVer`/`SemanticStylePreset` (0x0040/41/42) via a new `binary_plist` module, which was still an open gap in this PR. It also fixes an unrelated IFD-offset bug (14-byte header) that this PR never touched.

Rebasing this PR onto current `main` would just be re-deriving #394's work through a worse, table-less architecture. Closing in favor of it.

@swackhamer swackhamer closed this Aug 2, 2026
@swackhamer
swackhamer deleted the fix/apple-makernote-printconv-parity branch August 2, 2026 08:25
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