Skip to content

Fix lens identification for the original Canon EOS 5D - #9564

Open
wilx wants to merge 1 commit into
Exiv2:mainfrom
wilx:fix-canon-5d-lens
Open

wilx wants to merge 1 commit into
Exiv2:mainfrom
wilx:fix-canon-5d-lens

Conversation

@wilx

@wilx wilx commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

The original EOS 5D can report CanonCs.LensType=0 and an empty lens model, causing applications to display Unknown Lens (0).

The alternate field’s offset and byte order come from ExifTool’s CameraInfo5D table. This was verified against the reporter’s RAW sample from RawTherapee #7496: CameraInfo bytes 10 38 at offset 0x97 give lens ID 4152 in big-endian order.

Use that alternate ID for the original EOS 5D when the primary ID is zero and CameraInfo has the expected type and length. Reuse existing lens matching while preserving raw metadata and configuration overrides.

Adds 12 regression tests covering the sample’s metadata arrangement, byte order, missing/truncated CameraInfo, and unaffected camera/lens cases. The full RAW is excluded from Git.

Validation: built with nice -n 10 and -j4; all eight CTest suites pass, including 438 unit tests. The sample now identifies as Canon EF 24-105mm f/3.5-5.6 IS STM through both the CLI and lensName().

Prepared with AI assistance.

Comment thread src/canonmn_int.cpp Fixed
@wilx
wilx force-pushed the fix-canon-5d-lens branch from dba9b89 to 1cd208b Compare November 5, 2026 21:56
@kmilos kmilos added the lens Issue related to lens detection label Nov 6, 2026
Use the big-endian lens ID in CameraInfo when the original EOS 5D reports a zero CameraSettings lens ID. Check the model, value type and bounds, and preserve raw metadata and configuration override priority.

Add regression coverage for the reported metadata, EXIF byte order, missing and truncated CameraInfo, and unaffected camera and lens cases.
@wilx
wilx force-pushed the fix-canon-5d-lens branch from 1cd208b to a957695 Compare November 22, 2026 15:25
@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

lens Issue related to lens detection

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants