Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
demosaic.c File Reference
#include "common/darktable.h"
#include "common/imagebuf.h"
#include "common/image_cache.h"
#include "common/interpolation.h"
#include "common/math.h"
#include "common/opencl.h"
#include "control/control.h"
#include "develop/blend.h"
#include "develop/develop.h"
#include "develop/format.h"
#include "develop/imageop.h"
#include "develop/imageop_math.h"
#include "develop/imageop_gui.h"
#include "develop/masks.h"
#include "develop/openmp_maths.h"
#include "develop/tiling.h"
#include "bauhaus/bauhaus.h"
#include "common/colorspaces.h"
#include "control/conf.h"
#include "common/colorspaces_inline_conversions.h"
#include "common/bspline.h"
#include "gui/gtk.h"
#include "iop/iop_api.h"
#include <memory.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <complex.h>
#include <glib.h>
#include "demosaic/basic.c"
#include "demosaic/passthrough.c"
#include "demosaic/rcd.c"
#include "demosaic/lmmse.c"
#include "demosaic/ppg.c"
#include "demosaic/vng.c"
#include "demosaic/markesteijn.c"
#include "demosaic/dual.c"
+ Include dependency graph for demosaic.c:

Data Structures

struct  dt_iop_demosaic_global_data_t
 
struct  dt_iop_demosaic_data_t
 
struct  dt_iop_demosaic_params_t
 
struct  dt_iop_demosaic_gui_data_t
 

Macros

#define INLINE   inline
 
#define DEMOSAIC_XTRANS   1024
 
#define DEMOSAIC_DUAL   2048
 
#define REDUCESIZE   64
 
#define XTRANS_SNAPPER   3
 
#define BAYER_SNAPPER   2
 
#define DOWNSAMPLE_GUIDED_SCALES   1
 

Typedefs

typedef enum dt_iop_demosaic_method_t dt_iop_demosaic_method_t
 
typedef enum dt_iop_demosaic_greeneq_t dt_iop_demosaic_greeneq_t
 
typedef enum dt_iop_demosaic_smooth_t dt_iop_demosaic_smooth_t
 
typedef enum dt_iop_demosaic_lmmse_t dt_iop_demosaic_lmmse_t
 
typedef struct dt_iop_demosaic_global_data_t dt_iop_demosaic_global_data_t
 
typedef struct dt_iop_demosaic_data_t dt_iop_demosaic_data_t
 
typedef enum dt_iop_demosaic_quality_t dt_iop_demosaic_quality_t
 
typedef struct dt_iop_demosaic_params_t dt_iop_demosaic_params_t
 
typedef struct dt_iop_demosaic_gui_data_t dt_iop_demosaic_gui_data_t
 

Enumerations

enum  dt_iop_demosaic_method_t {
  DT_IOP_DEMOSAIC_PPG = 0 ,
  DT_IOP_DEMOSAIC_AMAZE = 1 ,
  DT_IOP_DEMOSAIC_VNG4 = 2 ,
  DT_IOP_DEMOSAIC_RCD = 5 ,
  DT_IOP_DEMOSAIC_LMMSE = 6 ,
  DT_IOP_DEMOSAIC_RCD_VNG = 2048 | DT_IOP_DEMOSAIC_RCD ,
  DT_IOP_DEMOSAIC_AMAZE_VNG = 2048 | DT_IOP_DEMOSAIC_AMAZE ,
  DT_IOP_DEMOSAIC_PASSTHROUGH_MONOCHROME = 3 ,
  DT_IOP_DEMOSAIC_PASSTHROUGH_COLOR = 4 ,
  DT_IOP_DEMOSAIC_VNG = 1024 | 0 ,
  DT_IOP_DEMOSAIC_MARKESTEIJN = 1024 | 1 ,
  DT_IOP_DEMOSAIC_MARKESTEIJN_3 = 1024 | 2 ,
  DT_IOP_DEMOSAIC_FDC = 1024 | 4 ,
  DT_IOP_DEMOSAIC_MARKEST3_VNG = 2048 | DT_IOP_DEMOSAIC_MARKESTEIJN_3 ,
  DT_IOP_DEMOSAIC_PASSTHR_MONOX = 1024 | 3 ,
  DT_IOP_DEMOSAIC_PASSTHR_COLORX = 1024 | 5 ,
  DT_IOP_DEMOSAIC_DOWNSAMPLE = 7
}
 
enum  dt_iop_demosaic_greeneq_t {
  DT_IOP_GREEN_EQ_NO = 0 ,
  DT_IOP_GREEN_EQ_LOCAL = 1 ,
  DT_IOP_GREEN_EQ_FULL = 2 ,
  DT_IOP_GREEN_EQ_BOTH = 3
}
 
enum  dt_iop_demosaic_smooth_t {
  DEMOSAIC_SMOOTH_OFF = 0 ,
  DEMOSAIC_SMOOTH_1 = 1 ,
  DEMOSAIC_SMOOTH_2 = 2 ,
  DEMOSAIC_SMOOTH_3 = 3 ,
  DEMOSAIC_SMOOTH_4 = 4 ,
  DEMOSAIC_SMOOTH_5 = 5
}
 
enum  dt_iop_demosaic_lmmse_t {
  LMMSE_REFINE_0 = 0 ,
  LMMSE_REFINE_1 = 1 ,
  LMMSE_REFINE_2 = 2 ,
  LMMSE_REFINE_3 = 3 ,
  LMMSE_REFINE_4 = 4
}
 
enum  dt_iop_demosaic_quality_t {
  DT_DEMOSAIC_FAST = 0 ,
  DT_DEMOSAIC_FAIR = 1 ,
  DT_DEMOSAIC_BEST = 2
}
 

Functions

static __attribute__ ((always_inline))
 
void amaze_demosaic_RT (const dt_dev_pixelpipe_iop_t *piece, const float *const in, float *out, const dt_iop_roi_t *const roi_in, const dt_iop_roi_t *const roi_out, const uint32_t filters)
 
const char * name ()
 
const char ** description (struct dt_iop_module_t *self)
 
int default_group ()
 
int flags ()
 
int default_colorspace (dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, const dt_dev_pixelpipe_iop_t *piece)
 
int legacy_params (dt_iop_module_t *self, const void *const old_params, const int old_version, void *new_params, const int new_version)
 
void input_format (dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece, dt_iop_buffer_dsc_t *dsc)
 
void output_format (dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece, dt_iop_buffer_dsc_t *dsc)
 
static gboolean _is_downsample_method (const dt_iop_demosaic_method_t method)
 
static __DT_CLONE_TARGETS__ void _downsample_bayer_half_size (float *const out, const float *const in, const dt_iop_roi_t *const roi_out, const dt_iop_roi_t *const roi_in, const uint32_t filters, const gboolean is_4bayer, const double CAM_to_RGB[3][4])
 Build one half-size RGB pixel from the 2x2 CFA block backing it.
 
static __DT_CLONE_TARGETS__ float _downsample_xtrans_missing_colour (const float *const in, const dt_iop_roi_t *const roi_in, const int px, const int py, const uint8_t(*const xtrans)[6], const int colour)
 Reconstruct one missing X-Trans colour from the nearest surrounding photosites.
 
static __DT_CLONE_TARGETS__ void _downsample_xtrans_half_size (float *const out, const float *const in, const dt_iop_roi_t *const roi_out, const dt_iop_roi_t *const roi_in, const uint8_t(*const xtrans)[6])
 Build one half-size RGB pixel from a 2x2 X-Trans block.
 
static __DT_CLONE_TARGETS__ void _downsample_guided_laplacian_fit (const float *const restrict HF, float *const restrict coeff, float *const restrict bias, const size_t width, const size_t height)
 Fit one local affine RGB model for the current high-frequency scale.
 
static __DT_CLONE_TARGETS__ void _downsample_guided_laplacian_apply (const float *const restrict HF, const float *const restrict coeff, const float *const restrict bias, const float *const restrict LF, float *const restrict reconstructed, const size_t width, const size_t height, const gboolean reset)
 Apply the locally averaged affine RGB model to one high-frequency layer.
 
static __DT_CLONE_TARGETS__ int _downsample_guided_laplacian_postfilter (float *const out, const size_t width, const size_t height, const int iterations)
 Denoise the half-size demosaic result by filtering its wavelet details.
 
void distort_mask (struct dt_iop_module_t *self, const struct dt_dev_pixelpipe_t *pipe, struct dt_dev_pixelpipe_iop_t *piece, const float *const in, float *const out, const dt_iop_roi_t *const roi_in, const dt_iop_roi_t *const roi_out)
 
void modify_roi_out (struct dt_iop_module_t *self, const struct dt_dev_pixelpipe_t *pipe, struct dt_dev_pixelpipe_iop_t *piece, dt_iop_roi_t *roi_out, const dt_iop_roi_t *const roi_in)
 
void modify_roi_in (struct dt_iop_module_t *self, const struct dt_dev_pixelpipe_t *pipe, struct dt_dev_pixelpipe_iop_t *piece, const dt_iop_roi_t *roi_out, dt_iop_roi_t *roi_in)
 
__DT_CLONE_TARGETS__ int process (struct dt_iop_module_t *self, const dt_dev_pixelpipe_t *pipe, const dt_dev_pixelpipe_iop_t *piece, const void *const i, void *const o)
 
static int process_default_cl (struct dt_iop_module_t *self, const dt_dev_pixelpipe_t *pipe, const dt_dev_pixelpipe_iop_t *piece, cl_mem dev_in, cl_mem dev_out, const dt_iop_roi_t *const roi_in, const dt_iop_roi_t *const roi_out, const int demosaicing_method)
 
static gboolean _downsample_guided_laplacian_postfilter_cl (struct dt_iop_module_t *self, const dt_dev_pixelpipe_t *pipe, cl_mem dev_out, const dt_iop_roi_t *const roi_out, const int iterations)
 
int process_cl (struct dt_iop_module_t *self, const dt_dev_pixelpipe_t *pipe, const dt_dev_pixelpipe_iop_t *piece, cl_mem dev_in, cl_mem dev_out)
 
void tiling_callback (struct dt_iop_module_t *self, const struct dt_dev_pixelpipe_t *pipe, const struct dt_dev_pixelpipe_iop_t *piece, struct dt_develop_tiling_t *tiling)
 
void init_global (dt_iop_module_so_t *module)
 
void cleanup_global (dt_iop_module_so_t *module)
 
gboolean force_enable (struct dt_iop_module_t *self, const gboolean current_state)
 
void commit_params (struct dt_iop_module_t *self, dt_iop_params_t *params, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
 
void init_pipe (struct dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
 
void cleanup_pipe (struct dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
 
void reload_defaults (dt_iop_module_t *module)
 
void gui_changed (dt_iop_module_t *self, GtkWidget *w, void *previous)
 
void gui_update (struct dt_iop_module_t *self)
 
static void _visualize_callback (GtkWidget *quad, gpointer user_data)
 
void gui_focus (struct dt_iop_module_t *self, gboolean in)
 
void gui_init (struct dt_iop_module_t *self)
 

Macro Definition Documentation

◆ BAYER_SNAPPER

#define BAYER_SNAPPER   2

◆ DEMOSAIC_DUAL

#define DEMOSAIC_DUAL   2048

◆ DEMOSAIC_XTRANS

#define DEMOSAIC_XTRANS   1024

◆ DOWNSAMPLE_GUIDED_SCALES

#define DOWNSAMPLE_GUIDED_SCALES   1

◆ INLINE

#define INLINE   inline

◆ REDUCESIZE

#define REDUCESIZE   64

◆ XTRANS_SNAPPER

#define XTRANS_SNAPPER   3

Typedef Documentation

◆ dt_iop_demosaic_data_t

◆ dt_iop_demosaic_global_data_t

◆ dt_iop_demosaic_greeneq_t

◆ dt_iop_demosaic_gui_data_t

◆ dt_iop_demosaic_lmmse_t

◆ dt_iop_demosaic_method_t

◆ dt_iop_demosaic_params_t

◆ dt_iop_demosaic_quality_t

◆ dt_iop_demosaic_smooth_t

Enumeration Type Documentation

◆ dt_iop_demosaic_greeneq_t

Enumerator
DT_IOP_GREEN_EQ_NO 
DT_IOP_GREEN_EQ_LOCAL 
DT_IOP_GREEN_EQ_FULL 
DT_IOP_GREEN_EQ_BOTH 

◆ dt_iop_demosaic_lmmse_t

Enumerator
LMMSE_REFINE_0 
LMMSE_REFINE_1 
LMMSE_REFINE_2 
LMMSE_REFINE_3 
LMMSE_REFINE_4 

◆ dt_iop_demosaic_method_t

Enumerator
DT_IOP_DEMOSAIC_PPG 
DT_IOP_DEMOSAIC_AMAZE 
DT_IOP_DEMOSAIC_VNG4 
DT_IOP_DEMOSAIC_RCD 
DT_IOP_DEMOSAIC_LMMSE 
DT_IOP_DEMOSAIC_RCD_VNG 
DT_IOP_DEMOSAIC_AMAZE_VNG 
DT_IOP_DEMOSAIC_PASSTHROUGH_MONOCHROME 
DT_IOP_DEMOSAIC_PASSTHROUGH_COLOR 
DT_IOP_DEMOSAIC_VNG 
DT_IOP_DEMOSAIC_MARKESTEIJN 
DT_IOP_DEMOSAIC_MARKESTEIJN_3 
DT_IOP_DEMOSAIC_FDC 
DT_IOP_DEMOSAIC_MARKEST3_VNG 
DT_IOP_DEMOSAIC_PASSTHR_MONOX 
DT_IOP_DEMOSAIC_PASSTHR_COLORX 
DT_IOP_DEMOSAIC_DOWNSAMPLE 

◆ dt_iop_demosaic_quality_t

Enumerator
DT_DEMOSAIC_FAST 
DT_DEMOSAIC_FAIR 
DT_DEMOSAIC_BEST 

◆ dt_iop_demosaic_smooth_t

Enumerator
DEMOSAIC_SMOOTH_OFF 
DEMOSAIC_SMOOTH_1 
DEMOSAIC_SMOOTH_2 
DEMOSAIC_SMOOTH_3 
DEMOSAIC_SMOOTH_4 
DEMOSAIC_SMOOTH_5 

Function Documentation

◆ __attribute__()

static __attribute__ ( (always_inline)  )
inlinestatic

◆ _downsample_bayer_half_size()

static __DT_CLONE_TARGETS__ void _downsample_bayer_half_size ( float *const  out,
const float *const  in,
const dt_iop_roi_t *const  roi_out,
const dt_iop_roi_t *const  roi_in,
const uint32_t  filters,
const gboolean  is_4bayer,
const double  CAM_to_RGB[3][4] 
)
static

Build one half-size RGB pixel from the 2x2 CFA block backing it.

The loop walks the sensor block that maps to the output pixel and keeps only the real photosites that actually exist there. Bayer gets one red, one blue and two greens. 4Bayer keeps the four camera primaries, which are converted to RGB right away so the caller stays in the regular RGB pipe.

References __OMP_PARALLEL_FOR__, BLUE, FC(), GREEN, dt_iop_roi_t::height, i, k, MIN, out, RED, dt_iop_roi_t::width, and x.

Referenced by process().

◆ _downsample_guided_laplacian_apply()

static __DT_CLONE_TARGETS__ void _downsample_guided_laplacian_apply ( const float *const restrict  HF,
const float *const restrict  coeff,
const float *const restrict  bias,
const float *const restrict  LF,
float *const restrict  reconstructed,
const size_t  width,
const size_t  height,
const gboolean  reset 
)
static

Apply the locally averaged affine RGB model to one high-frequency layer.

The coefficients and intercept have already been smoothed with the same a-trous kernel as the wavelet scale, so we simply predict each channel from the local RGB HF vector, add the channel-wise intercept, and accumulate the filtered detail bands for later resynthesis.

References __OMP_PARALLEL_FOR__, ALPHA, BLUE, coeff, dt_simd_set1(), dt_store_simd_aligned(), GREEN, height, RED, reset(), row, and width.

Referenced by _downsample_guided_laplacian_postfilter().

◆ _downsample_guided_laplacian_fit()

static __DT_CLONE_TARGETS__ void _downsample_guided_laplacian_fit ( const float *const restrict  HF,
float *const restrict  coeff,
float *const restrict  bias,
const size_t  width,
const size_t  height 
)
static

Fit one local affine RGB model for the current high-frequency scale.

For each pixel we collect a dense immediate 5x5 patch and accumulate its raw RGB and guide moments. We then recover the channel-wise means plus the variance of the shared RGB-average guide from those fixed-size sums, which keeps the hot loop free from running-mean updates and per-sample divisions. The three target-channel slopes are stored as one RGB pixel so the apply stage can evaluate them from the same scalar guide with minimal scratch memory. The intercept is kept in a separate RGB image so its three channel-wise components can be blurred just like the slopes before we reconstruct the filtered detail.

References __OMP_PARALLEL_FOR__, ALPHA, BLUE, BSPLINE_FSIZE, coeff, dt_simd_set1(), dt_store_simd_aligned(), eps, GREEN, height, RED, row, row0, row1, row2, and width.

Referenced by _downsample_guided_laplacian_postfilter().

◆ _downsample_guided_laplacian_postfilter()

static __DT_CLONE_TARGETS__ int _downsample_guided_laplacian_postfilter ( float *const  out,
const size_t  width,
const size_t  height,
const int  iterations 
)
static

Denoise the half-size demosaic result by filtering its wavelet details.

We decompose the half-size RGB image over three a-trous B-spline scales. At each scale we normalize the high-frequency layer by the blur that produced it, fit a local affine RGB model on that relative detail, blur one RGB slope field plus one RGB intercept field over the immediate neighbourhood, then reconstruct a filtered relative detail layer and rescale it back by the current blur. Repeating the full three-scale pass lets the module gradually even out chroma details over several user-selected iterations. The output is the sum of all filtered high frequencies plus the final low-frequency residual.

References __OMP_PARALLEL_FOR__, _downsample_guided_laplacian_apply(), _downsample_guided_laplacian_fit(), ALPHA, BLUE, blur_2D_Bspline(), cleanup(), coeff, decompose_2D_Bspline(), DOWNSAMPLE_GUIDED_SCALES, dt_iop_image_copy_by_size(), dt_omploop_sfence, dt_pixelpipe_cache_alloc_align_float_cache, dt_pixelpipe_cache_alloc_perthread_float, dt_pixelpipe_cache_free_align, dt_store_simd_aligned(), FALSE, GREEN, height, IS_NULL_PTR, out, RED, row, and width.

Referenced by process().

◆ _downsample_guided_laplacian_postfilter_cl()

◆ _downsample_xtrans_half_size()

static __DT_CLONE_TARGETS__ void _downsample_xtrans_half_size ( float *const  out,
const float *const  in,
const dt_iop_roi_t *const  roi_out,
const dt_iop_roi_t *const  roi_in,
const uint8_t(*)  xtrans[6] 
)
static

Build one half-size RGB pixel from a 2x2 X-Trans block.

We first reuse any real photosites that fall inside the 2x2 block mapped to the output pixel. When a colour is absent from that block, we reconstruct it from the nearest surrounding same-colour samples so the half-size image keeps all channels.

References __OMP_PARALLEL_FOR__, _downsample_xtrans_missing_colour(), FCxtrans(), dt_iop_roi_t::height, i, MIN, out, rgb, dt_iop_roi_t::width, and x.

Referenced by process().

◆ _downsample_xtrans_missing_colour()

static __DT_CLONE_TARGETS__ float _downsample_xtrans_missing_colour ( const float *const  in,
const dt_iop_roi_t *const  roi_in,
const int  px,
const int  py,
const uint8_t(*)  xtrans[6],
const int  colour 
)
static

Reconstruct one missing X-Trans colour from the nearest surrounding photosites.

We first look for the closest sample in each quadrant around the half-size pixel centre. When the CFA leaves a 2-pixel chroma gap, these four neighbours define the smallest local rectangle of same-colour samples and we bilinearly interpolate inside it. If the search hits an image edge, we fall back to averaging the available neighbours instead of extrapolating.

References FALSE, FCxtrans(), dt_iop_roi_t::height, MAX, MIN, top, TRUE, and dt_iop_roi_t::width.

Referenced by _downsample_xtrans_half_size().

◆ _is_downsample_method()

static gboolean _is_downsample_method ( const dt_iop_demosaic_method_t  method)
inlinestatic

◆ _visualize_callback()

◆ amaze_demosaic_RT()

void amaze_demosaic_RT ( const dt_dev_pixelpipe_iop_t piece,
const float *const  in,
float *  out,
const dt_iop_roi_t *const  roi_in,
const dt_iop_roi_t *const  roi_out,
const uint32_t  filters 
)

Referenced by process().

◆ cleanup_global()

void cleanup_global ( dt_iop_module_so_t module)

References dt_iop_module_so_t::data, dt_free, dt_opencl_free_kernel(), dt_pixelpipe_cache_free_align, dt_iop_demosaic_global_data_t::kernel_border_interpolate, dt_iop_demosaic_global_data_t::kernel_bspline_horizontal, dt_iop_demosaic_global_data_t::kernel_bspline_horizontal_local, dt_iop_demosaic_global_data_t::kernel_bspline_vertical, dt_iop_demosaic_global_data_t::kernel_bspline_vertical_local, dt_iop_demosaic_global_data_t::kernel_color_smoothing, dt_iop_demosaic_global_data_t::kernel_downsample, dt_iop_demosaic_global_data_t::kernel_green_eq_favg_apply, dt_iop_demosaic_global_data_t::kernel_green_eq_favg_reduce_first, dt_iop_demosaic_global_data_t::kernel_green_eq_favg_reduce_second, dt_iop_demosaic_global_data_t::kernel_green_eq_lavg, dt_iop_demosaic_global_data_t::kernel_guided_laplacian_apply, dt_iop_demosaic_global_data_t::kernel_guided_laplacian_coefficients, dt_iop_demosaic_global_data_t::kernel_guided_laplacian_finalize, dt_iop_demosaic_global_data_t::kernel_guided_laplacian_normalize, dt_iop_demosaic_global_data_t::kernel_markesteijn_accu, dt_iop_demosaic_global_data_t::kernel_markesteijn_convert_yuv, dt_iop_demosaic_global_data_t::kernel_markesteijn_differentiate, dt_iop_demosaic_global_data_t::kernel_markesteijn_final, dt_iop_demosaic_global_data_t::kernel_markesteijn_green_minmax, dt_iop_demosaic_global_data_t::kernel_markesteijn_homo_max, dt_iop_demosaic_global_data_t::kernel_markesteijn_homo_max_corr, dt_iop_demosaic_global_data_t::kernel_markesteijn_homo_quench, dt_iop_demosaic_global_data_t::kernel_markesteijn_homo_set, dt_iop_demosaic_global_data_t::kernel_markesteijn_homo_sum, dt_iop_demosaic_global_data_t::kernel_markesteijn_homo_threshold, dt_iop_demosaic_global_data_t::kernel_markesteijn_initial_copy, dt_iop_demosaic_global_data_t::kernel_markesteijn_interpolate_green, dt_iop_demosaic_global_data_t::kernel_markesteijn_interpolate_twoxtwo, dt_iop_demosaic_global_data_t::kernel_markesteijn_recalculate_green, dt_iop_demosaic_global_data_t::kernel_markesteijn_red_and_blue, dt_iop_demosaic_global_data_t::kernel_markesteijn_solitary_green, dt_iop_demosaic_global_data_t::kernel_markesteijn_zero, dt_iop_demosaic_global_data_t::kernel_passthrough_color, dt_iop_demosaic_global_data_t::kernel_passthrough_monochrome, dt_iop_demosaic_global_data_t::kernel_ppg_green, dt_iop_demosaic_global_data_t::kernel_ppg_redblue, dt_iop_demosaic_global_data_t::kernel_pre_median, dt_iop_demosaic_global_data_t::kernel_rcd_border_green, dt_iop_demosaic_global_data_t::kernel_rcd_border_redblue, dt_iop_demosaic_global_data_t::kernel_rcd_populate, dt_iop_demosaic_global_data_t::kernel_rcd_step_1, dt_iop_demosaic_global_data_t::kernel_rcd_step_2_1, dt_iop_demosaic_global_data_t::kernel_rcd_step_3_1, dt_iop_demosaic_global_data_t::kernel_rcd_step_4_1, dt_iop_demosaic_global_data_t::kernel_rcd_step_4_2, dt_iop_demosaic_global_data_t::kernel_rcd_step_5_1, dt_iop_demosaic_global_data_t::kernel_rcd_step_5_2, dt_iop_demosaic_global_data_t::kernel_rcd_write_output, dt_iop_demosaic_global_data_t::kernel_vng_border_interpolate, dt_iop_demosaic_global_data_t::kernel_vng_green_equilibrate, dt_iop_demosaic_global_data_t::kernel_vng_interpolate, dt_iop_demosaic_global_data_t::kernel_vng_lin_interpolate, dt_iop_demosaic_global_data_t::kernel_write_blended_dual, dt_iop_demosaic_global_data_t::kernel_zoom_half_size, dt_iop_demosaic_global_data_t::kernel_zoom_half_size_xtrans, dt_iop_demosaic_global_data_t::kernel_zoom_passthrough_monochrome, dt_iop_demosaic_global_data_t::kernel_zoom_third_size, dt_iop_demosaic_global_data_t::lmmse_gamma_in, and dt_iop_demosaic_global_data_t::lmmse_gamma_out.

◆ cleanup_pipe()

void cleanup_pipe ( struct dt_iop_module_t self,
dt_dev_pixelpipe_t pipe,
dt_dev_pixelpipe_iop_t piece 
)

◆ commit_params()

◆ default_colorspace()

int default_colorspace ( dt_iop_module_t self,
dt_dev_pixelpipe_t pipe,
const dt_dev_pixelpipe_iop_t piece 
)

References IOP_CS_RAW.

◆ default_group()

int default_group ( )

References IOP_GROUP_TECHNICAL.

◆ description()

const char ** description ( struct dt_iop_module_t self)

◆ distort_mask()

void distort_mask ( struct dt_iop_module_t self,
const struct dt_dev_pixelpipe_t pipe,
struct dt_dev_pixelpipe_iop_t piece,
const float *const  in,
float *const  out,
const dt_iop_roi_t *const  roi_in,
const dt_iop_roi_t *const  roi_out 
)

◆ flags()

int flags ( )

◆ force_enable()

gboolean force_enable ( struct dt_iop_module_t self,
const gboolean  current_state 
)

◆ gui_changed()

◆ gui_focus()

◆ gui_init()

◆ gui_update()

◆ init_global()

void init_global ( dt_iop_module_so_t module)

References dt_opencl_create_kernel(), dt_iop_demosaic_global_data_t::kernel_border_interpolate, dt_iop_demosaic_global_data_t::kernel_bspline_horizontal, dt_iop_demosaic_global_data_t::kernel_bspline_horizontal_local, dt_iop_demosaic_global_data_t::kernel_bspline_vertical, dt_iop_demosaic_global_data_t::kernel_bspline_vertical_local, dt_iop_demosaic_global_data_t::kernel_color_smoothing, dt_iop_demosaic_global_data_t::kernel_downsample, dt_iop_demosaic_global_data_t::kernel_green_eq_favg_apply, dt_iop_demosaic_global_data_t::kernel_green_eq_favg_reduce_first, dt_iop_demosaic_global_data_t::kernel_green_eq_favg_reduce_second, dt_iop_demosaic_global_data_t::kernel_green_eq_lavg, dt_iop_demosaic_global_data_t::kernel_guided_laplacian_apply, dt_iop_demosaic_global_data_t::kernel_guided_laplacian_coefficients, dt_iop_demosaic_global_data_t::kernel_guided_laplacian_finalize, dt_iop_demosaic_global_data_t::kernel_guided_laplacian_normalize, dt_iop_demosaic_global_data_t::kernel_markesteijn_accu, dt_iop_demosaic_global_data_t::kernel_markesteijn_convert_yuv, dt_iop_demosaic_global_data_t::kernel_markesteijn_differentiate, dt_iop_demosaic_global_data_t::kernel_markesteijn_final, dt_iop_demosaic_global_data_t::kernel_markesteijn_green_minmax, dt_iop_demosaic_global_data_t::kernel_markesteijn_homo_max, dt_iop_demosaic_global_data_t::kernel_markesteijn_homo_max_corr, dt_iop_demosaic_global_data_t::kernel_markesteijn_homo_quench, dt_iop_demosaic_global_data_t::kernel_markesteijn_homo_set, dt_iop_demosaic_global_data_t::kernel_markesteijn_homo_sum, dt_iop_demosaic_global_data_t::kernel_markesteijn_homo_threshold, dt_iop_demosaic_global_data_t::kernel_markesteijn_initial_copy, dt_iop_demosaic_global_data_t::kernel_markesteijn_interpolate_green, dt_iop_demosaic_global_data_t::kernel_markesteijn_interpolate_twoxtwo, dt_iop_demosaic_global_data_t::kernel_markesteijn_recalculate_green, dt_iop_demosaic_global_data_t::kernel_markesteijn_red_and_blue, dt_iop_demosaic_global_data_t::kernel_markesteijn_solitary_green, dt_iop_demosaic_global_data_t::kernel_markesteijn_zero, dt_iop_demosaic_global_data_t::kernel_passthrough_color, dt_iop_demosaic_global_data_t::kernel_passthrough_monochrome, dt_iop_demosaic_global_data_t::kernel_ppg_green, dt_iop_demosaic_global_data_t::kernel_ppg_redblue, dt_iop_demosaic_global_data_t::kernel_pre_median, dt_iop_demosaic_global_data_t::kernel_rcd_border_green, dt_iop_demosaic_global_data_t::kernel_rcd_border_redblue, dt_iop_demosaic_global_data_t::kernel_rcd_populate, dt_iop_demosaic_global_data_t::kernel_rcd_step_1, dt_iop_demosaic_global_data_t::kernel_rcd_step_2_1, dt_iop_demosaic_global_data_t::kernel_rcd_step_3_1, dt_iop_demosaic_global_data_t::kernel_rcd_step_4_1, dt_iop_demosaic_global_data_t::kernel_rcd_step_4_2, dt_iop_demosaic_global_data_t::kernel_rcd_step_5_1, dt_iop_demosaic_global_data_t::kernel_rcd_step_5_2, dt_iop_demosaic_global_data_t::kernel_rcd_write_output, dt_iop_demosaic_global_data_t::kernel_vng_border_interpolate, dt_iop_demosaic_global_data_t::kernel_vng_green_equilibrate, dt_iop_demosaic_global_data_t::kernel_vng_interpolate, dt_iop_demosaic_global_data_t::kernel_vng_lin_interpolate, dt_iop_demosaic_global_data_t::kernel_write_blended_dual, dt_iop_demosaic_global_data_t::kernel_zoom_half_size, dt_iop_demosaic_global_data_t::kernel_zoom_half_size_xtrans, dt_iop_demosaic_global_data_t::kernel_zoom_passthrough_monochrome, dt_iop_demosaic_global_data_t::kernel_zoom_third_size, dt_iop_demosaic_global_data_t::lmmse_gamma_in, and dt_iop_demosaic_global_data_t::lmmse_gamma_out.

◆ init_pipe()

◆ input_format()

◆ legacy_params()

int legacy_params ( dt_iop_module_t self,
const void *const  old_params,
const int  old_version,
void new_params,
const int  new_version 
)

◆ modify_roi_in()

◆ modify_roi_out()

◆ name()

const char * name ( )
Todo:
: handle all the branching uniformingly

◆ output_format()

◆ process()

__DT_CLONE_TARGETS__ int process ( struct dt_iop_module_t self,
const dt_dev_pixelpipe_t pipe,
const dt_dev_pixelpipe_iop_t piece,
const void *const  i,
void *const  o 
)

References _downsample_bayer_half_size(), _downsample_guided_laplacian_postfilter(), _downsample_xtrans_half_size(), _is_downsample_method(), amaze_demosaic_RT(), dt_iop_demosaic_data_t::CAM_to_RGB, dt_times_t::clock, dt_iop_demosaic_data_t::color_smoothing, color_smoothing(), darktable, dt_dev_pixelpipe_iop_t::data, DEMOSAIC_DUAL, demosaic_ppg(), dt_iop_demosaic_data_t::demosaicing_method, dt_iop_module_t::dev, double(), dt_dev_pixelpipe_iop_t::dsc_in, dt_colorspaces_cygm_to_rgb(), DT_DEBUG_DEMOSAIC, DT_DEBUG_PERF, DT_DEV_PIXELPIPE_DISPLAY_PASSTHRU, DT_DEV_PIXELPIPE_DISPLAY_PASSTHRU_MONO, DT_DEV_PIXELPIPE_FULL, dt_get_times(), DT_IMAGE_4BAYER, DT_IOP_DEMOSAIC_AMAZE, DT_IOP_DEMOSAIC_FDC, DT_IOP_DEMOSAIC_LMMSE, DT_IOP_DEMOSAIC_MARKEST3_VNG, DT_IOP_DEMOSAIC_MARKESTEIJN, DT_IOP_DEMOSAIC_PASSTHROUGH_COLOR, DT_IOP_DEMOSAIC_PASSTHROUGH_MONOCHROME, DT_IOP_DEMOSAIC_RCD, DT_IOP_DEMOSAIC_VNG4, DT_IOP_GREEN_EQ_BOTH, DT_IOP_GREEN_EQ_FULL, DT_IOP_GREEN_EQ_LOCAL, DT_IOP_GREEN_EQ_NO, dt_pixelpipe_cache_alloc_align_float, dt_pixelpipe_cache_alloc_align_float_cache, dt_pixelpipe_cache_free_align, dual_demosaic(), dt_iop_demosaic_data_t::dual_thrs, dt_image_t::exif_iso, FALSE, dt_iop_buffer_dsc_t::filters, dt_image_t::flags, g, dt_iop_module_t::global_data, dt_iop_demosaic_data_t::green_eq, green_equilibration_favg(), green_equilibration_lavg(), dt_develop_t::gui_attached, dt_iop_module_t::gui_data, dt_iop_roi_t::height, i, dt_develop_t::image_storage, IS_NULL_PTR, lmmse_demosaic(), dt_iop_demosaic_global_data_t::lmmse_gamma_in, dt_iop_demosaic_global_data_t::lmmse_gamma_out, dt_iop_demosaic_data_t::lmmse_refine, dt_dev_pixelpipe_t::mask_display, dt_iop_demosaic_data_t::median_thrs, passthrough_color(), passthrough_monochrome(), dt_iop_buffer_dsc_t::processed_maximum, rcd_demosaic(), dt_dev_pixelpipe_iop_t::roi_in, dt_dev_pixelpipe_iop_t::roi_out, threshold, dt_dev_pixelpipe_t::type, darktable_t::unmuted, dt_times_t::user, vng_interpolate(), dt_iop_roi_t::width, x, dt_iop_roi_t::x, dt_iop_buffer_dsc_t::xtrans, xtrans_fdc_interpolate(), xtrans_markesteijn_interpolate(), and dt_iop_roi_t::y.

◆ process_cl()

int process_cl ( struct dt_iop_module_t self,
const dt_dev_pixelpipe_t pipe,
const dt_dev_pixelpipe_iop_t piece,
cl_mem  dev_in,
cl_mem  dev_out 
)

References _downsample_guided_laplacian_postfilter_cl(), _is_downsample_method(), dt_iop_demosaic_data_t::CAM_to_RGB, dt_times_t::clock, dt_iop_demosaic_data_t::color_smoothing, color_smoothing_cl(), darktable, dt_dev_pixelpipe_iop_t::data, DEMOSAIC_DUAL, dt_iop_demosaic_data_t::demosaicing_method, dt_iop_module_t::dev, dt_dev_pixelpipe_t::devid, dt_dev_pixelpipe_iop_t::dsc_in, dt_control_log(), DT_DEBUG_DEMOSAIC, DT_DEBUG_OPENCL, DT_DEBUG_PERF, DT_DEV_PIXELPIPE_DISPLAY_PASSTHRU, DT_DEV_PIXELPIPE_DISPLAY_PASSTHRU_MONO, DT_DEV_PIXELPIPE_FULL, dt_get_times(), DT_IMAGE_4BAYER, dt_iop_clip_and_zoom_roi_cl(), DT_IOP_DEMOSAIC_MARKESTEIJN, DT_IOP_DEMOSAIC_MARKESTEIJN_3, DT_IOP_DEMOSAIC_PASSTHROUGH_COLOR, DT_IOP_DEMOSAIC_PASSTHROUGH_MONOCHROME, DT_IOP_DEMOSAIC_PPG, DT_IOP_DEMOSAIC_RCD, DT_IOP_DEMOSAIC_VNG, DT_IOP_DEMOSAIC_VNG4, dt_opencl_alloc_device(), dt_opencl_alloc_device_buffer(), dt_opencl_copy_host_to_device_constant(), dt_opencl_enqueue_kernel_2d(), dt_opencl_release_mem_object(), dt_opencl_set_kernel_arg(), dt_print(), dual_demosaic_cl(), dt_iop_demosaic_data_t::dual_thrs, FALSE, dt_iop_buffer_dsc_t::filters, dt_image_t::flags, g, dt_iop_module_t::global_data, dt_develop_t::gui_attached, dt_iop_module_t::gui_data, height, dt_iop_roi_t::height, dt_develop_t::image_storage, IS_NULL_PTR, dt_iop_demosaic_global_data_t::kernel_zoom_half_size, dt_iop_demosaic_global_data_t::kernel_zoom_half_size_xtrans, dt_dev_pixelpipe_t::mask_display, process_default_cl(), process_markesteijn_cl(), process_rcd_cl(), process_vng_cl(), dt_dev_pixelpipe_iop_t::roi_in, dt_dev_pixelpipe_iop_t::roi_out, ROUNDUPDHT, ROUNDUPDWD, dt_iop_roi_t::scale, TRUE, dt_dev_pixelpipe_t::type, darktable_t::unmuted, dt_times_t::user, width, dt_iop_roi_t::width, dt_iop_roi_t::x, dt_iop_buffer_dsc_t::xtrans, and dt_iop_roi_t::y.

◆ process_default_cl()

static int process_default_cl ( struct dt_iop_module_t self,
const dt_dev_pixelpipe_t pipe,
const dt_dev_pixelpipe_iop_t piece,
cl_mem  dev_in,
cl_mem  dev_out,
const dt_iop_roi_t *const  roi_in,
const dt_iop_roi_t *const  roi_out,
const int  demosaicing_method 
)
static

◆ reload_defaults()

◆ tiling_callback()