Again, thank you for all this information!
This does clear up a lot of things :-)

rawfiner

2018-07-11 10:18 GMT+02:00 johannes hanika <hana...@gmail.com>:

> heya,
>
> On Fri, Jul 6, 2018 at 12:06 AM, rawfiner <rawfi...@gmail.com> wrote:
> > Hi,
> >
> > I am still trying to resize raw before demosaicing to speed up raw
> > denoising.
> >
> > 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,
> 0);
> >   else if (piece->pipe->type == DT_DEV_PIXELPIPE_PREVIEW)
> >     scale = dt_dev_get_zoom_scale(self->dev, zoom, closeup ? 2.0 : 1.0,
> 1);
>
> as of lately, the obscure closeup became more obscure. it should now
> be 1<<closeup (to support 2x 4x .. 16x etc zoom without interpolating
> pixels).
>
> > 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.
>
> okay. the way the pipeline works is in three stages:
>
> 1) a pass of modify_roi_out() from raw to screen output is performed.
> this is done full resolution, full region of interest, to determine
> the hypothetical size of the output image when processed in full.
>
> 2) given the size and region of interest of the view window, the
> develop module requests a certain input to be able to render the
> output. this is done by calling a chain of modify_roi_in() from view
> window back to raw image. this is only done on the exact pixels that
> are needed on screen right now, i.e. scaled and cropped.
>
> 3) process() is called with about exactly the ROI that were computed
> in pass number 2. i think there are some minor sanity checks done, so
> you shouldn't rely on what you asked for in modify_roi_in but use what
> you get in process().
>
> so in your case i think messing with modify_roi_in() is the more
> important case. you can just request the full image as passed through
> 1) by asking for piece->buf_in or piece->buf_out (these are stored
> when running 1) ).
>
> hope that clears up some things!
>
> cheers,
>  jo
>
> > 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
> > modify_roi_in?
> >
> > Maybe am I not catching something about the role of these passes.
> >
> > Thanks for any help!
> >
> > Cheers,
> > rawfiner
> >
> > 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>:
> >>>
> >>> heya,
> >>>
> >>> 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 /
> >>> piece->iscale));
> >>>
> >>> 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 ==
> >>> DT_DEV_PIXELPIPE_PREVIEW)
> >>
> >>
> >> Ok, thank you for these explainations
> >> I think I have everything I need to make some new trials!
> >>
> >> Regards,
> >>
> >> rawfiner
> >>
> >
> >
> > ____________________________________________________________
> _______________
> > darktable developer mailing list to unsubscribe send a mail to
> > darktable-dev+unsubscr...@lists.darktable.org
>

___________________________________________________________________________
darktable developer mailing list
to unsubscribe send a mail to darktable-dev+unsubscr...@lists.darktable.org

Reply via email to