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
Rawdenoise: change force by frequency and channel #1752
Rawdenoise: change force by frequency and channel #1752
Conversation
But bug remaining: when changing from an image to another, the GUI is not showing
The frequencies of the wavelets cannot be changed.
…orce band by band
When adding new instances, the GUI was incorrect: we did not have either the nonraw label or the curve, but we add both. Now, when adding new instance, the GUI is correct
The curves do not influence the algorithm yet
I have run it for 2 days, no issue. |
Same remark here (see #1753), without tweaking the graphic, do we get the same result than before? |
Yes, we get the same result. This part of the code handles the "all" curve: The point gathered from the curve is squared twice. Thus 0.5 (the neutral value of the curve) is mapped to 1/16. We multiply this by 16, which maps our 0.5 to 1. The code bellow does the same thing for each "channel" (we do not really have channel before demosaic, but each pixel has one of the 3 channels. Thus we use the green curve on "green" pixels, red curve on "red" pixels etc..)
The switch case is slightly different for xtrans code, as in bayer code c==1 an d c==2 both corresponds to green, whereas in xtrans code, c directly corresponds to the pixel channel (0 for R, 1 for G, and 2 for B) |
Sorry for the code formatting in the quotes, I am not sure yet how to refer to code from https://github.com/darktable-org/darktable/pull/1752/files |
I've tested it, this is really nice. But please if you read this test it before it is merged. I'd like to have this in 2.6, so more testing would be nice. |
I'm playing with it as well. Works great so far. |
I have just found a bug for bayer: the colors are not always with same index. This means that with current implementation, sometimes the blue slider modify the green, sometimes the blue, etc. |
c does not correspond to a color, but to the number of an "origin" pixel in the top left 2x2 square. We have to convert it to a color.
The bug should be fixed now. I misinterpreted a variable, thinking it was representing a color, whereas it represented "somewhat" a coordinate in the top left 2x2 square of pixels. |
I have been using the new RawFiner feature in the Rawdenoise module for some time. I like that he introduced in darktable the experiments he did on noise processing with dtStyles and shared. I would like to see them in the next version 2.6. |
src/iop/rawdenoise.c
Outdated
#define DT_IOP_RAWDENOISE_RES 64 | ||
#define DT_IOP_RAWDENOISE_BANDS 5 | ||
|
||
typedef enum dt_iop_rawdenoise_channel_t { |
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.
The { should be under typedef.
All entries should be capitalized and with DT_ as prefix:
DT_RAWDENOISE_ALL = 0,
...
{ | ||
if(old_version == 1 && new_version == 2) | ||
{ | ||
dt_iop_rawdenoise_params_t *o = (dt_iop_rawdenoise_params_t *)old_params; |
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.
See comment about legacy_param in #1753
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.
This one is lot simpler to solve as this new version is only the second one!
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 added a comment to explain how it works.
I used this as I saw this was the way it was done in denoiseprofile and nlmeans for example.
But if you prefer, I can define a new struct so that the changes are more explicit.
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.
No, fine I read as if you were copying the would struct with memcpy() and that you were reading past the old struct. I don't this that now! Good to me, you are copying the field one by one.
src/iop/rawdenoise.c
Outdated
for(int k = 0; k < DT_IOP_RAWDENOISE_BANDS; k++) | ||
(void)dt_draw_curve_add_point(d->curve[ch], default_params->x[ch][k], default_params->y[ch][k]); | ||
} | ||
self->commit_params(self, self->default_params, pipe, piece); // TODO necessary? |
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 is necessary! That's the only way to passe the params between pixelpipe and module params.
src/iop/rawdenoise.c
Outdated
g_signal_connect(G_OBJECT(c->channel_tabs), "switch_page", G_CALLBACK(rawdenoise_tab_switch), self); | ||
|
||
c->channel = dt_conf_get_int("plugins/darkroom/rawdenoise/gui_channel"); | ||
int ch = (int)c->channel; |
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.
can probably be made const?
Thank you for the code review ! :-) |
{ | ||
if(old_version == 1 && new_version == 2) | ||
{ | ||
dt_iop_rawdenoise_params_t *o = (dt_iop_rawdenoise_params_t *)old_params; |
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.
No, fine I read as if you were copying the would struct with memcpy() and that you were reading past the old struct. I don't this that now! Good to me, you are copying the field one by one.
All good now too. Thanks. |
This pull request adds a GUI to rawdenoise similar to the one of the equalizer.
It does NOT change the underlying algorithm, but allows the user to finely control the denoising:
I think this gives much more power to the user, without adding complexity in the algorithm.
(almost all the code change in this pull request are for the GUI.)