-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
tone equalizer #1904
tone equalizer #1904
Conversation
ee2c591 to
9dd8541
Compare
|
Sounds very promising! |
|
Just tested, quite nice indeed. The transitions are "smoothed" and so the tonality are pleasant. Nice work. |
|
Thanks ! I have yet to squeeze in there either a laplacian pyramid or a wavelet decomposition to affect only the low frequencies, because I find it flattens a bit too much the local contrast. |
5e92b0a to
8e0f4ef
Compare
6ac38d7 to
43adfa6
Compare
|
Just tested and liked it :-) |
2b7743d to
1cc9443
Compare
Nice ! Soft bounds could quickely backfire. Given that each channel is separated from the others by 2 EV, pushing is beyond will move it to another channel, and the local contrast will suffer beyond repair. But, increasing the channels around a third one will have the same effect as pushing it beyond/over ± 2 EV while preserving details. I just stabilized the laplacian filter, I think it works great. There is only one scale for now, so the difference is only visible fully zoomed. |
|
Thanks for the answer :-) |
1cc9443 to
aa2a73d
Compare
|
Thanks a lot for this detailed explanation 👍 |
da16aaa to
ac01b85
Compare
|
I have an error dt_free_align(luma_in);It happens when using the laplacian mode with the power weighted norm (you can also see the thumbnail is wrong). I have spent 3h trying to troubleshot it, if someone has an idea ;-) |
|
@aurelienpierre |
No, that part was already an attempt to fix this problem, it arised before (and also freeing a pointer set to NULL is supposed to be harmless). |
|
Wanted to give it a try, for me it crashes in L.406: Can't tell you my parameters currently. |
src/iop/toneequal.c
Outdated
| #ifdef _OPENMP | ||
| #pragma omp parallel for schedule(static) | ||
| #endif | ||
| for(size_t k = 0; k < (size_t)ch * width * height; k += 4 * ch) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be k += ch...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I process 4 pixels at each loop step to vectorize the fmaxf(log2f(...)...) but, indeed, when the pixel number is not a multiple of 4, that could end out of bounds
|
Step one is to not merge code that doesn't pass CI, especially if it was a PR. Seriously. |
GCC will only issue a warning if |
I did not only merged but also fixed compilation issues on my side using clang-7. So better looking at what has been done before saying something wrong. |
|
Now this not compiling because my clang setup for building darktable is using v8 ! And so I did not catch the issues :( My bad. |
I can assure you it does not. I suspect you build without OpenMP there. |
No, that would be painfully slow and quite obvious. I just tested right now, it builds on Clang 8/Fedora and runs on-par with GCC 9 build. It seems @MStraeten is able to build on MacOS too. But Clang 7 is a princess. Same issue here : #2679 (comment) |
|
Maybe ! What is the error BTW? Where can I see the log? |
|
Then, what is the incantation to build with OpenMP with clang? |
|
Ok, found and I have reproduce the error. Next step is to fix. |
My bad, the log (https://travis-ci.org/darktable-org/darktable/jobs/588119877) says: But, that faulty pragma is supposed to get triggered only for GCC: so Clang defines
Just using |
|
No the error is: Looks like "omp simd" cannot be honored here. |
|
@aurelienpierre : the error you quote should be fixed on master... I don't see it after my patch before merging. |
|
@TurboGit what if you replace the loop in toneequal.c:764 by this one: |
|
Same error ! This does not work either with clang 8 & 9. If we disable openmp it is slow. |
|
I have disabled OpenMP for clang for toneequalizer. Not nice but this fixes the build issue and will let us time to come with a proper fix. To test on your side Aurélien, to build with clang-7 and OpenMP:
|
|
Not sure I can install Clang 7 on Fedora 30. Did you have issues with Clang > 7 ? This is going to be so slow for Mac users… |
|
Yes, same issue with clang 8 & 9. |
|
with OSX i didn't found issues with clang and openmp. (used XCode 10.3 and 11; build was 21.09.19 before merge of #1904) |
|
@MStraeten : maybe OpenMP was disabled? Can you show the config log? Also which clang version are you using? |
|
No OpenMP support means no vectorization and no parallelization. If the module runs in less than 2 s for a display preview, it's pretty sure both are enabled. I don't get why Clang 8 runs fine on my system. Isn't that just a warning treated as an error ? A pragma doesn't change the logic of the code, just how the preprocessor is supposed to do with it. There is no way to just bypass the warning ? |
|
@TurboGit -Wno-error=loop-vectorize might disable the error |
|
I'll double check ASAP. |
|
Why do you try to hide the error? |
|
because it makes the compilation crash completely for something that is not blocking |
|
No this option does not work. I still get the same issue. |
|
Found it @TurboGit ! In CMakeLists.txt: so warnings are turned into errors for any system but Apple, hence why @MStraeten could build with OpenMP and not care about simd fails. |
|
See #2977 for a solution. |
|
just in case you're still interested in the osx config here the current output of |
|
Thanks, so that's clang 11 and you indeed have OpenMP supported. |





introduce a new "tone equalizer " module, intended to allow selective exposure adjustements in linear RGB (supposed to be color-safe). This is very similar to Lightroom, with blacks/shadows/midtones/highlights/whites cursors.
The luminance channels are blended with gaussian masks and the modifications are applied on a gaussian pyramid to preserve the local contrast (luminance modified in low frequency layers).
For now, nothing is optimized (naive C implementation) and the module is expected to be slow. This is just a proof of concept. I will make it faster once the core algorithm is validated.