Skip to content

ARW: expose embedded lens-correction metadata (SubIFD 0x7032/0x7035/0x7037) #63

Description

@justin13888

rawshift-image-arw decodes pixels but exposes no lens-correction metadata. Sony writes vignetting, lateral-CA and distortion correction arrays into every ARW; consumers currently have no way to reach them.

Confirmed absent on master: grep -rn '0x7032\|0x7035\|0x7037' across rawshift-image-arw, rawshift-image-metadata and rawshift-image-ifd returns nothing.

Where the data is

These are EXIF SubIFD tags, not MakerNote — defined in ExifTool's main EXIF table (Image::ExifTool::Exif::Main, group SubIFD), read as Exif.SubImage1.*:

Tag Meaning Format
0x7032 VignettingCorrParams int16s[17]
0x7035 ChromaticAberrationCorrParams int16s[33]
0x7037 DistortionCorrParams int16s[17]

Sony's MakerNotes carry a separate copy at 0x064a/0x066a/0x06ca as int16s[16]/int16s[32]/int16s[16]without the leading count element. Reading one with the other's indexing shifts every coefficient by one, so the two must not be conflated.

Layout traps

Verified against _JIC7790.ARW in rawshift-test-fixtures (ILCE-6700, APS-C) and its committed exiftool.json:

  • Element 0 is the knot count n, and it is body-dependent, not fixed at 16 — Sony's own DistortionCorrParamsNumber enumerates 11 (APS-C) and 16 (full-frame). The fixture reads n = 11. Never assume a count.
  • Coefficients start at index 1. For CA the array holds both channels: red at 1..=n, blue at n+1..=2n, and its leading element is 2n, not n — the fixture reads 22 for n = 11.
  • Arrays are fixed-size and zero-padded to 17/33/17 regardless of n.

Fixture values for reference:

VignettingCorrParams          = 11 0 256 544 960 1536 2304 3360 4928 6688 8448 10048 0 0 0 0 0
ChromaticAberrationCorrParams = 22 384 384 384 384 384 384 256 256 256 128 128 -128 ... 0
DistortionCorrParams          = 11 7 11 25 54 97 151 223 309 417 546 704 704 704 704 704 704

Ask

Expose the three arrays as typed metadata (count + coefficient slices), decoded structurally. Please do not apply a semantic transform — the scale factors that turn these into gains and radial scales are reverse-engineered and undocumented (ExifTool supplies no ValueConv), and consumers need to pin their own interpretation to their own versioning scheme. Raw values plus the count is the right boundary.

Also worth surfacing alongside: VignettingCorrection, ChromaticAberrationCorrection, DistortionCorrection (the "Auto"/"Off" mode tags), since a consumer should know whether the camera intended correction at all.

Why

Focale (Capsulsaurus/Focale#7) implements optical corrections exclusively from embedded metadata and cannot start without this. It is the last thing blocking that issue — the correction math, parameter model and application order are already specified normatively on our side.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions