New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Color balance module : add the ASC CDL mode #1734
Color balance module : add the ASC CDL mode #1734
Conversation
Warning : with DNG files, changing the main power value gives either a green or a magenta color cast. Tested with NEF, RAF, ARW and CR2 files, it works as expected. |
DNG files work now as expected. I have added the fulcrum contrast and master saturation options. In the pure C variant, just enabling the module gives an unexpected exposure boost. Something is wrong with the Lab <-> ProphotoRGB conversion in C, I can't find what. (I have checked the conversion matrices from 3 sources). Using sRGB fixes the problem for the pure C version (I suspect the gamma conversion does the trick). SSE and OpenCL versions behave as expected with Prophoto RGB conversion and everything. I have done a bit of lib refactoring. I think rewriting the SSE and OpenCL color conversions as native dot products would give a boost in performance at some point. |
Good job Aurélien. I'm probably not the right person to merge this PR, but it looks good to me and works as expected. I expect houz or hanatos to have a deeper look. Thanks. |
Thanks Pascal ! If you compile my master branch, you will get it along with the Log unbreak profile, and both together work really well to recover high dynamic range images. |
I have added HSL sliders in addition to the RGB ones, as I requested here https://redmine.darktable.org/issues/11959. This doesn't change the data structure (parameters are still RGB). Editing RGB sliders updates HSL ones, and the other way around. I still have a problem of slight magenta shift with the SSE ProphotoRGB conversion, OpenCL and pure C behave as expected. I have rewritten SSE color conversion function in algebraic notation instead of SSE intrinsics to improve readability. |
I've playing with this as well, very nice! Results are very good and is very easy to get them. |
You mean on the text label ?
Like a master hue setting ? |
Maybe add a combo with lift/gamma/gain/(all) so it doesn't take so much
space on the UI?
You mean on the text label ?
I mean to add a combo box with those entries that show/hide each group (or
all of them if (all) is selected)
Also, is it possible to have a new group for the entire range (not only
shadows/highlights/midtones)?
Like a master hue setting ?
Exactly. It can be added to the combo box above, maybe as a default.
|
I still don't understand 😁 You want to selectively enable/disable the RGB set of sliders and the HSL ones ?
The problem with that is it would change the maths behind and lose the compatibility with the ACL Color Decision List standard. Technically-speaking, the slope is sort of the master (it's the linear factor), and the first parameter you should set in your workflow. Then, you can come back a bit on it by setting the offset, which, again applies to the whole range but, numerically, weighs more on the low-lights. And as the last step, you fix the power. That's why the mode is called slope/offset/power, in the order you are supposed to adjust the settings. |
I mean to add a combo box with those entries that show/hide each group (or
all of them if (all) is selected)
I still don't understand 😁 You want to selectively enable/disable the
RGB set of sliders and the HSL ones ?
Not disable but hide it, kind of what the channel mixer does, but with the
option of displaying them all. But if you're not going to add the master
hue, I can live with all the sliders visible, they fit in my screen anyway.
… |
I have added neutralization color-pickers on each hue slider. The idea is to select a color that should be neutral (grey) and compute the right parameters in the color balance to invert its current hue and neutralize it. The saturation is not always on point though. It's still useful to remove indesirable color casts, due to several lighting sources at different color temperature. |
Another improvement here : I have bounded the RGB sliders and corrected them according to the luminance. Now, when you edit a RGB channel, the 2 others are updated so that the luminance is not affected. So, the RGB channels control only the saturation and hue, making them fully independant from the factor (which is a luma correction). I think that's pretty cool. |
You need to remove the rawspeed submodule from here. I think also that it should be better to rebase all this and maybe even squash all the commits together at this stage. No need to see all the "fix" steps now. |
Isn't rawspeed listed in the gitignore that it keeps showing up in the commits ? I will fix that, maybe add color-pickers for lift and gain factors, and I think we wil be good. |
Ok, let me know when ready. We are approaching the code freeze I suppose. So if we want this in the next release (and I think it would be really nice) I need to review and merge soon. Thanks. |
c080d40
to
172d799
Compare
Add an optimizer for luma values Use the luma correction in the color neutralization optimization for better accuracy Refactor some code Add comments Disable the luma normalization for RGB sliders in lift/gamma/gain mode to let it as is.
Add an optimizer for luma values Use the luma correction in the color neutralization optimization for better accuracy Refactor some code Add comments Disable the luma normalization for RGB sliders in lift/gamma/gain mode to let it as is.
ce9cedc
to
6f6755a
Compare
I think it's clean ? So, last changes:
Screenshots: Directions to test:
Note that the color-pickers are designed for the slope/offset/power version, as well as the HSL -> RGB conversion and the RGB luma normalization. But they still work fairly for lift/gamma/gain. You will notice that if you try RGB -> HSL -> RGB' conversions on the sliders, for primaries, you will always have an error : RGB = RGB' ± 0.005. That's expected, due to the conversion of color shiftts between a cylindric and a cartesian vectorial space. However, ping me if you get errors >= 0.01, it shouldn't happen. Enjoy ! |
One issue found:
|
Another one:
Is that expected? Maybe a wrong procedure on my side? |
The first issue is a real issue. For the second, you need to click once on the color picker, draw the area, then click again on the color picker icon to validate the color. |
Seems like the crash is fixed. Cannot reproduce, same on your side now? |
It depends how I build. With cmake, it seems to work. With build.sh, it fails sometimes. |
still outputs, when closing :
|
945bd81
to
90272de
Compare
And related to OpenCL, I cannot reproduce with standard code path. |
aa3d8a0
to
8d56564
Compare
8d56564
to
c9a991e
Compare
So it was because I had
in darktablerc. Seems to work now. |
And when I replace colorbalance_cdl() implementation with a simple call to colorbalance (in extended.cl) I don't have the crash (the image is not correct of course). So it looks like the issue is in the CL code in colorbalance_cdl(). Now I'm far from expert in OpenCL :( |
I don't understand : what crash do you get with colorbalance_cdl() OpenCL ? Both versions work with no error on my side, with the last commit. |
When I'm leaving dt I get segmentation violation ini different part of the application (not always the same). This seems to indicate that there is some memory corruption somewhere. |
@TurboGit I have commented out the faulty lines that store the current color into the private data structure, like that:
Can you confirm everything works that way so that we ensure these are the true offenders ? |
I think I have found it. The private data structure But thanks to the barely-commented and non-documented sourcecode of dt, I have not found how to access the pixelpipe from the module structure. |
Ok, no more crashes! And indeed valgrind (I run a session last night, very very slow under valgrind!) told me that d->luma_patches_flags[GAIN] = 1; was writing 4 bytes out of bound! So you've found the offenders :) |
No more crashes but I cannot run the optimizer. |
That only took 18h 🙄
that's normal, it's disabled for debugging. I still need to figure out how to reach the pipe data from the module. |
Ok, now I store the data in |
Yes, all good now! Thanks. |
May I point that this can break backwards compatibility?
https://github.com/darktable-org/darktable/pull/1734/files#diff-66d4f98e149ad915383f3c1cd14d7a46R213
El mar., 16 oct. 2018 a las 10:45, Pascal Obry (<notifications@github.com>)
escribió:
… Merged #1734 <#1734> into
master.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1734 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/APq1pT90fhLTUPbWT9MvH1tFqK6GLhEiks5uleL0gaJpZM4W1fED>
.
|
As Blender and many video editors, add a color balance mode based on the ASC color decision list https://en.wikipedia.org/wiki/Color_Decision_List
This allows to color-grade in linear ProPhoto RGB space, whereas the previous version was in gamma-corrected sRGB and led to saturation issues.
The previous mode is retained as an option. The legacy params are imported. The OpenCL and SSE2 versions are provided and working (as far as I tested).