fix(color): use the sRGB exponent when linearising linear-raw files - #1633
Open
pluja wants to merge 1 commit into
Open
fix(color): use the sRGB exponent when linearising linear-raw files#1633pluja wants to merge 1 commit into
pluja wants to merge 1 commit into
Conversation
The inverse sRGB transfer function raises to 2.4, not 3.0, so LinearRaw files were being decoded with a curve far darker than the one their data was encoded with.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
srgb_to_linearinsrc-tauri/src/raw_processing.rsraises to the power of 3.0. The inverse sRGB transfer function uses 2.4:sRGB is: a linear segment below 0.04045 and this power curve above it. The two have to meet at that threshold. With 2.4 they do. With 3.0 the curve jumps 76% at the join. The constants already in the function (0.055, 1.055, 12.92, 0.04045) come from the sRGB definition and only produce a continuous curve with exponent 2.4.
The rest of the codebase already uses 2.4. Same formula, same constants:
src-tauri/src/image_loader.rs:60src-tauri/src/image_processing.rs:1215Only
raw_processing.rsdiffers.This only affects files where
is_linear_raw_format()is true (RawPhotometricInterpretation::LinearRaw) andapply_ungammais set, so thegammaandgamma_skip_calibvalues of thelinear_raw_modesetting. Bayer and X-Trans files never reach this branch.Type of Change
Changes Made
One line in
src-tauri/src/raw_processing.rs:Screenshots/Videos
Not applicable, no UI change.
Testing
cargo check --no-default-features --all-targetspasses with no new warnings.I could not verify this against a real LinearRaw file, since I do not have one. The change is a correction to a published constant rather than a behavioural guess, but someone with a LinearRaw source should confirm it before merging.
Test Configuration:
Checklist
AI Disclaimer:
Please state the involvement of AI in this PR:
Claude found the incorrect exponent and made the change. I reviewed it, verified it builds, and am submitting it.