@@ -252,11 +252,12 @@ static gboolean _demosaic_full(const dt_dev_pixelpipe_iop_t *const piece,
252252}
253253
254254// Implemented in demosaicing/amaze.cc
255- void amaze_demosaic (dt_dev_pixelpipe_iop_t * piece ,
256- const float * const in ,
255+ void amaze_demosaic (const float * const in ,
257256 float * out ,
258- const dt_iop_roi_t * const roi_in ,
259- const uint32_t filters );
257+ const int width ,
258+ const int height ,
259+ const uint32_t filters ,
260+ const float procmin );
260261
261262#include "iop/demosaicing/basics.c"
262263#include "iop/demosaicing/vng.c"
@@ -592,8 +593,7 @@ void process(dt_iop_module_t *self,
592593 }
593594 }
594595
595- const uint8_t (* const xtrans )[6 ] = xtrans_new ; // (const uint8_t(*const)[6])pipe->dsc.xtrans;
596-
596+ const uint8_t (* const xtrans )[6 ] = xtrans_new ;
597597 const dt_iop_demosaic_data_t * d = piece -> data ;
598598 const dt_iop_demosaic_gui_data_t * g = self -> gui_data ;
599599 const uint32_t filters = dt_rawspeed_crop_dcraw_filters (pipe -> dsc .filters , roi_in -> x , roi_in -> y );
@@ -659,13 +659,17 @@ void process(dt_iop_module_t *self,
659659 || demosaicing_method == DT_IOP_DEMOSAIC_PASSTHROUGH_COLOR ;
660660 const gboolean do_capture = !passthru && !is_4bayer && !show_dual && !run_fast && d -> cs_iter ;
661661
662+ const float procmax = dt_iop_get_processed_maximum (piece );
663+ const float procmin = dt_iop_get_processed_minimum (piece );
664+ const int exif_iso = img -> exif_iso ;
665+
662666 if (!direct )
663- out = dt_alloc_align_float (( size_t ) 4 * width * height );
667+ out = dt_iop_image_alloc ( width , height , 4 );
664668
665669 if (is_bayer && d -> green_eq != DT_IOP_GREEN_EQ_NO && no_masking )
666670 {
667- const float threshold = 0.0001f * img -> exif_iso ;
668- in = dt_alloc_align_float (( size_t ) height * width );
671+ const float threshold = 0.0001f * exif_iso ;
672+ in = dt_iop_image_alloc ( width , height , 1 );
669673 float * aux = NULL ;
670674
671675 switch (d -> green_eq )
@@ -677,7 +681,7 @@ void process(dt_iop_module_t *self,
677681 green_equilibration_lavg (in , (float * )i , width , height , filters , threshold );
678682 break ;
679683 case DT_IOP_GREEN_EQ_BOTH :
680- aux = dt_alloc_align_float (( size_t ) height * width );
684+ aux = dt_iop_image_alloc ( width , height , 1 );
681685 green_equilibration_favg (aux , (float * )i , width , height , filters );
682686 green_equilibration_lavg (in , aux , width , height , filters , threshold );
683687 dt_free_align (aux );
@@ -688,18 +692,18 @@ void process(dt_iop_module_t *self,
688692 }
689693
690694 if (demosaic_mask )
691- demosaic_box3 (piece , out , in , roi_in , filters , xtrans );
695+ demosaic_box3 (out , in , width , height , filters , xtrans );
692696 else if (demosaicing_method == DT_IOP_DEMOSAIC_PASSTHROUGH_MONOCHROME )
693- passthrough_monochrome (out , in , roi_in );
697+ passthrough_monochrome (out , in , width , height );
694698 else if (demosaicing_method == DT_IOP_DEMOSAIC_PASSTHROUGH_COLOR )
695- passthrough_color (out , in , roi_in , filters , xtrans );
699+ passthrough_color (out , in , width , height , filters , xtrans );
696700 else if (is_xtrans )
697701 {
698702 const int passes = base_demosaicing_method == DT_IOP_DEMOSAIC_MARKESTEIJN_3 ? 3 : 1 ;
699703 if (demosaicing_method == DT_IOP_DEMOSAIC_FDC )
700- xtrans_fdc_interpolate (self , out , in , roi_in , xtrans );
704+ xtrans_fdc_interpolate (out , in , width , height , xtrans , exif_iso );
701705 else if (base_demosaicing_method == DT_IOP_DEMOSAIC_MARKESTEIJN || base_demosaicing_method == DT_IOP_DEMOSAIC_MARKESTEIJN_3 )
702- xtrans_markesteijn_interpolate (out , in , roi_in , xtrans , passes );
706+ xtrans_markesteijn_interpolate (out , in , width , height , xtrans , passes );
703707 else
704708 vng_interpolate (out , in , roi_in , filters , xtrans , FALSE);
705709 }
@@ -715,13 +719,13 @@ void process(dt_iop_module_t *self,
715719 }
716720 }
717721 else if (base_demosaicing_method == DT_IOP_DEMOSAIC_RCD )
718- rcd_demosaic (piece , out , in , roi_in , filters );
722+ rcd_demosaic (out , in , width , height , filters , procmax );
719723 else if (demosaicing_method == DT_IOP_DEMOSAIC_LMMSE )
720- lmmse_demosaic (piece , out , in , roi_in , filters , d -> lmmse_refine );
724+ lmmse_demosaic (out , in , width , height , filters , d -> lmmse_refine , procmax );
721725 else if (base_demosaicing_method != DT_IOP_DEMOSAIC_AMAZE )
722- demosaic_ppg (out , in , roi_in , filters , d -> median_thrs );
726+ demosaic_ppg (out , in , width , height , filters , d -> median_thrs );
723727 else
724- amaze_demosaic (piece , in , out , roi_in , filters );
728+ amaze_demosaic (in , out , width , height , filters , procmin );
725729 }
726730
727731 if (pipe -> want_detail_mask )
0 commit comments