Repository navigation
Conversation
|
Did you intend to include cmixer_orig.c.txt in the PR? |
See the end of the description:
|
6631dc3 to
be0ad7a
Compare
|
@ralfbrown : extra files removed, thank for your patience |
ce74cf6 to
daae18d
Compare
daae18d to
5474b61
Compare
|
A first complete code reading and remembering your comments before; generally i think this is a minor but very good improvement and will certainly help with some issues. Also it make the intention more clear and fixes some common misunderstandings. I spotted some places like this: Could you explain if/why this is nevessary or is it just code-style? |
|
The key is the line: correction[k] = chr->D65coeffs[k] / chr->wb_coeffs[k];This used to be something like (below is one concrete example): chr->D65coeffs[0] / chr->as_shot[0]The new denominator comes from typedef struct dt_iop_temperature_params_t
{
float red; // $MIN: 0.0 $MAX: 8.0
float green; // $MIN: 0.0 $MAX: 8.0
float blue; // $MIN: 0.0 $MAX: 8.0
float various; // $MIN: 0.0 $MAX: 8.0
int preset;
} dt_iop_temperature_params_t;One option would be to restrict the values to If I misunderstood the question, please let me know. |
5474b61 to
6d612e0
Compare
fa618ac to
6156826
Compare
152cb16 to
b529102
Compare
b529102 to
994a97c
Compare
994a97c to
5217b8c
Compare
217d52f to
3e8cb65
Compare
|
Any updates? There have been no new commits for a while, just resolving conflicts. |
|
@kofa73 : This gets under the radar and I had many things to do for the AI integration. The discussion on pixl.us was difficult and my motivation was quite down for some time... I'm still a simple human :) I'll get back to this for 5.6. |
…h left-over gui->reset to DT_ENTER|LEAVE_GUI_UPDATE
…rity), no need to allocate + copy xy in illuminants.h find_illuminant_xy_from_wb_coeffs; no need for 0 check after isnormal
…ore opposed), so already part of hash
… fields are the multipliers, aliased and set to 1 via dcoeffs, which matches the values used in the daylights declaration -> no-op; we won't crash
…erature.c reload_defaults
…abled; the previous "(cat != NULL) && cat->enabled" check did not know anything about what channelmixerrgb.c was doing.
- added a white balance GUI proxy, so color calibration's GUI gets the white balance from temperature's current params. Before, it read dev->chroma.wb, which holds stale values until the next commit and which a pipe thread may rewrite during the read - _update_preset() no longer writes dev->chroma.wb.late_correction - the white balance and color calibration dev-doc page and Module_Lifecycle.md now describe the proxy
In "as set in white balance module" mode, a failed lookup (for example a coefficient of 0) kept the illuminant stored at commit time, which depends on history order. Identical settings could render differently. Now every consumer uses D50 through _illuminant_xy_from_wb_or_D50(). illuminant_to_xy() loses the wb_coeffs parameter added on this branch. Details are in dev-doc/iop/wb_and_colorcalibration/README.md.
499cc94 to
07ea771
Compare
The camera illuminant's CCT and swatch stayed stale after WB edits. This bug predates the white balance and color calibration rework.
…er applied late correction even with white balance turned off
reload_defaults() sets the late_correction default per image, but the toggle's reset value was only set once, in gui_init(). After switching images in darkroom, double-clicking "prepare data for color calibration" restored the previous image's default.
…iers Extreme WB multipliers may result in zero or negative x, y, z or CAT16 cone response. find_illuminant_xy_from_wb_coeffs() now treats such an illuminant as a failed lookup
…r image or applying it via style/preset
Since "color calibration: reject illuminants derived from extreme WB multipliers", the "as shot in camera" illuminant lookup fails for an extreme manual white balance with late correction off. process() and process_cl() repeated the lookup with the pipe's white balance, but replaced the illuminant only when the lookup succeeded. After a failed lookup, the piece kept the illuminant of the last white balance that worked. That illuminant is not saved: the params hold the one computed when "as shot in camera" was selected, and an export or a reopened edit uses that, so the darkroom could show a different result. This commit extracts the block that process() and process_cl() duplicated, which derives the illuminant from the white balance, into _get_pipe_illuminant(). The helper writes a local variable instead of the piece data. The fix is in its else branch: after a failed lookup, it uses the illuminant from the saved x and y. commit_params() now keeps those for "as shot in camera" instead of running its own lookup. Edits on images where the lookup always fails, because they lack usable as-shot multipliers or a color matrix (such as HDR DNGs created by darktable before 3.6), render as before.
"camera reference" ignores late correction and hides the "prepare data for color calibration" checkbox. gui_update() overwrote the saved mode when the coefficients matched the as-shot or the reference ones. On a raw without EXIF white balance, as shot equals the reference, so a saved "camera reference" became "as shot" and the checkbox appeared. A saved "camera reference" with pasted coefficients could become "user modified", so its stored late_correction value took effect. Both relabels reached the history with the next white balance edit. gui_update() now keeps a saved "camera reference", even when its coefficients differ from this image's reference. It infers "camera reference" from the coefficients only for legacy params without a saved mode, so a match no longer moves another saved mode into "camera reference".
07ea771 to
afd950a
Compare
|
Had the bots go through the remaining issues that were genuinely new on this branch; the remaining ones existed in some shape or form already on master. Since this is huge enough, I'd continue with them once (if) this gets merged. Thanks for your patience. |
Addresses #19873
What this would buy us:
Quoting 1c5df70, which introduced as-shot to reference - the excerpt below is about the use of reference (D65) multipliers:
Changes:
temperature.cto explicitly control thelate_correctionflag in 'user' / 'manual' modeslate_correctionis always off in 'camera reference' mode, always on in 'as-shot to reference')chr->as_shotwithchr->wb_coeffsinhighlights.c,colorin.c,opposed.candsegbased.cilluminants.h:DT_ILLUMINANT_FROM_WB, plus handling in conditionals, similar toDT_ILLUMINANT_CAMERA, but relying ondev->chroma->wb_coeffsfind_temperature_from_raw_coeffs:find_temperature_from_as_shot_coeffsfind_temperature_from_wb_coeffs, to allow directly using coefficients fromtemperature.c, instead of always going through ratios relative to the D65 valueswb_coeffstoilluminant_to_xyfor absolute coefficients fromtemperature.c; renamed paramcustom_wbtocorrection_ratiosto express what it represents; passed tofind_temperature_from_wb_coeffsinDT_ILLUMINANT_FROM_WBmodechannelmixerrgb.c:_dev_is_D65_chromano longer needsas_shotmultipliers inlate_correctionmode_get_white_balance_coeffto_get_d65_correction_ratiosfind_temperature_from_wb_coeffsto handleDT_ILLUMINANT_FROM_WBDraft for now, to allow discussion (and I haven't tested much, but wanted to make the changes visible to others;plus, I need to clean up some temp files)Open issues
These were found by the bots, I'll go through them, will take time.
Major
src/iop/temperature.c:1565— In the default scene-referred workflow,reload_defaults()leaveslate_correction = TRUEfor images without camera-matrix support (ordinary non-raw and HDR RGB input), so for a non-Lab input profile colorin's D65 correction (D65coeffs = {1,1,1,1}) exactly cancels manually enabled and adjusted white balance; monochrome raws are not affected becausehide_enable_buttonforcespiece->enabled = FALSEandcommit_paramsreturns before settingchr->late_correction.src/iop/temperature.c:1203—_update_preset()useschr->adaptation != NULLas a proxy for "color calibration is doing CAT", but channelmixerrgb registers itself unconditionally inreload_defaults, so leaving the D65 preset always switcheslate_correctionon and silently replaces the user's white balance with the camera reference when color calibration is disabled.src/iop/colorin.c:1201— The new arbitrary-WB correction paths read session-global WB state instead of the current pipe's coefficients, so concurrent pipe generations can render and cache colors using mismatched white balance.src/iop/hlreconstruct/opposed.c:236— The shared-state defect recorded above atsrc/iop/colorin.c:1201also exists in three highlight-reconstruction paths that this branchswitched from the per-image constant
chr->as_shotto the livechr->wb_coeffs; inopposed.cthe value derived from the racy read is additionally stored in a process-widestatic chrominance cache under a key built from the pipe's committed parameters, so one
mixed-generation run keeps being served until those parameters change.
src/iop/temperature.c:1223—_update_preset()passes theDtBauhausWidgettoggleg->check_late_correctionto theGtkToggleButtonAPI, an invalid GObject cast, so every call logs GLib/GTK criticals and the "prepare data for color calibration" checkbox keeps a stale state on preset transitions that changelate_correction, until the nextdt_iop_gui_update().Minor
To be investigated further
src/iop/channelmixerrgb.c:593— This branch redefined_dev_is_D65_chroma()to return TRUE forany
late_correctionstate, where the base version additionally requiredwb_coeffs == as_shot. As a result_get_d65_correction_ratios()now yields all-1.0 ratios inexactly the state this branch exists to enable — a manual white balance with
late_correctionon — so the "as set in camera" illuminant is derived from the unmodified EXIF as-shot
coefficients in
process(),process_cl(),reload_defaults()and the GUI, and thewb_applied_twicewarning can no longer fire. Whether 1.0 is the correct new value depends onwhat colorin normalises the data to -> not a bug: with late correction on, "as shot" and a manual WB render the same outside clipped areas (dE2000 mean 0.15); the "white balance applied twice" warning appears only with late correction off and WB not at camera reference