Repository navigation
LR-EDIT-OPTICS-PROFILE: apply embedded A7R IVA distortion corrections - #498
Conversation
…n is at 21) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thank you @QuirkyTurtle94! Following the RW2 approach for embedded Sony distortion is the right design, and I merged main into your branch to clear a conflict. Before it can land:
If you haven't already, please join our Discord: https://discord.gg/artcraft |
|
Thanks for the review. I have taken the validated-model restriction option and resolved the conflicts with current
Validation after merging Re-exported the three A7R IVA reference files on the merged build: corrected geometry against Sony Imaging Edge remains within median residuals of 0.35, 0.14, 0.09 px at 24, 200 and 600 mm respectively (2376 px output width). Private photographs and Sony reference exports remain local; only source, tests, documentation and public corpus URLs/checksums are included. |
|
Thank you @QuirkyTurtle94! Limiting the embedded warp to the ILCE-7RM4A was the right call, and the solver is bounded nicely. I couldn't land it this round. #575 and #580, which landed in #657, rewrite Could you rebase onto main, and:
Please join our Discord if you haven't already: https://discord.gg/artcraft |
Main (storytold#575, storytold#580) rewrote default_crop. The image crop now keeps main's order for every Sony body (Sony's crop tags, then DefaultCrop, then the recorded-size crop), so framing does not change. Only the ILCE-7RM4A distortion warp takes its centre and normalization from DefaultCrop when the file has one, which keeps the geometry validated against Sony's exports (centre x 4783.5 on the A7R IVA sample). The DNG round-trip test now checks both: Sony's crop on the image, the warp centred on the default crop. RENDER_CACHE_VERSION 38. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thank you @QuirkyTurtle94! This landed in #692. I merged main into your branch and kept main's crop order (Sony crop tags, then DefaultCrop, then the recorded size) for every body. Your warp still takes its centre from DefaultCrop on the ILCE-7RM4A only, and it's still limited to that body. Please join our Discord if you haven't already: https://discord.gg/artcraft |
…ultCrop helper side by side (merge put the flag on the wrong function) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Merge timing update: #498 landed in #692 at Current-main follow-up results: all eight Thanks for the follow-up and for the crop-precedence merge. I kept your
I also repeated the Sony-reference comparisons at 2376 px wide. Corrected median/p95 feature residuals are 0.36/1.12 px at 24 mm, 0.13/0.36 px at 200 mm, and 0.10/0.37 px at 600 mm. These subtract translation only: the retained crop origin introduces approximately 8 px horizontal framing difference from Sony, which is now explicitly documented rather than hidden by the old alignment figures. All six corrected/uncorrected reference renders are byte-identical between the measured build and the final executable. Headless checks also show the A7R IVA profile controls present, A7 III controls absent, and completed renders with no notices. The PR description and |
…ded table New vendor::arw_lens_rm6 reads the raw IFD's lens tables (0x7037 distortion, 0x7032 vignetting, 0x7035 lateral CA, their flags) and turns the distortion table into a one-plane WarpRectilinear in OpcodeList3, with the conventions measured on 54 ILCE-7RM6 photos: knots at i/15 of the full-frame crop half diagonal, S(r) = r (1 + v(r)/15000), frame-filling zoom, centred on the default crop. Only the ILCE-7RM6 is enabled; vignetting is read, not applied. The radial least-squares fit is split out as vendor::fit_radial_warp (RW2 results unchanged); its error gate can be limited to the radii the crop shows, so a padded active area (lossless files) doesn't refuse a fit over pixels that are never rendered. It sits next to main's vendor::arw_lens (storytold#498), which holds the ILCE-7RM4A conventions measured against Sony's exports (unit 16384, table indexed at the output radius); the two are selected by camera model (disjoint allowlists). arw::decode chains this module's opcodes after arw_lens::distortion, with the same active area and the same crop (the DNG-style default crop when the file has one, which on the ILCE-7RM6 equals Sony's crop tags), and like it only for CFA data (not the downsized linear-RGB lossless sizes, where the knot spacing in full-frame pixels would not hold). The corpus test checks the conversion on the two lossless RawDB files (CC0). The APS-C one is pinned in xtask RAW_SAMPLES with its sha256; the full-frame one is not (at most two pins per PR, and storytold#625 pins two Compressed ARW 6.0 files), so its case runs only where the file is present. RENDER_CACHE_VERSION 43 (main is at 42). PR storytold#625 also bumps to 43: whichever of the two merges second bumps to 44. Co-Authored-By: Claude <noreply@anthropic.com>
…M6; docs and tracker docs/sony-ilce7rm6-lens-corrections.md records the three Sony tables, the measured conventions with their residuals, the conversion to WarpRectilinear and its fit gate, the model allowlist and how to extend it, the measurement method, the verification and the limits. Verified locally on 54 ILCE-7RM6 photos with four lenses. The corrected render lines up with the camera JPEG within 0.679 px at 1440 px at the corners and edge midpoints of the 33 measurable photos shot with in-camera correction on (up to 17.3 px uncorrected). The 13 controls show the model's own shift. Every fit passes the 0.25 px gate (margin 0.075). Lateral CA stays within 0.3 px, but applied after demosaic it raises the render's corner CA (rms 0.032 -> 0.052 px); the doc and tracker say so. Its "Two conventions" section sets these conventions next to the ILCE-7RM4A's (vendor::arw_lens, docs/sony-lens-corrections.md, storytold#498): on the 34 measurable ILCE-7RM6 photos that formula gives 1.429 / 0.319 px (max / rms) against 0.596 / 0.143, failing only on the 24-70 GM II and fitting the 100 mm and 200-600 better; no single unit fits every lens under either, and what would settle it (Sony On/Off exports of a wide zoom, more lenses). docs/sony-lens-corrections.md gains a pointer to it. Tracker rows LR-EDIT-OPTICS-PROFILE (one note for both bodies) and LR-IMP-CAMERA-COVERAGE in docs/parity-checklist.md, gap 8 in docs/gaps.md, the lens-profile section of docs/raw-parity.md (lens score unchanged), whats-new (lossless ARWs now; Compressed / Compressed HQ once the ARW 6.0 decoder, storytold#625, lands) and the colour-fit follow-up note are updated. Co-Authored-By: Claude <noreply@anthropic.com>
…ded table New vendor::arw_lens_rm6 reads the raw IFD's lens tables (0x7037 distortion, 0x7032 vignetting, 0x7035 lateral CA, their flags) and turns the distortion table into a one-plane WarpRectilinear in OpcodeList3, with the conventions measured on 54 ILCE-7RM6 photos: knots at i/15 of the full-frame crop half diagonal, S(r) = r (1 + v(r)/15000), frame-filling zoom, centred on the default crop. Only the ILCE-7RM6 is enabled; vignetting is read, not applied. The radial least-squares fit is split out as vendor::fit_radial_warp (RW2 results unchanged); its error gate can be limited to the radii the crop shows, so a padded active area (lossless files) doesn't refuse a fit over pixels that are never rendered. It sits next to main's vendor::arw_lens (storytold#498), which holds the ILCE-7RM4A conventions measured against Sony's exports (unit 16384, table indexed at the output radius); the two are selected by camera model (disjoint allowlists). arw::decode chains this module's opcodes after arw_lens::distortion, with the same active area and the same crop (the DNG-style default crop when the file has one, which on the ILCE-7RM6 equals Sony's crop tags), and like it only for CFA data (not the downsized linear-RGB lossless sizes, where the knot spacing in full-frame pixels would not hold). The corpus test checks the conversion on the two lossless RawDB files (CC0). The APS-C one is pinned in xtask RAW_SAMPLES with its sha256; the full-frame one is not (at most two pins per PR, and storytold#625 pins two Compressed ARW 6.0 files), so its case runs only where the file is present. RENDER_CACHE_VERSION 43 (main is at 42). PR storytold#625 also bumps to 43: whichever of the two merges second bumps to 44. Co-Authored-By: Claude <noreply@anthropic.com>
…M6; docs and tracker docs/sony-ilce7rm6-lens-corrections.md records the three Sony tables, the measured conventions with their residuals, the conversion to WarpRectilinear and its fit gate, the model allowlist and how to extend it, the measurement method, the verification and the limits. Verified locally on 54 ILCE-7RM6 photos with four lenses. The corrected render lines up with the camera JPEG within 0.679 px at 1440 px at the corners and edge midpoints of the 33 measurable photos shot with in-camera correction on (up to 17.3 px uncorrected). The 13 controls show the model's own shift. Every fit passes the 0.25 px gate (margin 0.075). Lateral CA stays within 0.3 px, but applied after demosaic it raises the render's corner CA (rms 0.032 -> 0.052 px); the doc and tracker say so. Its "Two conventions" section sets these conventions next to the ILCE-7RM4A's (vendor::arw_lens, docs/sony-lens-corrections.md, storytold#498): on the 34 measurable ILCE-7RM6 photos that formula gives 1.429 / 0.319 px (max / rms) against 0.596 / 0.143, failing only on the 24-70 GM II and fitting the 100 mm and 200-600 better; no single unit fits every lens under either, and what would settle it (Sony On/Off exports of a wide zoom, more lenses). docs/sony-lens-corrections.md gains a pointer to it. Tracker rows LR-EDIT-OPTICS-PROFILE (one note for both bodies) and LR-IMP-CAMERA-COVERAGE in docs/parity-checklist.md, gap 8 in docs/gaps.md, the lens-profile section of docs/raw-parity.md (lens score unchanged), whats-new (lossless ARWs now; Compressed / Compressed HQ once the ARW 6.0 decoder, storytold#625, lands) and the colour-fit follow-up note are updated. Co-Authored-By: Claude <noreply@anthropic.com>
…ded table New vendor::arw_lens_rm6 reads the raw IFD's lens tables (0x7037 distortion, 0x7032 vignetting, 0x7035 lateral CA, their flags) and turns the distortion table into a one-plane WarpRectilinear in OpcodeList3, with the conventions measured on 54 ILCE-7RM6 photos: knots at i/15 of the full-frame crop half diagonal, S(r) = r (1 + v(r)/15000), frame-filling zoom, centred on the default crop. Only the ILCE-7RM6 is enabled; vignetting is read, not applied. The radial least-squares fit is split out as vendor::fit_radial_warp (RW2 results unchanged); its error gate can be limited to the radii the crop shows, so a padded active area (lossless files) doesn't refuse a fit over pixels that are never rendered. It sits next to main's vendor::arw_lens (storytold#498), which holds the ILCE-7RM4A conventions measured against Sony's exports (unit 16384, table indexed at the output radius); the two are selected by camera model (disjoint allowlists). arw::decode chains this module's opcodes after arw_lens::distortion, with the same active area and the same crop (the DNG-style default crop when the file has one, which on the ILCE-7RM6 equals Sony's crop tags), and like it only for CFA data (not the downsized linear-RGB lossless sizes, where the knot spacing in full-frame pixels would not hold). The corpus test checks the conversion on the two lossless RawDB files (CC0). The APS-C one is pinned in xtask RAW_SAMPLES with its sha256; the full-frame one is not (at most two pins per PR, and storytold#625 pins two Compressed ARW 6.0 files), so its case runs only where the file is present. RENDER_CACHE_VERSION 62 -> 63. Co-Authored-By: Claude <noreply@anthropic.com>
…M6; docs and tracker docs/sony-ilce7rm6-lens-corrections.md records the three Sony tables, the measured conventions with their residuals, the conversion to WarpRectilinear and its fit gate, the model allowlist and how to extend it, the measurement method, the verification and the limits. Verified locally on 54 ILCE-7RM6 photos with four lenses. The corrected render lines up with the camera JPEG within 0.679 px at 1440 px at the corners and edge midpoints of the 33 measurable photos shot with in-camera correction on (up to 17.3 px uncorrected). The 13 controls show the model's own shift. Every fit passes the 0.25 px gate (margin 0.075). Lateral CA stays within 0.3 px, but applied after demosaic it raises the render's corner CA (rms 0.032 -> 0.052 px); the doc and tracker say so. Its "Two conventions" section sets these conventions next to the ILCE-7RM4A's (vendor::arw_lens, docs/sony-lens-corrections.md, storytold#498): on the 34 measurable ILCE-7RM6 photos that formula gives 1.429 / 0.319 px (max / rms) against 0.596 / 0.143, failing only on the 24-70 GM II and fitting the 100 mm and 200-600 better; no single unit fits every lens under either, and what would settle it (Sony On/Off exports of a wide zoom, more lenses). docs/sony-lens-corrections.md gains a pointer to it. Tracker rows LR-EDIT-OPTICS-PROFILE (one note for both bodies) and LR-IMP-CAMERA-COVERAGE in docs/parity-checklist.md, gap 8 in docs/gaps.md, the lens-profile section of docs/raw-parity.md (lens score unchanged), whats-new (lossless ARWs now; Compressed / Compressed HQ once the ARW 6.0 decoder, storytold#625, lands) and the colour-fit follow-up note are updated. Co-Authored-By: Claude <noreply@anthropic.com>
Sony A7R IVA RAWs can contain per-image lens distortion data while LightCraft reports no embedded correction. Decode the signed 16-sample raw-IFD table (
0x7037) into the existingWarpRectilinearpath. The existing Optics control can disable or adjust the correction, and DNG export preserves it.The merged implementation is restricted to exact ILCE-7RM4A Bayer ARWs, independently checked with the FE 24–105mm F4 G OSS and FE 200–600mm F5.6–6.3 G OSS. Other Sony models remain uncorrected. Preserve main's image crop order: Sony crop tags → DefaultCrop → recorded image size. The warp independently uses DefaultCrop for its centre/normalization.
This PR merged at
7962c78through #692. It includes the original 11-file model-boundary test and synthetic geometry/header/full/DNG checks. Distortion only; vignetting, lateral CA, other table layouts and unvalidated bodies remain outside scope. No private photos or reference exports are committed.Post-merge follow-up: #695. Full-corpus validation, expansion to 23 Sony files across 17 models, an additional image-aspect guard and fresh reference measurements are submitted there. Those follow-up changes were pushed after #498 merged and are not part of this PR's merged diff. Detailed review response: #498 (comment)
Related to #329; this does not close the broader lens-profile request. Optional
solve4sharing remains deferred because the Sony and RW2 implementations have different singular-pivot thresholds.