Skip to content

fix: crop Sony lossless M/S ARWs correctly (green borders) - #20

Merged
sheldonxxxx merged 1 commit into
sheldonxxxx:mainfrom
yojen7:fix/sony-lossless-ms-crop
Oct 8, 2026
Merged

sheldonxxxx merged 1 commit into
sheldonxxxx:mainfrom
yojen7:fix/sony-lossless-ms-crop

Conversation

@yojen7

@yojen7 yojen7 commented Oct 2, 2026

Copy link
Copy Markdown

Summary

Sony lossless compressed M/S ARWs come out with green bars on the right and bottom (CyberTimon#850, CyberTimon#1300). This fork has the same problem: it pins rawler at 934af4b, the same as upstream.

Cause: these files are 3-channel (cpp == 3, LinearRaw) and tile-padded, so RapidRAW drops the Demosaic step for them. The rawler fork's CropDefault then rescales the crop by intermediate width / active-area width, as if the active area had already been cropped. The crop gets stretched (ILCE-7CR S: 5120/4784, so 5085×3390 instead of 4752×3168) and takes in the tile padding, which renders green.

Fix: pin rawler via [patch] to the change from CyberTimon/RapidRAW-DngLab#7 (Kheil-Z, written for Canon mRAW/sRAW; same root cause). It only uses the active-area width when Demosaic actually ran. #7's branch is based on an older rawler than the 934af4b this fork pins, and pinning it directly would also revert 934af4b's unbounded-highlights change in raw.rs. So I cherry-picked its two commits, keeping Kheil-Z as author, onto 934af4b at yojen7/RapidRAW-DngLab@fe08395: a 6-line develop.rs change and nothing else. Cargo-only change: the [patch] in src-tauri/Cargo.toml and a one-line Cargo.lock update (valid with --locked). Drop it once #7 is merged upstream and rawler is bumped.

Testing (this branch, Linux x86_64, npm run tauri build -- --no-bundle, headless rapidraw-mcp export … --format tiff)

File Before After
Sony ILCE-7CR lossless compressed S (raw.pixls.us, CC0); DefaultCrop 4752×3168 @ (16,10) 5085×3390, green right/bottom 4752×3168, clean edges
Sony ILCE-1M2 lossless (3:2) (raw.pixls.us); DefaultCrop 4320×2880 @ (8,8) 4590×3060, green right/bottom 4320×2880, clean edges
Sony ILCE-7CM2 compressed 3:2 (control, CC0) 4608×3072 4608×3072, pixel-identical to before

The build left Cargo.lock unchanged after the one-line edit, and output is byte-identical to building directly against #7's branch head.

On upstream RapidRAW main with the same patch, our 20-raw regression corpus (Sony A7C II/A7CR in several modes, Canon CR3, Nikon, Fuji X-Trans, OM-1, Panasonic, phone DNGs) × 3 adjustment sets was pixel-identical apart from the ILCE-7CR S file. I didn't rerun the full corpus on this fork.

Hello 👋

I'm also building on RapidRAW with AI agents (Linux, Sony A7C II), and I've been following this fork: the MCP server and your Nonlocal denoise study are impressive. We've been working on overlapping things:

Would you be open to coordinating, e.g. sharing benchmark results and combining efforts, so we're not maintaining parallel forks? Issues are disabled here, so this PR seemed like the best way to say hi.

AI disclosure

Created by an AI agent (Claude Code); a human reviewed the change and results.

🤖 Generated with Claude Code

Pin rawler via [patch] to the default-crop fix from
CyberTimon/RapidRAW-DngLab#7 (Kheil-Z), rebased onto the currently pinned
rawler 934af4b so nothing else changes. Sony lossless M/S ARWs are 3-channel
and tile-padded; the crop was rescaled by the active-area width as if the
active area had been cropped, which stretched it over the padding
(CyberTimon#850, CyberTimon#1300).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@sheldonxxxx

Copy link
Copy Markdown
Owner

Sorry for the late reply! I didn’t get a notification for this PR and only noticed it when it appeared in ChatGPT’s suggested tasks.

Just to clarify, I haven’t run any formal benchmarks for Nonlocal denoise. I chose it after a few rounds of experimentation, comparing the results visually with the native denoising in upstream RapidRAW and darktable.

This fork is mostly a playground where I throw ideas at AI and see what we can build. But yes, I’d be happy to collaborate, share what I’ve tried, and compare notes. Thanks for reaching out—and for the fix!

@sheldonxxxx
sheldonxxxx merged commit d175e4d into sheldonxxxx:main Oct 8, 2026
13 checks passed
sheldonxxxx added a commit that referenced this pull request Oct 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants