-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Filmic auto picker #1818
Filmic auto picker #1818
Conversation
I'm not 100% satisfied with these calls in "Just before starting the processing" is really when you want the picker-related code to be executed, otherwise you need to run the pixelpipe twice (once to get the color, and once to apply the autotune). I was hoping for a picker-specific callback right before |
I think this is the first time I see GUI code in process(). This must be avoided to me it is wrong to do that. |
In exposure() what is done is use a callback on the "draw" signal for the widget to get the picked color if I'm reading the code correctly. Can't this be done here? |
#1819 is essentially my first commit here. It doesn't introduce the calls in process(), but it doesn't solve the problem my second commit is trying to solve:
I'll try catching the "draw" signal. Unless I missed something this is at least conceptually wrong (although exposure is a proof that it can work): it's called when the widget is redrawn, we want to call it when the pixelpipe reaches the module. But at least, being consistent with exposure means we can refactor all modules the same way if we ever find a better way. |
After experimenting a bit, it seems that:
|
5dcd4e2
to
25876d1
Compare
I just force-pushed a version that should be OK:
I'm still not happy with putting the code in the Details in the commit messages. |
25876d1
to
fa99edc
Compare
There is a GUI issue on my side. Click on one picker, click again on the same picker. It says with an active state. |
src/iop/filmic.c
Outdated
@@ -1244,11 +1212,18 @@ void gui_init(dt_iop_module_t *self) | |||
gtk_widget_set_tooltip_text(g->security_factor, _("enlarge or shrink the computed dynamic range")); | |||
g_signal_connect(G_OBJECT(g->security_factor), "value-changed", G_CALLBACK(security_threshold_callback), self); | |||
|
|||
g->auto_button = gtk_button_new_with_label(_("auto tune source")); | |||
g->auto_button = dt_bauhaus_combobox_new(self); | |||
dt_bauhaus_widget_set_label(g->auto_button, NULL, _("auto tune globally")); |
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.
Please keep old string "auto tune source", sounds better.
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.
To me, it doesn't sound better. I don't understand what "auto tune source" was supposed to mean actually. I guess "source" means the source image, and the source image isn't autotuned. The parameters are.
Perhaps "auto tune grey/black/white", to make it explicit that the 3 parameters are considered together?
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.
Yes it means "tune source image". That's the way I understand it and the way Aurélien wrote it. To me it is clear. Maybe we can come up with something better: "auto tune levels" ?
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 like auto tune levels indeed. Shorter than my "auto tune grey/black/white" but means essentially the same thing.
BTW, isn't the callback just before process() the routine commit_params()? Would it work better to use this instead of draw()? |
I can't reproduce. I tried:
Both work for me. Can you give more details on what you did so that I can see what's going on? When you say "active", do you mean the picker is active (drag on image draws the rectangle) or just the icon is still white? |
Is there a documentation about all this somewhere? |
Not that I know. |
Experimentally, it seems |
Yes, that the picker stays white. I can reproduce on all pickers:
|
Before this, the callbacks to take the picked color into account were only called after releasing the mouse or on deactivation of the picker. This has several drawbacks: * This is inconsistant with the exposure module. * Nothing happens on first click. Sometimes, especially for the auto-tune, picking the whole image is sufficient, hence one may want to get the effect applied when clicking the picker, without even selecting an image area. Fix this by calling apply_picked_color within the pipeline when the picker is active. Once this "continous picking" is inplace, there is no need to apply anything anymore at the time the picker is disabled. This considerably simplifies the logic behind color_picker_callback. Also, there is now no need to call call_apply_picked_color() on mouse release (i.e. when the selection is done). The boolean apply_picked_color is removed, we use the special value picked_color_max = -INFINITY instead when the color picker should be ignored. The value is set to a positive value by the colorpicker library when we get a new value to process.
There would be a bad interaction between moving the slider and the active color picker: the user was able to move the slider but it was comming back immediately after when the picked color was taken into account.
fa99edc
to
aa8c438
Compare
I sill can't reproduce, but I guess I found the issue (a call to |
This is very strange, I still have the same issue. |
Hmm, I guess I can't do more without being able to reproduce locally :-(. In principle, the second click should execute
(at the end of Can you check that the code actually goes this way (GDB or printf)? I really don't see what could go wrong in this piece of code ... |
Yes, this is called, it seems that there is no redraw of the widget. As I said as soon as I click on the image I do have a draw signal (tested by adding a printf() in the draw() callback) and the icon are properly refreshed. So all this is just a refresh issue! |
I have a solution. No time for now. I'll propose a patch over this PR. |
Cool, thanks. |
Merged with my fix. It was a nice case :) Yet I think we should have a better support for colorpicker and code sharing for all modules. It is quite painful to have to deal with all those details in all modules :( |
I fully agree. It's less painful now that there's less code to deal with it, but it should still be better factored. I won't have much time for this in the next few days, but we should:
|
@moy : I'm on that. Should have something by tonight. The factoring of code is done for filmic. |
@moy : done, if you have a chance to do some testing do not hesitate. |
The "auto tune" button in profile_gamma.c, and "optimize luma" / "neutralize colors" in color balance are still broken the same way as the old "auto tune" in filmic. Using the color picker API there like filmic should solve this. Changing mode in color balance should probably deactivate the picker. Currently, you can activate the fulcrum picker, change mode to lift/gamma/gain where the picker disappears, and still have the picker activated (i.e. dragging within the picture grabs a color, and it seems to do weird things then). Same for the "color control slider" dropdown. Other pickers (exposure, levels, perhaps clut and white balance) could benefit from this, but this may wait until after the release (no need to risk breaking them now if they are not broken ...). THANKS! @aurelienpierre : just a ping in case you didn't see this discussion (a bit hidden in a closed PR ...). |
I don't follow, profile_gamma and colorbalance are now using the color picker API. |
Done. Also resetting picker status when changing controls. |
Hmm, I was using the darktable binary within the build tree (now that it's possible), but apparently I was getting half of the new version (eg. the Git commit id in the version string was the new one), but half of the old version (i.e. not all your changes). |
@moy : yes looks like running from build-tree is not working |
auto-tune levels appears in "unbreak input profile" when the mode is "gamma". I think it should appear only in log mode. |
Right! Good catch, will fix. |
clicking on the "reset" button in "color balance" doesn't disable the color picker icon if the selected icon is one of the "autotune" pickers. Weird. |
I saw that. Just don't know why yet. |
You changed the text from "neutralize colors" to "optimize color". I think the old text was better, it's not really optimizing, but neutralizing. Actually, in color balance, I think the optimizers are a bit more complex: they were using previously selected areas using the 3 pickers. So it was probably to keep them as normal buttons. No time to investigate more, sorry. |
Yes indeed. What have you done to my baby ? 🤣 |
Same in profile_gamma, but not in filmic. I don't understand why. |
I think we are facing a Gtk bug. This is just a redraw of the icon issue. |
I have restored the label, sorry a cut&paste error :( For the colorpicker in color balance I think I have kept the previous behavior (using the selected region if any). |
OK, the behavior is actually more complex than I thought. If 3 patches have been selected, it takes them, but otherwise it guesses from the whole image. Not sure it's really a good idea from the UI point of view, it's really hard to understand how the buttons work without looking at the code :-(. This can be improved in several ways IMHO. Not all ideas are good, just thinking aloud:
|
Actually, on overall it seems the pickers in colorbalance are broken now. I already faced this before the last commits, but very often I use the pickers and get a full white image. |
it seems to work on my side.
that's because there is still no doc on that. The way I designed it was: have a quick fallback for 80 % of the easy cases, then unclutch the auto mode when it fails. So, the button triggers a full-picture guess when user lazy, and gets whatever the user feeds it otherwise. |
The problem is that there's no feedback on what is done: there's no indication about which patch have already been selected, and no indication whether it's a full-picture guess or a 3-patches optimization. Perhaps just a |
Maybe we should change the label of the color picker when the 3 luma patches (or color patches) have been selected from :
What do you think? |
Good idea. |
Do you want to work on that? Or should I go with this... |
If you have time, go with it. I'm spending too much time on dt and not enough on other urgent stuff these days :-(. |
Done. Also, I think I have fixed the redraw issue. Was due to some missing redraw in the bauhaus widgets. |
It's getting better and better. I think it'd be better if the optimize/neutralize buttons were not color pickers (i.e. the new behavior with the old buttons), but I can leave with both. |
This turns the "autotune" button into a picker. While doing this I noticed that pickers weren't activated immediately when active, hence this PR changes that too. Also, color pickers are disabled when one of the 3 black/white/grey slider is moved to avoid bad interaction between the picker automatically moving the sliders and manual usage of the sliders. See commit messages for details.
This needs more testing than I did. If this is accepted, the same should be done for "unbreak input profile" and "color balance".