Skip to content

Sony ARW: every raw.pixls.us body on main (100 bodies, 116 CC0 files): decoder bugs and issue triage #535

Open

Description

@AlexChambers

Summary

I ran every Sony body on raw.pixls.us through main at 65ad290. That's 116 CC0 files covering all 100 bodies, with every coding for the bodies named in open issues. For each file I recorded decode facts, checking black and white levels, crop and as-shot white balance against exiftool and the data itself. I also rendered each at 1200 px and compared it with its embedded camera JPEG (CIE76 ΔE, ΔL*, Δa*, Δb*, chroma ratio), noting whether the camera-look fit was accepted. This is part of LR-IMP-CAMERA-COVERAGE.

Overall:

  • 87 bodies decode, 12 open as the embedded preview only, and one decodes to noise.
  • 81 of the 87 decoded bodies get an accepted camera-look fit (99 of 105 files). Accepted fits have a median ΔE of 5.1 against the camera JPEG, ΔL* +0.2 and a chroma ratio of 0.97.
  • When a fit is rejected, the neutral fallback is dark and grey: median ΔE 18.5, ΔL* −11, chroma 0.39. On newer bodies it is also strongly blue (Δb* −23 on the ILCE-7RM5, −14 on the ILCE-7M4 and ILCE-7C). That explains many "wrong colours" reports where a fit failed.

Open Sony issues on current main

Issue Result on the public samples
#190 / #305 green (ILCE-6000, ILCE-7M2, ILCE-6500) Doesn't reproduce: all 6 fits accepted, ΔE 2.1–5.8, |Δa*| ≤ 0.4. The reports predate v0.4.0's white-balance reading and camera-look fit. Green can still happen through the white-balance bugs below.
#244 ILCE-7M3 magenta, too bright Doesn't reproduce on the reporter's own attached file (ΔE 3.4, Δa* +0.3, ΔL* +0.9). The attached a6400 file renders lifted and flat (ΔE 15.5, fit accepted at 0.098 against a 0.10 limit); #499 brings it to 12.4.
#378 ILCE-7C purple light; ILCE-7RM5 blue cast Can't test purple light: no public sample has it. The blue cast doesn't reproduce while the fit is accepted (7RM5 ΔE 2.9–3.3). The fallback on these bodies is strongly blue, which would match the report if those photos' fits were rejected.
#454 ILCE-7 posterised Mild on the public sample. Strong on the ILCE-1 sample (13 flat tone-curve knots). 33 of 99 accepted Sony fits have flat knots; #499 removes all of them.
#515 low resolution Doesn't reproduce for the ILCE-7RM4A (full 9504×6336). Low resolution is real for the 12 preview-only bodies below and for lossless M/S raws, which are smaller by design.
#461 DSLR-A200 No longer garbage: A200–A390 open as previews. Real decoding is still open.

Decoder bugs found (crates/raw/src/vendor/arw.rs)

  1. As-shot white balance:
    • 14 bodies have none, so they render green whenever the fit fails: A450, A500, A550, A560, A580, A700, NEX-3, NEX-5, NEX-C3, SLT-A33, SLT-A35, SLT-A55, ILCE-6001, UMC-R10C.
    • On several others the gains read from the maker note's Tag2010 match the camera's auto-WB estimate, not the white balance it applied. Estimating the applied gains from pixels the camera JPEG renders neutral sides with SR2 WB_RGGBLevels every time. Examples: ILCE-3500 on a 5600 K preset, R −31 % and B +101 %; SLT-A57 −25 % / +26 %; ILCE-7S on Shade −9 % / +15 %; also NEX-6, RX10M2 and ILCE-5000.
  2. SR2 black level read from the wrong place for two layouts: 354–365 on the A450, A500 and A550, and 975 on the A700, where the file says 512 and the data floor is 528–544. The A700 renders crushed (ΔE 20, ΔL* −10) even with an accepted fit.
  3. Lossless M/S raws: the pedestal is about 1024, but 512 is subtracted. Against the same scene shot full size, the 7RM5 M measures 1.007·L + 1021. The result is lifted shadows, about 3 % of white, currently hidden by the fit.
  4. In-camera 16:9 crop not applied on the ILCE-7SM2 and A580. The render stays 3:2 against a 16:9 JPEG, so no fit is attempted (ΔE 15 and 27). The 7SM2 also keeps 32 padding columns.
  5. DSC-R1 SR2 decodes as noise, a white frame. Correction: the data isn't encrypted; its 16-bit words are big-endian inside the little-endian TIFF (found by @radialmonster, see LR-IMP-CAMERA-COVERAGE: Sony 16:9 crop on pre-crop-tag bodies #580). Read that way it decodes cleanly, and radialmonster's LR-IMP-FORMATS: Sony DSC-R1 .SR2 decodes (big-endian 16-bit words in a little-endian TIFF) #640 decodes it.
  6. A850 / A900 are refused but look like plain 12-bit packed data (1.5 bytes per pixel). Not tried.
  7. Crop origin is 8–32 px left of DefaultCropOrigin on the 7RM3 and 7RM4/4A. Cosmetic: those columns are real image.

Colour-fit observations (crates/engine/src/camera_preview.rs)

Preview-only bodies (expected for now): A100, A200, A230, A290, A300, A330, A350, A380, A390, A850, A900, F828.

I'm working on fixes for 2–5 and will link them here. The per-body table and scripts are available if useful.

Activity

  1. QuirkyTurtle94 commented on Oct 9, 2026

    @QuirkyTurtle94
    Contributor

    this is seriously impressive, thanks!

  2. radialmonster commented on Oct 9, 2026

    @radialmonster
    Contributor

    TL;DR: great sweep, thank you. Two things link up with it: #528 changes one of your rejected cases, and I'd like to take item 6 (A850/A900) so we don't both work on it.

  3. QuirkyTurtle94 commented on Oct 9, 2026

    @QuirkyTurtle94
    Contributor
    Image

    Adding some ILCE-7RM4A (A7R IVA) results from my own archive, investigated with Codex. These support the rejected-fit/neutral-fallback explanation, but the profile is not an across-the-board improvement.

    Build and method

    • Apple M1/macOS; LightCraft main 65ad290 plus LR-PROF-CAMERACOLOR: calibrate rejected every ILCE-7RM4 file (camera JPEG proxy a pixel short) #531's camera-preview sizing fix (matching fba436a). No LR-PROF-CAMERACOLOR: fit the starting tone curve by quantile matching (no flat steps), old fit as fallback #499 or LR-PROF-CAMERACOLOR: fit the camera look without clipped sensor pixels #528 changes in this experiment.
    • Used lightcraft-cli calibrate --max 0 --out <isolated-directory> <training-files...> to build a profile for ILCE-7RM4A, rather than reusing an ILCE-7RM4 or ILCE-7CR profile.
    • Selected 225 RAWs across 15 archive folders, stratified by folder/lens and spaced through sorted filenames. Both FE 24–105mm F4 G OSS and FE 200–600mm F5.6–6.3 G OSS were represented. Three entire folders were held out from training.
    • 215 training files were accepted, yielding 783,059 colour pairs and an ILCE-7RM4A.json profile with a matrix and hue/saturation table.
    • Compared baseline/candidate in separate CLI processes using an empty LIGHTCRAFT_CAMERA_PROFILES directory versus the candidate directory. Validation RAW copies had no XMP sidecars. Originals were not edited; paired-validation originals were SHA-256 checked unchanged.
    • Rendered at 1200px long edge and compared against the oriented embedded camera JPEG on common 200px thumbnails, using mean per-pixel CIE76 ΔE (D65). These numbers are not directly comparable with the CIEDE2000 values in the comment above. They also include tone/framing differences, not just hue accuracy.

    Results

    Test Baseline With profile
    24 held-out photos: average of per-image mean ΔE 5.00 4.94
    Same 24: median of per-image mean ΔE 4.67 4.80
    Separately found rejected-fit photo: mean ΔE 14.79 3.20

    All of the first 24 already had accepted per-photo fits. The profile improved 16 and worsened 8; the largest regression was about +0.83 ΔE, so I haven't installed it as my default.

    I then screened another 78 photos from the held-out folders and found one without an accepted per-photo fit. On a fresh 1200px comparison, the profile changed that file from rejected to accepted, and the dark/muted rendering became much closer to the camera JPEG (14.79 → 3.20). That file is Sony compressed ARW, Standard Creative Style, Auto WB, sRGB. It was not in the training set. This is a targeted failure-case result, not a claim about the failure rate of my entire archive.

    Limits / coordination
    This is a local camera-JPEG-look profile experiment, not measured colour calibration or Lightroom parity. It doesn't explain my earlier “looked better after Lightroom” observation, resolve XMP white-balance/tone interoperability, or establish a resolution fix. I haven't compared this profile with #499/#528 yet, and Sony Imaging Edge reference exports are still pending. I'm not taking ownership of the decoder items already being worked on here. No private photos are attached or uploaded.

  4. AlexChambers commented on Oct 9, 2026

    @AlexChambers
    ContributorAuthor

    @radialmonster I hadn't started item 6, so it's yours. Thanks, and nice result on the HX95 with #528.

    Status of the rest: items 2 and 3 (SR2 black levels and the lossless M/S pedestal) are in #542. Item 1 (as-shot white balance) builds on #542's SR2 decoding, and items 4 and 5 are next; I'll link them here as they open.

    @QuirkyTurtle94 thanks for the ILCE-7RM4A numbers. They match what I saw with an ILCE-7CR profile (#526): about neutral on photos whose own fit was accepted, and a big win on the ones that fell back.

  5. radialmonster commented on Oct 9, 2026

    @radialmonster
    Contributor

    Item 6 (A850 / A900): checked, and you were right. The A900 sample is plain packed 12-bit data: the single strip is exactly width x height x 1.5 bytes (6080 x 4048 x 1.5 = 36 917 760, ending at the end of the file), two pixels per three bytes, least-significant-bit first. That order is about 12 times smoother between same-colour neighbours than the other orders, the colour layout is RGGB (checked against the embedded camera JPEG), and black is 128 on the 12-bit scale. It renders with natural colour and framing next to the camera JPEG, and in a render of all 199 Sony files in our archive only the A900 changes.

    Two caveats: the archive has no A850 file, so nothing is measured for it (a file that follows the same size rule would decode, but I can't say it does). And the sample has no clipped highlights, so the white level and the exact crop origin rest on one frame. If you have an A850 file, or an A900 one with bright highlights, that would settle both. The change is #573.

  6. AlexChambers commented on Oct 9, 2026

    @AlexChambers
    ContributorAuthor

    Item 1 (as-shot white balance) is up as #575, stacked on #542 (items 2 and 3). The 14 bodies without white balance now read the gains the camera applied from the SR2 block, and over-10% errors drop from 5 to 0 against neutral areas of the camera JPEG. #575 also replaces #542's position tables with one SR2 decryptor. Items 4 and 5 are next.

  7. AlexChambers commented on Oct 9, 2026

    @AlexChambers
    ContributorAuthor

    Items 4 and 5 are up as #580. The ILCE-7SM2 and DSLR-A580 now take their in-camera 16:9 crop, so their camera-look fit runs again (ΔE 15.2 → 4.8 and 26.7 → 3.9 against the camera JPEG). The DSC-R1 SR2 is refused, so it opens preview-only with a reason instead of as noise. With #542, #575 and radialmonster's item 6, that covers everything on the list except the cosmetic item 7.

  8. AlexChambers commented on Oct 10, 2026

    @AlexChambers
    ContributorAuthor

    Status after integration batches 22 and 23. Thanks, @echelon and @radialmonster.

    Item Status
    1. As-shot white balance merged (#575)
    2. SR2 black levels merged (#542)
    3. Lossless M/S pedestal merged (#542)
    4. In-camera 16:9 crop merged (#580)
    5. DSC-R1 SR2 merged (#640, radialmonster)
    6. A850/A900 open (#573, radialmonster)
    7. Crop origin a few px off on the 7RM3/7RM4 open, cosmetic
    Rejected fits falling back to dark grey merged (#583 and #528, radialmonster)
    Flat tone steps merged (#499)
    DRO brightening merged (#568)

    Still open beyond the table: single-hue scenes passing with collapsed colour separation (the ILCE-1 sample), and #631, three ILCE-7RM4 frames that never reach the fit, which I'm tracing now. I'll leave this open until #573 lands.

  9. radialmonster commented on Oct 10, 2026

    @radialmonster
    Contributor

    DSC-R1: #689 reads its SR2SubIFD (other key), giving black 512.5, WB [1.953, 1, 1.504] and crop 3888×2592 at (16, 8).

  10. QuirkyTurtle94 commented on Oct 10, 2026

    @QuirkyTurtle94
    Contributor

    I've completed a broader comparison using 64 of my Sony A7R IVA (ILCE-7RM4A) RAWs against Sony Imaging Edge Edit 4.1.00.03062. I think there are three overlapping effects here, rather than a single missing-dynamic-range bug.

    The set has 30 FE 24–105mm F4 files and 34 FE 200–600mm F5.6–6.3 files, ISO 250–12800. These are selected files from three folders, including related frames and a known failure, so this is not a random sample or evidence about every Sony body. Private family photos are included only in anonymous measurements and will not be shared.

    1. A reproducible partial-fit colour problem

    One lion frame (anonymous ID R024) accepts a tone-only camera look. Diagnostic logging explains why:

    • Full fit: 128 coloured samples out of 6,115 usable pairs; the 5% gate requires 305.
    • Edge-filtered attempt: 105/5,817, requiring 290.
    • Partial fit at the lower chroma threshold succeeds: 4,637/6,115.
    • Partial held-out RMS improves 0.12182→0.02327, but the accepted colour matrix is identity, no hue/saturation table is present, and the attempted chroma curve is rejected because held-out error worsens.

    So “fit accepted” does not mean a meaningful colour model was recovered. With Sony DRO disabled, this frame's aligned mean lightness difference is only −0.35 L*, but LightCraft/Sony mean C* is 0.416. The pooled experimental profile raises that to 0.735, with similar lightness. This is more specific than an exposure mismatch.

    There is an interesting fallback interaction: starting_colour_with accepts any successful JPEG-derived look before consulting spectral calibration. spectral_table.rs already maps ILCE-7RM4A to ILCE-7RM4, but the accepted partial look bypasses it. That precedence is intentional and tested. A possible experiment is calibrated camera colour plus a newly fitted tone when the partial look cannot constrain colour, while preserving successful full fits. I would not simply loosen the colour-sample guard or swap the matrix under an existing fitted tone.

    Source: starting-colour precedence, sample guard, partial fit, camera alias.

    2. The Sony default-tone comparison has a deliberate mismatch

    All 64 files have DRO Auto metadata, and all 64 LightCraft logs report DRO tone replaced true. LightCraft intentionally lowers the fitted tone towards its pooled Sony DRO-off curve; Sony Edit's default reference still applies DRO Auto. That accounts for part of the darker appearance and should not automatically be called a decoder defect.

    I therefore also exported 8 Sony DRO-off controls. The R024 example above still has weak colour after removing the tone mismatch. The other controls also show that turning DRO off reduces the lightness gap without universally removing colour differences. Sony Edit and the embedded camera JPEG are different targets too.

    3. Highlight/shadow editing is a separate local-contrast issue

    I locally tested existing #645 at d4e3ebc on three of these files. V1 neutral, Highlights −100, Shadows +100 and combined-recovery controls are byte-identical to the baseline; V2 neutral is unchanged. Under strong edits, the proposed V2 path retains more local detail:

    File Edit / region V1 relative detail V2 Change
    R008 Highlights −100 / bright 0.10406 0.12133 +16.6%
    R019 Highlights −100 / bright 0.05185 0.05545 +6.9%
    R024 Shadows +100 / dark 0.40460 0.44396 +9.7%
    R008 Shadows +100 / dark 0.66369 0.69809 +5.2%
    R019 Shadows +100 / dark 0.81175 0.88505 +9.0%

    This metric is standard deviation of a 9×9 high-pass of linear luminance divided by region mean, with fixed baseline masks, at 1600px. It includes edges/noise; it is not a measure of recovered sensor dynamic range. These are local spot-checks, not full CI or GPU validation. They support the existing PR rather than another implementation.

    Broader results and controls

    All 64 pairs pass similarity alignment. Central 84% measurements against Sony Auto:

    Metric Current baseline Experimental pooled profile
    Mean ΔE76 4.33 4.05
    Mean ΔL* (LC−Sony) -2.88 -2.70
    Mean C* ratio (LC/Sony) 0.853 0.865

    The candidate has lower ΔE76 on 52/64 files and higher on 12. It was trained on 225 other files with no file overlap, although related scenes limit independence. Baseline 63/64 full fits + 1 partial become 64/64 full with the candidate. This is a modest, uneven improvement, not a universal profile fix. It is only supplied to isolated test processes, not installed globally.

    I also tested 30 LightCraft slider variations on 6 files, 3 Sony exposure controls with DRO Off, and one native 9504×6336 pair. Basic exposure response is substantial and often close in median luminance: R024 at +2EV is 0.690 LC versus 0.722 Sony, R012 is 0.920 versus 0.908. R008 at −2EV is 0.076 versus 0.075, but its rendered 90/10 spread differs. Similar medians do not prove equal highlight recovery. Contrast +100 increases R024's rendered 90/10 spread from 1.86 to 2.51 stops; that is a display statistic, not sensor DR.

    The native LightCraft log explicitly records a 9504×6336 RAW source, and the native crops contain fine detail. This does not test the 100% GUI preview path in #515; that still needs a separate reproduction.

    How this relates to existing work

    I'd suggest coordinating the narrow partial-fit fallback experiment with the existing camera-colour work, contributing these checks to #645, and reproducing the GUI preview complaint separately. Any deliberate render change should follow the repository's process-version and regression rules.

    Reproduction and limits

    Baseline: upstream b70ae174 plus the #695 lens aspect guard at 9682caae, CPU pipeline, reset edits, preferences disabled. Sony exports: 16-bit sRGB TIFF 1600×1067, camera WB/Standard, zero exposure/contrast/saturation, DRO Auto except labelled controls. Distortion settings are matched where available (24–105 Auto, 200–600 Off), then similarity registration and a central crop are used. Sony noise reduction, sharpening, vignetting and CA correction remain confounds. All originals and copies pass SHA-256 verification.

    ΔE is CIE76, not ΔE2000 or calibrated colour accuracy. No Lightroom reference exports or colour chart were used. The rendered histogram/percentile measurements do not establish sensor dynamic range or Lightroom parity. The accompanying report contains 49 non-portrait triptychs, controls, native crops and anonymous per-file CSVs; it excludes RAWs, family images and private metadata.

    Follow-up implementation: #732 is now open for review. It lets an accepted identity-matrix partial look try the existing measured spectral calibration, refitting tone/chroma and retaining the old partial unless the candidate passes the normal fit gates and improves held-out encoded error without increasing linear error. All 63 full-fit renders in this 64-file set and all 103 public corpus renders remain byte-identical. The affected lion frame's chroma ratio against Sony DRO Off rises from 0.416 to 0.726; CIE76 falls from 2.62 to 2.20. Against the embedded JPEG, CIE76 instead rises from 1.72 to 1.83, so this is a limited improvement with an explicit reference/metric tradeoff, not a universal colour match. All eight cargo xtask ci stages passed. The earlier pooled-profile image below remains labelled as that separate experiment. #699 and #645 remain outside the implementation.

    Comparison images

    These are metadata-stripped wildlife comparisons. No baby, family or other portrait photographs are attached.

    R024: Sony DRO Auto / Sony DRO Off / LightCraft baseline (left to right). Removing DRO reduces the tone mismatch, but the muted LightCraft colour remains.

    R024 lion: Sony DRO Auto, Sony DRO Off, and LightCraft baseline

    R024: Sony DRO Auto / LightCraft baseline / experimental pooled profile. The right-hand image uses the earlier profile trained on separate photos. It is not the measured-spectral fallback fix currently being tested.

    R024 lion: Sony default, LightCraft baseline, and earlier experimental pooled profile

    R008: Highlights −100, PR #645 V1 / V2. This cheetah comparison illustrates the separate local-contrast work described above, with the same edit applied to each process version. It is not evidence of extra sensor dynamic range.

    R008 cheetah: Highlights minus 100 with PR 645 V1 and V2

  11. added a commit that references this issue on Oct 26, 2026
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