let me try to fill in some gaps:
On Tue, Jul 10, 2018 at 8:32 AM, rawfiner <rawfi...@gmail.com> wrote:
> Dear all,
> I think that I do not manage to differenciate correctly the role of some
> What is the difference between:
that is the current output region of interest scale, relating what
would happen when you had processed the full resolution image vs. what
is actually being processed in the pipe now. sorry i forget which way
around scale = a/b or = b/a it is.
this is the input scale factor, i.e. how much did the pipeline where
the current piece belongs to downsize the real input (raw image)
before throwing it into the pipeline. this should be 1.0 for the full
and export pipelines and may be different for the preview. again i
forgot whether this should be < or > 1 in that case.
if the piece is a piece of the preview pipeline, these last two should
be the same (the piece copies iscale and iwidth/iheight for
convenience. also there were places at least in the past where you
would have the piece but not the whole pipe)
> And the difference between:
the size of the output buffer that is passed to process() for
instance. note that these may be different for each module, because
some require some padding or need to run on full res bayer data, do
see above. width of the prescaled input. should be == raw resolution
unless you're running a preview pipeline.
that's the output size of the fully processed image, i.e. what would
be stored on disk if you were running an export pipeline. this is
needed up front to get scale to fit work correctly for instance. it's
computed by a chain of modify_roi_out() which is run in a first pass
with the full input buffer resolution and full region of interest.
that is the size of the develop view. i.e. if you need to determine
the scale factor for the pipeline, you would relate this view window
size to the processed_width above, and then run the pipeline.
> Which variable has to be used for which purpose?
> What I currently have:
> before downscaling:
> after downscaling, we are too zoomed out:
> I would like to "tell the engine" that we are downscaling the image for the
> preview, and that the 29% zoom is going to become a 100% zoom (as the image
> is smaller), but without affecting the information visible by the user (the
> user will see that he is at 29% zoom).
> Basically, the user should see no difference whether the downscaling is
> activated or not
you want to downscale more than the pipeline usually does? i think at
the zoom-to-fit scale usually we'd downscale the input very early,
unless one module requests full raw data at full resolution. i'm
assuming your module comes before demosaic with requests the roi_in of
full resolution (see the line roi_in->scale = 1.0f; in modify_roi_in()
in src/iop/demosaic.c). as much as i hate inter-module dependencies
you may need to mess with that to achieve what you need.
the alternative is to implement your own modify_roi_in() that undoes
these changes and requests a much smaller input scale. in this case i
think you should leave modify_roi_out as passthrough, because that is
only called on full res full roi and computes the output size given
the full input (to ultimately compute processed_width).
hope that helps.
> Thank you for any help
> 2018-07-06 0:06 GMT+02:00 rawfiner <rawfi...@gmail.com>:
>> I am still trying to resize raw before demosaicing to speed up raw
>> I now get the zoom level using the following code:
>> float scale = 1.0;
>> int closeup = dt_control_get_dev_closeup();
>> if (piece->pipe->type == DT_DEV_PIXELPIPE_FULL)
>> scale = dt_dev_get_zoom_scale(self->dev, zoom, closeup ? 2.0 : 1.0,
>> else if (piece->pipe->type == DT_DEV_PIXELPIPE_PREVIEW)
>> scale = dt_dev_get_zoom_scale(self->dev, zoom, closeup ? 2.0 : 1.0,
>> This works fine in modify_roi_out, but sometimes gives 1 instead of what I
>> expect (the zoom factor) when called from modify_roi_in.
>> My problem is to manage to get the scale and use it correctly.
>> My module would resize the raw image.
>> Thus, input and output have different dimentions.
>> I tried to set the roi_out width and height with modify_roi_out, this
>> works fine.
>> However, even after trying various things in modify_roi_in, I don't manage
>> to get the full image as ivoid.
>> First thing that I don't understand is where roi_in is modified between
>> modify_roi_out and modify_roi_in, as at the beginning of modify_roi_in, the
>> roi_in width is equal to roi_out width, while they were different at the end
>> of roi_out?
>> Also, in modify_roi_out I tried to save the scale in roi_out->scale, but
>> in modify_roi_in if I try to print roi_out->scale, I always get 1.
>> Is the roi_out variable used in modify_roi_out different from the one in
>> Maybe am I not catching something about the role of these passes.
>> Thanks for any help!
>> 2018-05-10 23:13 GMT+02:00 rawfiner <rawfi...@gmail.com>:
>>> Thank you for your answer.
>>> 2018-05-09 13:22 GMT+02:00 johannes hanika <hana...@gmail.com>:
>>>> On Wed, May 9, 2018 at 12:27 PM, rawfiner <rawfi...@gmail.com> wrote:
>>>> > 2018-05-08 17:16 GMT+02:00 johannes hanika <hana...@gmail.com>:
>>>> >> i'm guessing you want to detect whether you are running a
>>>> >> DT_DEV_PIXELPIPE_FULL pipe in darkroom mode (as opposed to
>>>> >> DT_DEV_PIXELPIPE_PREVIEW or _EXPORT) and then do this downscaling
>>>> >> yourself before running your algorithm on reduced resolution.
>>>> > Yes, and I would like to know the zoom factor in case of
>>>> > DT_DEV_PIXELPIPE_PREVIEW , in order to downscale only if the image is
>>>> > sufficiently zoomed out (for example, I don't want to downscale the
>>>> > image if
>>>> > the zoom is at 90%, but I want to downscale if it is below 50%).
>>>> right. to determine the total scale factor, you would need to do
>>>> something like for instance in sharpen.c:
>>>> const int rad = MIN(MAXR, ceilf(d->radius * roi_in->scale /
>>>> which determines the pixel radius scaled by input buffer scaling
>>>> (iscale) and region of interest scaling (roi_in->scale).
>>> Yes, I have seen that kind of things in the code of non local means.
>>> Yet, if I understand correctly, this allows to retreive the scale factor
>>> for an already downscaled image, i.e. when the image was downscaled
>>> previously in the pipeline.
>>> What I would like is a bit different, as it would be to know if I can
>>> downscale the image or not, depending on the zoom level in the darkroom.
>>> But I guess that I will find the necessary information in the function
>>> dt_iop_clip_and_zoom_mosaic_half_size_f() that you pointed me out!
>>>> note that the preview pipe is what fills the whole image but
>>>> downscaled (iscale != 1) in the navigation view in the top left
>>>> corner. the "full" pipeline fills the pixels in the center view of
>>>> darkroom mode, at exactly the scale and crop you see on screen (iscale
>>>> == 1 mostly but the other scale and bounds in roi_in will change with
>>>> the current view).
>>>> to find out whether you're running either one of the two you'd write
>>>> something similar to bilat.c:
>>>> if(self->dev->gui_attached && g && piece->pipe->type ==
>>> Ok, thank you for these explainations
>>> I think I have everything I need to make some new trials!
> darktable developer mailing list to unsubscribe send a mail to
darktable developer mailing list
to unsubscribe send a mail to darktable-dev+unsubscr...@lists.darktable.org