fix(makernotes): correct Apple MakerNote PrintConv tables to match ExifTool 13.59 - #418
fix(makernotes): correct Apple MakerNote PrintConv tables to match ExifTool 13.59#418swackhamer wants to merge 1 commit into
Conversation
…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.
|
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. |
Summary
Five Apple MakerNote PrintConv tables in
src/parsers/tiff/makernotes/apple.rsdisagreed with ExifTool 13.59'sApple.pm, found while reviving unreachable test files (PR #404 chain). Ground truth:Apple.pmfrom the ExifTool 13.59 source tree.10(common on modern iPhones) printed "Screenshot" instead of "Photo";1printed "Portrait" instead of "ProRAW";2printed "Panorama" instead of "Portrait". ExifTool's11/12were missing. Trimmed to ExifTool's{1,2,10,11,12}.0"Back Wide Angle" and invented five values. Trimmed to ExifTool's{0,1,6}.PrintConvat all (# seen: 2,3,5); ExifTool prints the raw integer. Removed the invented decoder; the tag now prints the raw value.Unknown => 1in Apple.pm with noPrintConv, so ExifTool omits them by default (only shown with-u). Both tags are now suppressed, mirroring the existingUnknown => 1handling insigma.rs.Also caught by auditing the rest of the file's
const_decoder!tables:ValueConv => \&ConvertPLIST(binary plist), not an integer enum — so its five invented labels are replaced with the raw extracted value.parse_entry, zero correspondence to any Apple.pm tag) — deleted outright.This folds in the already-fixed
DECODE_HDR_TYPE(0x000a HDRImageType) fromfix/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. UnmappedPrintConvvalues 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 fromregister_simple_i16toregister_raw.Test plan
cargo build --lib— compiles cleancargo 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 --allcargo clippy --all-features -- -D warnings— clean