Project

General

Profile

Bug #12690

blendop_rgb and blendop_mask_rgb are not applied in style

Added by Huy Hoang 5 months ago. Updated 2 months ago.

Status:
New
Priority:
Low
Assignee:
-
Category:
Masks
Target version:
-
Start date:
07/09/2019
Due date:
% Done:

0%

Estimated time:
Affected Version:
git master branch
System:
Ubuntu
bitness:
64-bit
hardware architecture:
amd64/x86

Description

I set Profile Denoise to use parametric mask (to apply heavier blending for darker parts), then save it as a style to apply only on export (to not slow down my editing). This is working in 2.6.

However, in current 2.7, the style applied on export doesn't have the blending applied. If I apply the style to the image in lighttable, then export without the style, then it still works fine.

I ran darktable -d all, and compared the console outputs of the two cases. The only difference is the missing of "blendop_mask_rgb" and "blendop_rgb" (between "denoiseprofile_backtransform" and "denoiseprofile_init").

History

#1 Updated by Huy Hoang 5 months ago

Tried to narrow down where the problem could be by looking at the history of styles.c and imageio.c. Played around with compiling different commits, found that commit 313a2a034758b1b is still good, but 0a27c4694bebea05f038cf29 is affected (likely the culprit?), not sure about in between those two commits.

#2 Updated by Huy Hoang 2 months ago

A simple test case: use the Exposure module to crank up +3EV, but apply a param mask to only the bright parts of the image (to make the effect of the mask obvious). Creating a style from that and reapply to another image works fine, but applying the style on export won't have the param mask applied (the whole image is brightened).

I compared with 2.6 and traced it down to the function dt_styles_apply_style_item() in "common/styles.c", looks like there are many TODO tags in there. Given that applying the style directly works, I modified this IF clause so that the third condition (apply on export) does the same as the first condition (apply directly to the image). That fixed the problem, but I have no clue how it works (haven't touched any C/C++ for over 10 years).

// TODO: this is copied from dt_dev_read_history_ext(), maybe do a helper with this?
if(style_item->blendop_params && (style_item->blendop_version == dt_develop_blend_version())
   && (style_item->blendop_params_size == sizeof(dt_develop_blend_params_t)))
{
  memcpy(module->blend_params, style_item->blendop_params, sizeof(dt_develop_blend_params_t));
}
else if(style_item->blendop_params
        && dt_develop_blend_legacy_params(module, style_item->blendop_params, style_item->blendop_version,
            module->blend_params, dt_develop_blend_version(), style_item->blendop_params_size) == 0)
{
  // do nothing
}
else
{
  // original: memcpy(module->blend_params, module->default_blendop_params, sizeof(dt_develop_blend_params_t));
  memcpy(module->blend_params, style_item->blendop_params, sizeof(dt_develop_blend_params_t));
}

Also available in: Atom PDF

Go to top