Skip to content

craft-develop: keep warm-green white balance smooth - #4405

Open
radialmonster wants to merge 1 commit into
storytold:mainfrom
radialmonster:fix/warm-green-white-balance
Open

radialmonster wants to merge 1 commit into
storytold:mainfrom
radialmonster:fix/warm-green-white-balance

Conversation

@radialmonster

@radialmonster radialmonster commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Apps can keep warm, strongly green white-balance adjustments from jumping abruptly while leaving saved edits unchanged.

Follow-up to storytold/lightcraft#2527. At Tint +150 and the reported Canon EOS M6 As Shot settings, the pinned checked-white-balance path switches from the identity fallback to a much larger blue gain as temperature crosses 3800–4000 K. Bradford divides by the source cone response, so a near-zero response produces a large gain before the existing guard can reject it.

Add an opt-in shared matrix helper that holds the source at a small positive cone floor. Normal whites, camera-space rebalancing and the existing API are unchanged. LightCraft can adopt the opt-in with a new render process after a shared dependency update.

The new smooth_tint_avoids_the_warm_green_bradford_jump regression covers tint and temperature sweeps and exact preservation of an ordinary white. It fails with the old path and passes with the new one. Windows: 236 craft-develop unit tests passed, 12 ignored. Formatting passed. Strict Clippy reports the same three pre-existing warnings as the current base in colorops.rs and sensor/color.rs, and none in the changed file.

Summary by CodeRabbit

  • New Features
    • White-balance adjustments now support a smooth-tint option, helping warm and strongly tinted settings transition more gradually while keeping image gains stable.
    • Standard white-balance results remain consistent with the existing adjustment path.

@coderabbitai

coderabbitai Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The white-balance matrix API adds a smooth-tint path. It bounds the requested white before checked Bradford adaptation. The existing entry point retains its prior checked-versus-legacy behavior.

Changes: White-balance matrix behavior

Layer / File(s) Summary
Add bounded smooth-tint adaptation
crates/develop/src/local.rs
The new public function enables smooth-tint handling. The shared implementation preserves unchanged-white and camera-rebalance exits and luminance normalization. The new bound keeps Bradford cone responses above the specified floor, with fallback to Rec.2020 neutral for invalid inputs. A test checks ordinary whites and sampled warm, high-tint transitions.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Possibly related issues

  • Issue 778: The change covers the warm-green white-balance range noted in its shared RAW development work item.
  • Issue 587: The change addresses the described warm-green cone-floor and checked white-balance behavior. The issue’s LightCraft and PhotoCraft adoption work remains open.

Suggested reviewers: dylanmtaylor, dotcoocoo

Merge Risk: Minimal · up to 3cf31

This adds an opt-in white-balance path that avoids abrupt blue-gain jumps for warm, strongly green adjustments. Existing callers keep their current behavior, and no concrete defect was found, so the change looks safe to merge.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "craft-develop: keep warm-green white balance smooth" matches the main change. The PR adds an opt-in helper, wb_matrix_for_with_smooth_tint, that sets a cone floor to stop abrupt blue-gain j…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "craft-develop: keep warm-green white balance smooth" matches the main change. The PR adds an opt-in helper, wb_matrix_for_with_smooth_tint, that sets a cone floor to stop abrupt blue-gain jumps for warm, strongly green white-balance adjustments. The title names the affected crate, the white-balance area, and the smoothing goal. It does not mention that the change is opt-in, but it does not need to cover every detail.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between aa7e668 and 3cf313d.

Files selected for processing: 1

  • crates/develop/src/local.rs

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

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.

1 participant