36 return 0.005f * powf(slider, 1.1f);
40 float *
const restrict rgb_data,
const float *
const restrict raw_data,
42 const uint32_t filters,
const uint8_t (*
const xtrans)[6],
43 const gboolean dual_mask,
float dual_threshold)
50 if(dual_threshold <= 0.0f)
return 0;
60 dt_control_log(_(
"[dual demosaic] can't allocate internal buffers"));
75 dt_times_t start_blend = { 0 }, end_blend = { 0 };
89 for(
int c = 0; c < 4; c++)
90 rgb_data[idx * 4 + c] = blend[idx];
98 const int oidx = 4 * idx;
99 for(
int c = 0; c < 4; c++)
100 rgb_data[oidx + c] =
intp(blend[idx], rgb_data[oidx + c], vng_image[oidx + c]);
106 fprintf(stderr,
" [demosaic] CPU dual blending %.4f secs (%.4f CPU)\n", end_blend.clock - start_blend.
clock, end_blend.user - start_blend.
user);
117 cl_mem high_image, cl_mem low_image, cl_mem
out,
const int width,
118 const int height,
const int showmask)
120 const int devid = pipe->
devid;
141 if(err != CL_SUCCESS)
return FALSE;
152 if(err != CL_SUCCESS)
return FALSE;
166 if(err != CL_SUCCESS)
return FALSE;
172 cl_mem dev_blurmat = NULL;
185 if(err != CL_SUCCESS)
return FALSE;
204 if(err != CL_SUCCESS)
return FALSE;
static __DT_CLONE_TARGETS__ void color_smoothing(float *out, const dt_iop_roi_t *const roi_out, const int num_passes)
static float intp(const float a, const float b, const float c)
const dt_colormatrix_t dt_aligned_pixel_t out
void dt_control_log(const char *msg,...)
static void dt_get_times(dt_times_t *t)
#define dt_pixelpipe_cache_free_align(mem)
#define dt_pixelpipe_cache_alloc_align_float(pixels, pipe)
#define __DT_CLONE_TARGETS__
#define __OMP_FOR_SIMD__(...)
#define IS_NULL_PTR(p)
C is way too permissive with !=, == and if(var) checks, which can mean too many things depending on w...
@ DT_DEV_PIXELPIPE_DISPLAY_PASSTHRU
static __DT_CLONE_TARGETS__ int dual_demosaic(const dt_dev_pixelpipe_t *pipe, const dt_dev_pixelpipe_iop_t *piece, float *const restrict rgb_data, const float *const restrict raw_data, dt_iop_roi_t *const roi_out, const dt_iop_roi_t *const roi_in, const uint32_t filters, const uint8_t(*const xtrans)[6], const gboolean dual_mask, float dual_threshold)
static float slider2contrast(float slider)
gboolean dual_demosaic_cl(struct dt_iop_module_t *self, const dt_dev_pixelpipe_t *pipe, const dt_dev_pixelpipe_iop_t *piece, cl_mem detail, cl_mem blend, cl_mem high_image, cl_mem low_image, cl_mem out, const int width, const int height, const int showmask)
static float kernel(const float *x, const float *y)
void dt_masks_calc_detail_mask(float *const src, float *const out, float *const tmp, const int width, const int height, const float threshold, const gboolean detail)
void dt_masks_blur_9x9_coeff(float *coeffs, const float sigma)
void dt_masks_calc_rawdetail_mask(float *const src, float *const out, float *const tmp, const int width, const int height, const dt_aligned_pixel_t wb)
float dt_aligned_pixel_t[4]
int dt_opencl_enqueue_kernel_2d(const int dev, const int kernel, const size_t *sizes)
void * dt_opencl_copy_host_to_device_constant(const int devid, const size_t size, void *host)
int dt_opencl_set_kernel_arg(const int dev, const int kernel, const int num, const size_t size, const void *arg)
void dt_opencl_release_mem_object(cl_mem mem)
struct dt_opencl_t * opencl
int kernel_calc_scharr_mask
dt_iop_buffer_dsc_t dsc_in
struct dt_iop_module_t *void * data
dt_dev_pixelpipe_type_t type
dt_aligned_pixel_t coeffs
struct dt_iop_buffer_dsc_t::@30 temperature
int kernel_write_blended_dual
dt_iop_global_data_t * global_data
Region of interest passed through the pixelpipe.
struct dt_blendop_cl_global_t * blendop
static __DT_CLONE_TARGETS__ int vng_interpolate(float *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 uint8_t(*const xtrans)[6], const int only_vng_linear)