@@ -137,7 +137,7 @@ typedef struct dt_iop_demosaic_gui_data_t
137137 GtkWidget * demosaic_method_bayerfour ;
138138 GtkWidget * dual_thrs ;
139139 GtkWidget * lmmse_refine ;
140- gboolean visual_mask ;
140+ gboolean dual_mask ;
141141} dt_iop_demosaic_gui_data_t ;
142142
143143typedef struct dt_iop_demosaic_global_data_t
@@ -476,7 +476,7 @@ void tiling_callback(dt_iop_module_t *self,
476476 dt_iop_demosaic_data_t * d = piece -> data ;
477477
478478 const float ioratio = (float )roi_out -> width * roi_out -> height / ((float )roi_in -> width * roi_in -> height );
479- const float smooth = d -> color_smoothing ? ioratio : 0.0f ;
479+ const float smooth = d -> color_smoothing != DT_DEMOSAIC_SMOOTH_OFF ? ioratio : 0.0f ;
480480 const gboolean is_xtrans = piece -> pipe -> dsc .filters == 9u ;
481481 const float greeneq = (!is_xtrans && (d -> green_eq != DT_IOP_GREEN_EQ_NO )) ? 0.25f : 0.0f ;
482482 const dt_iop_demosaic_method_t demosaicing_method = d -> demosaicing_method & ~DT_DEMOSAIC_DUAL ;
@@ -600,6 +600,7 @@ void process(dt_iop_module_t *self,
600600
601601 const gboolean run_fast = pipe -> type & DT_DEV_PIXELPIPE_FAST ;
602602 const gboolean fullpipe = pipe -> type & DT_DEV_PIXELPIPE_FULL ;
603+ const gboolean previewpipe = pipe -> type & DT_DEV_PIXELPIPE_PREVIEW ;
603604
604605 const uint8_t (* const xtrans )[6 ] = (const uint8_t (* const )[6 ])pipe -> dsc .xtrans ;
605606
@@ -616,13 +617,15 @@ void process(dt_iop_module_t *self,
616617 const int width = roi_in -> width ;
617618 const int height = roi_in -> height ;
618619
619- if (width < 16 || height < 16 )
620+ if ((width < 16 || height < 16 )
621+ && (demosaicing_method != DT_IOP_DEMOSAIC_PASSTHROUGH_MONOCHROME
622+ && demosaicing_method != DT_IOP_DEMOSAIC_PASSTHROUGH_COLOR ))
620623 demosaicing_method = is_xtrans ? DT_IOP_DEMOSAIC_VNG : DT_IOP_DEMOSAIC_VNG4 ;
621624
622625 gboolean showmask = FALSE;
623626 if (self -> dev -> gui_attached && fullpipe )
624627 {
625- if (g -> visual_mask )
628+ if (g -> dual_mask )
626629 {
627630 showmask = TRUE;
628631 pipe -> mask_display = DT_DEV_PIXELPIPE_DISPLAY_MASK ;
@@ -649,7 +652,7 @@ void process(dt_iop_module_t *self,
649652 }
650653
651654 const int base_demosaicing_method = demosaicing_method & ~DT_DEMOSAIC_DUAL ;
652- const gboolean dual = (demosaicing_method & DT_DEMOSAIC_DUAL ) && !run_fast ;
655+ const gboolean dual = (demosaicing_method & DT_DEMOSAIC_DUAL ) && !run_fast && ! previewpipe ;
653656
654657 const gboolean direct = roi_out -> width == width && roi_out -> height == height && feqf (roi_in -> scale , roi_out -> scale , 1e-8f );
655658
@@ -724,10 +727,10 @@ void process(dt_iop_module_t *self,
724727
725728 if ((float * )i != in ) dt_free_align (in );
726729
727- if (d -> color_smoothing )
730+ if (d -> color_smoothing != DT_DEMOSAIC_SMOOTH_OFF )
728731 color_smoothing (out , roi_in , d -> color_smoothing );
729732
730- dt_print_pipe (DT_DEBUG_PIPE , direct ? "demosaic inplace" : "demosaic clip_and_zoom" , pipe , self , DT_DEVICE_CPU , roi_in , roi_out );
733+ dt_print_pipe (DT_DEBUG_VERBOSE , direct ? "demosaic inplace" : "demosaic clip_and_zoom" , pipe , self , DT_DEVICE_CPU , roi_in , roi_out );
731734 if (!direct )
732735 {
733736 dt_iop_roi_t roo = * roi_out ;
@@ -751,6 +754,7 @@ int process_cl(dt_iop_module_t *self,
751754 dt_dev_pixelpipe_t * const pipe = piece -> pipe ;
752755 const gboolean run_fast = pipe -> type & DT_DEV_PIXELPIPE_FAST ;
753756 const gboolean fullpipe = pipe -> type & DT_DEV_PIXELPIPE_FULL ;
757+ const gboolean previewpipe = pipe -> type & DT_DEV_PIXELPIPE_PREVIEW ;
754758 const int qual_flags = demosaic_qual_flags (piece , img , roi_out );
755759 const gboolean fullscale = qual_flags & DT_DEMOSAIC_FULL_SCALE ;
756760 const gboolean is_xtrans = pipe -> dsc .filters == 9u ;
@@ -773,13 +777,15 @@ int process_cl(dt_iop_module_t *self,
773777 const int width = roi_in -> width ;
774778 const int height = roi_in -> height ;
775779
776- if (width < 16 || height < 16 )
780+ if ((width < 16 || height < 16 )
781+ && (demosaicing_method != DT_IOP_DEMOSAIC_PASSTHROUGH_MONOCHROME
782+ && demosaicing_method != DT_IOP_DEMOSAIC_PASSTHROUGH_COLOR ))
777783 demosaicing_method = is_xtrans ? DT_IOP_DEMOSAIC_VNG : DT_IOP_DEMOSAIC_VNG4 ;
778784
779785 gboolean showmask = FALSE;
780786 if (self -> dev -> gui_attached && fullpipe )
781787 {
782- if (g -> visual_mask )
788+ if (g -> dual_mask )
783789 {
784790 showmask = TRUE;
785791 pipe -> mask_display = DT_DEV_PIXELPIPE_DISPLAY_MASK ;
@@ -822,7 +828,7 @@ int process_cl(dt_iop_module_t *self,
822828
823829 const gboolean direct = roi_out -> width == width && roi_out -> height == height && feqf (roi_in -> scale , roi_out -> scale , 1e-8f );
824830 const int base_demosaicing_method = demosaicing_method & ~DT_DEMOSAIC_DUAL ;
825- const gboolean dual = (demosaicing_method & DT_DEMOSAIC_DUAL ) && !run_fast ;
831+ const gboolean dual = (demosaicing_method & DT_DEMOSAIC_DUAL ) && !run_fast && ! previewpipe ;
826832
827833 cl_mem out_image = direct ? dev_out : dt_opencl_alloc_device (devid , width , height , sizeof (float ) * 4 );
828834 cl_mem in_image = dev_in ;
@@ -902,13 +908,13 @@ int process_cl(dt_iop_module_t *self,
902908 in_image = NULL ;
903909 }
904910
905- if (d -> color_smoothing )
911+ if (d -> color_smoothing != DT_DEMOSAIC_SMOOTH_OFF )
906912 {
907913 err = color_smoothing_cl (self , piece , out_image , out_image , roi_in , d -> color_smoothing );
908914 if (err != CL_SUCCESS ) goto finish ;
909915 }
910916
911- dt_print_pipe (DT_DEBUG_PIPE , direct ? "demosaic inplace" : "demosaic clip_and_zoom" , pipe , self , devid , roi_in , roi_out );
917+ dt_print_pipe (DT_DEBUG_VERBOSE , direct ? "demosaic inplace" : "demosaic clip_and_zoom" , pipe , self , devid , roi_in , roi_out );
912918 if (!direct )
913919 err = dt_iop_clip_and_zoom_roi_cl (devid , dev_out , out_image , roi_out , roi_in );
914920
@@ -1151,8 +1157,8 @@ void commit_params(dt_iop_module_t *self,
11511157
11521158 // green-equilibrate over full image excludes tiling
11531159 // The details mask calculation required for dual demosaicing does not allow tiling.
1154- if (( d -> green_eq == DT_IOP_GREEN_EQ_FULL
1155- || d -> green_eq == DT_IOP_GREEN_EQ_BOTH )
1160+ if ( d -> green_eq == DT_IOP_GREEN_EQ_FULL
1161+ || d -> green_eq == DT_IOP_GREEN_EQ_BOTH
11561162 || use_method & DT_DEMOSAIC_DUAL
11571163 || piece -> pipe -> want_detail_mask )
11581164 {
@@ -1278,7 +1284,7 @@ void gui_changed(dt_iop_module_t *self, GtkWidget *w, void *previous)
12781284 if (!w || w != g -> dual_thrs )
12791285 {
12801286 dt_bauhaus_widget_set_quad_active (g -> dual_thrs , FALSE);
1281- g -> visual_mask = FALSE;
1287+ g -> dual_mask = FALSE;
12821288 }
12831289
12841290 // as the dual modes change behaviour for previous pipeline modules we do a reprocess
@@ -1297,7 +1303,7 @@ static void _visualize_callback(GtkWidget *quad, dt_iop_module_t *self)
12971303 if (darktable .gui -> reset ) return ;
12981304 dt_iop_demosaic_gui_data_t * g = self -> gui_data ;
12991305
1300- g -> visual_mask = dt_bauhaus_widget_get_quad_active (quad );
1306+ g -> dual_mask = dt_bauhaus_widget_get_quad_active (quad );
13011307 dt_dev_reprocess_center (self -> dev );
13021308}
13031309
@@ -1306,9 +1312,9 @@ void gui_focus(dt_iop_module_t *self, gboolean in)
13061312 dt_iop_demosaic_gui_data_t * g = self -> gui_data ;
13071313 if (!in )
13081314 {
1309- const gboolean was_dualmask = g -> visual_mask ;
1315+ const gboolean was_dualmask = g -> dual_mask ;
13101316 dt_bauhaus_widget_set_quad_active (g -> dual_thrs , FALSE);
1311- g -> visual_mask = FALSE;
1317+ g -> dual_mask = FALSE;
13121318 if (was_dualmask ) dt_dev_reprocess_center (self -> dev );
13131319 }
13141320}
0 commit comments