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); 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 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