-
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
RFC: expose final scale iop to gui #13635
Conversation
taking over code from https://github.com/aurelienpierreeng/ansel/blob/24b11d76c8ad097b1b1657697ac012fe4ded515b/src/iop/finalscale.c to enable custom position of the final scaling iop in case there's a demand to apply scaling earlier in the export pipe to e.g. allow sharpening after rescaling. line 164 contains a link to ansel documentation of usecases - maybe to be replaced by something else ... since that allows an uswer to shoot themselves into the foot - feel free to discuss
As I said (and others) here #13335, this doesn't seems to solve the issue. So it has been discussed but up to now there is no proof that this helps in any way. Do you have some positive experiences to share? |
It helps insofar, as you can do things like sharpening after scaling . Also, this not only about downscaling. |
Right, this is indeed important. |
It am yet not sure if a "ask the user to change pipeline order" is the right way. Also upscaling should be more restricted. Modules like d&s might go wild easily. |
main noticeable difference is sharpening - that color stuff seems to be an edge case. maybe a more appropriate solution for applying a sharpening style after finalscale might be found just for export |
Probably so yes. We can certainly have an option in export to add a sharpen instance in the pixelpipe (as we do for style). The problem is how to control the sharpen strength/level directly in the export module? We can have a combo with none/soft/medium/strong option for the sharpening, would that be enough? Lot of questions... |
I wonder if it would be a better solution to introduce a regular “scale” module that allows to scale within the regular pixel pipe, which could be used together with one of the sharpening modules at the end of the pipe to post-scale sharpen. This would allow to preview the result, and could be applied as style at export by those who do regular post-scale sharpening. This would furthermore fix a second issue that I regularly have. I often have images of people that are important but not 100 % sharp. Therefore I want to limit the output resolution to an amount that hides the imperfection. This could be achieved with the same scale module within the regular pipe, but this time not as preset but simply as part of the pipe. What do you think? Edit: style, not preset in the first paragraph. |
There are perhaps too many different sharpening methods and ways to fine tune them for a simple solution like this to please all. In the case of downscale, scene referred, and good gpu, d&s will most likely be the preferred option, in which case selecting a preset for that module from export would be a solution. But what about upscale, display referred, or no/poor gpu? Seems the only way to cover all use cases is to expose final scale to user in pipeline. I agree with @MStraeten the most efficient workflow for this will be to apply a style on export. What is the drawback of exposing final scale to user in pipe? I don't really see one. |
I don't see either. Just the description "This module is used to downscale images at export time" is simply wrong, I haven't tested that but i am not even sure that downscaling uses this at all with current pipeline flow. |
One more module visible :) I personally don't have objection. |
That's probably the point for the "color issue". |
src/iop/finalscale.c
Outdated
{ | ||
IOP_GUI_ALLOC(finalscale); | ||
self->widget = gtk_label_new(NULL); | ||
gtk_label_set_markup(GTK_LABEL(self->widget),_("This module is used to downscale images at export time. " |
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 think this is plain wrong.
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.
We should in any case remove all capital letters to keep standard dt style.
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.
@jenshannoschwalm : Plain wrong? You mean that export time
is confusing? Because to me this module does clip/zoom to final size looking at the code. This module is indeed used for all pixelpipe.
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.
capitals removed
-d pipe indicates the existence of finalscale just on export if high quality resampling is active:
299,0892 [modify roi OUT] [export] rawprepare ( 0/ 0) 5360x3516 scale=1,0000 --> ( 0/ 0) 5202x3464 scale=1,0000
299,0892 [modify roi IN] [export] finalscale ( 0/ 0) 5202x3460 scale=1,0000 --> ( 0/ 0) 648x 431 scale=0,1246
299,0892 [modify roi IN] [export] highlights ( 0/ 0) 5202x3464 scale=1,0000 --> ( 0/ 0) 5202x3460 scale=1,0000
299,0892 [modify roi IN] [export] rawprepare ( 0/ 0) 5360x3516 scale=1,0000 --> ( 0/ 0) 5202x3464 scale=1,0000
299,0927 [pixelpipe_process_CL] [export] rawprepare ( 0/ 0) 5360x3516 scale=1,0000 --> ( 0/ 0) 5202x3464 scale=1,0000
...
299,3029 [pixelpipe_process_CL] [export] colorout ( 0/ 0) 5202x3460 scale=1,0000 --> ( 0/ 0) 5202x3460 scale=1,0000
299,3447 [pixelpipe_process_CL] [export] finalscale ( 0/ 0) 5202x3460 scale=1,0000 --> ( 0/ 0) 648x 431 scale=0,1246
299,3448 [clip_and_zoom_roi CL] [export] finalscale ( 0/ 0) 5202x3460 scale=1,0000 --> ( 0/ 0) 648x 431 scale=0,1246 device=0
299,3584 [cache report] [export] 2 lines (important=0, used=2). Used 575MB, limit=0MB. Hitrate=0,00
export no high quality resampling:
292,7390 [modify roi OUT] [export] rawprepare ( 0/ 0) 5360x3516 scale=1,0000 --> ( 0/ 0) 5202x3464 scale=1,0000
292,7390 [modify roi IN] [export] demosaic ( 0/ 0) 5202x3459 scale=1,0000 --> ( 0/ 0) 648x 431 scale=0,1246
292,7391 [modify roi IN] [export] highlights ( 0/ 0) 5202x3464 scale=1,0000 --> ( 0/ 0) 5202x3459 scale=1,0000
292,7391 [modify roi IN] [export] rawprepare ( 0/ 0) 5360x3516 scale=1,0000 --> ( 0/ 0) 5202x3464 scale=1,0000
292,7434 [pixelpipe_process_CL] [export] rawprepare ( 0/ 0) 5360x3516 scale=1,0000 --> ( 0/ 0) 5202x3464 scale=1,0000
...
292,8721 [pixelpipe_process_CL] [export] colorout ( 0/ 0) 648x 431 scale=0,1246 --> ( 0/ 0) 648x 431 scale=0,1246
292,8742 [pixelpipe_process_on_CPU] [export] gamma ( 0/ 0) 648x 431 scale=0,1246 --> ( 0/ 0) 648x 431 scale=0,1246
292,8745 [cache report] [export] 2 lines (important=1, used=2). Used 575MB, limit=0MB. Hitrate=0,00
full pipe:
274,7225 [modify roi OUT] [full] rawprepare ( 0/ 0) 5360x3516 scale=1,0000 --> ( 0/ 0) 5202x3464 scale=1,0000
274,7225 [pixelpipe_cache_checkmem] [full] 64 lines (important=0, used=0). Cache: freed=0MB (bad=0 low=0 high=0). Now using 0MB, limit=512MB
274,7225 [modify roi IN] [full] demosaic ( 0/ 0) 5202x3462 scale=1,0000 --> ( 0/ 0) 2096x1395 scale=0,4029
274,7225 [modify roi IN] [full] highlights ( 0/ 0) 5202x3464 scale=1,0000 --> ( 0/ 0) 5202x3462 scale=1,0000
274,7226 [modify roi IN] [full] rawprepare ( 0/ 0) 5360x3516 scale=1,0000 --> ( 0/ 0) 5202x3464 scale=1,0000
274,7262 [pixelpipe_process_CL] [full] rawprepare ( 0/ 0) 5360x3516 scale=1,0000 --> ( 0/ 0) 5202x3464 scale=1,0000
...
274,8739 [pixelpipe_process_CL] [full] colorout ( 0/ 0) 2096x1395 scale=0,4029 --> ( 0/ 0) 2096x1395 scale=0,4029
274,8826 [pixelpipe_process_on_CPU] [full] gamma ( 0/ 0) 2096x1395 scale=0,4029 --> ( 0/ 0) 2096x1395 scale=0,4029
274,8869 [cache report] [full] 64 lines (important=2, used=10). Used 518MB, limit=512MB. Hitrate=0,00
so the phrase "used to downscale images at export time" might not be that precise but not wrong.
maybe better " ...used to downscale images with high quality resampling"
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.
Indeed, you're right and this is new to me. The module finalscale is only used for high quality export.
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, but also for upscaling
and also removed link to ansel documentation
question: how to get rid of the empty widget usually populated with const char **description(struct dt_iop_module_t *self) {...} stuff? |
The |
so how to get rid of the tooltip? it seems to be a tooltip activated when hovering over the name of the module. |
changed notice
@@ -159,7 +159,7 @@ void gui_init(dt_iop_module_t *self) | |||
{ | |||
IOP_GUI_ALLOC(finalscale); | |||
self->widget = gtk_label_new(NULL); | |||
gtk_label_set_markup(GTK_LABEL(self->widget),_("this module is used to downscale images at export time. " | |||
gtk_label_set_markup(GTK_LABEL(self->widget),_("this module is used to downscale images with high quality resampling mode at export time. " |
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.
It's about upscaling too :-)
Now that I see that this module is only used at export time I would certainly prefer having some new option in export module. What I don't like here is that we introduce a new module that is visible in the pixelpipe and for the first time this module is of no used in darkroom. Of course I'm ready to be convinced that this is the right solution but I'm a bit uneasy to introduce this at this point. |
Yes and also the "module on/off" in export depends on export parameters like hq-scaling. While in darkroom the scaling always happens in demosaicing for raws. This difference - darkroom vs export scaling - means that all modules after the demosaicer get different data to work on ... |
So a better path is probably:
The finalsharpen being a new module the sharpening algorithm may be whatever is best for the use case. I think this is more user friendly and does not add another level of complexity to the user by requiring to move modules around. |
May I ask what would be the drawback (besides that it needs to be implemented) of having such a module visible in the pipe, together with the final scaling operation just before this step (maybe in the same module), where scale parameters could be entered (either as wxh pixels or as factor)? This would at least allow to preview the outcome of post-scaling sharpening, even if the scaling is then switched off and an export without high-q resampling and therefore early scaling would be used in combination with export sharpening. The scaling could be disabled by default as well as the sharpening, with a checkbox that says “sharpening controlled by export module”, and only if this checkbox is unchecked, the sharpening settings given in the module would apply. The scaling would also have such a checkbox, which in unchecked state would limit the maximum export size (smaller exports would be allowed) by the given resolution or scaling factor. |
This solution ignores the fact that hq export does scaling at the wrong place in the pipe (after gamma and not before). Perhaps finalscale could undo and redo gamma in itself?.. |
So two usecases that might be better separated:
having the module exposed or not doesn’t matter that much since you won’t see any differences in darkroom… |
A visible module that does nothing in darkroom and only enabled at export time is kind of messy to me. |
That's an orthogonal issue or do I miss the point? One of the goal discussed here was to be able to sharpen after scaling hence my proposal. |
I was not describing a module that does nothing. I was describing a module that works within darkroom pixel pipe and scales the image in darkroom as an alternative to the suggested solution to expose the current final scale IOP which indeed would do nothing in darkroom. Effectively this may swap final scaling and gamma, which may not be too much of an issue unless I miss something. Introduced as an additional module (additional to the final scale IOP) would even not break current behavior, but maybe it is also worth to replace final scale IOP by this new approach (not sure how much of an impact a scale/gamma switch would have on old edits). Additional features that would be enabled by this change were described by my post above. If my suggestions are not appropriate or do not belong here, please tell me, this is marked RFC therefore I thought it is OK to post my suggestion of an alternative solution to (part of) the problem which is sharpen after scale. |
Just FYI, one very popular commercial photo editing application that has sharpening controls in the export dialog includes 3 controls: a checkbox to enable/disable output sharpening; a drop-down menu to specific sharpening for screen, matte paper, or glossy paper; and an amount drop-down menu to specify the amount of sharpening as low, standard, or high. |
Exposing final scale in darkroom doesn't do nothing. Yes, it doesnt have parameters of its own, but it allows you to move it before the tone curve (eg. Filmic), thus allowing to downscale on linear data. The benefit of this is that a sharpening module (d&s, sharpen, contrast eq - users choice) can be placed in between final scale and tone curve. Placing sharpening after final scale is the equivalent of post-resize sharpening, and doing this before tone curve allows the sharpening to occur on linear data, which is less likely to produce artifacts (and if we use d&s, is specifically designed for linear data). If you dont want to expose this to user in darkroom but do it in export, then two things would happen:
What's the pros and cons of doing it in export?
The only way I can possibly see 2 working in export module is you have two options to select: Could a new module final sharpen achieve all of the above? I'm not against that idea, just to make sure it covers all the various use cases. The other question to ask is whether moving final scale helps solve any other problem, such as the 'color' one that was initially raised. No one seems to have an answer to that. If it did then the importance of moving final scale would not be linked to post resize sharpening only. |
It doesn't fully. That problem is currently already defined by downscaling in the demosicer stage from my analysis. The available test image (as non-raw) doesn't make this obvious. That issue is certainly 'high priority' |
@jenshannoschwalm : If you plan working on this, please take the lead I'm really not sure to understand everything involved here. We can certainly team together to work on this and if my proposal above is part of the solution I can handle this. Please let me know, we may want to open a new issue to discuss all the implications and the way forward. Do you want me to open such issue? |
@TurboGit yes i am planning to do so pretty soon. Just two things in my pipeline a) get something better for OpenCl intels and b) embedded lens correction also for OpenCl. Maybe a month or so? team together sounds good, i will certainly ask what @garagecoder and Iain think about this, they don't know the dt codebase but always have good ideas about color maths. |
Any yes, an issue before designing is good. |
Done here #13682. |
so this can be closed, it doesn't make sense to merge a patchy manual solution for something that will be solved with a proper design ;) |
taking over code from https://github.com/aurelienpierreeng/ansel/blob/24b11d76c8ad097b1b1657697ac012fe4ded515b/src/iop/finalscale.c to enable custom position of the final scaling iop in case there's a demand to apply scaling earlier in the export pipe to e.g. allow sharpening after rescaling.
line 164 contains a link to ansel documentation of usecases - maybe to be replaced by something else ...
since that allows an uswer to shoot themselves into the foot - feel free to discuss