19#ifndef DT_IOP_HIGHLIGHTS_CHROMA_H
20#define DT_IOP_HIGHLIGHTS_CHROMA_H
31 float *
const restrict tensor_xy,
float *
const restrict tensor_yy,
float *
const restrict scratch,
32 const int region_w,
const int region_h);
48void _aniso_iterate_obs(
float *
const restrict field,
const float *
const restrict obstacle,
49 const uint8_t *
const restrict hole,
const float *
const restrict tensor_xx,
50 const float *
const restrict tensor_xy,
const float *
const restrict tensor_yy,
51 float *
const restrict tmp,
const int region_w,
const int region_h,
const int iters,
52 const int box_x_lo,
const int box_y_lo,
const int box_x_hi,
const int box_y_hi,
53 const float react,
const float react_target);
55static inline float _aniso_edge_w(
const float *
const restrict tensor_xx,
const float *
const restrict tensor_xy,
56 const float *
const restrict tensor_yy,
const size_t i,
const size_t j,
57 const int offset_x,
const int offset_y)
59 const float avg_xx = 0.5f * (tensor_xx[
i] + tensor_xx[j]);
60 const float avg_yy = 0.5f * (tensor_yy[
i] + tensor_yy[j]);
61 const float limit = fminf(avg_xx, avg_yy);
63 = CLAMP(0.5f * (tensor_xy[
i] + tensor_xy[j]), -limit, limit);
65 if(offset_y == 0)
return fmaxf(avg_xx - fabsf(cross), 1e-4f);
66 if(offset_x == 0)
return fmaxf(avg_yy - fabsf(cross), 1e-4f);
67 if(offset_x == offset_y)
return fmaxf(cross, 0.f);
68 return fmaxf(-cross, 0.f);
83int _aniso_div_solve(
float *
const restrict ratios,
const float *
const restrict valid,
84 const float *
const restrict
luminance,
float *
const restrict scratch_planes,
85 const int region_w,
const int region_h,
const float react,
90#if defined(HAVE_OPENCL) && DT_HL_SPARSE_SOLVE && (DT_HL_ANISO_SOLVER == 2)
107cl_int _aniso_stage_cl(
const int devid,
void *gd_void, cl_mem estimate, cl_mem valid, cl_mem clip0,
108 const int region_w,
const int region_h,
const float radius,
const float floor_gate,
void _aniso_iterate_obs(float *const restrict field, const float *const restrict obstacle, const uint8_t *const restrict hole, const float *const restrict tensor_xx, const float *const restrict tensor_xy, const float *const restrict tensor_yy, float *const restrict tmp, const int region_w, const int region_h, const int iters, const int box_x_lo, const int box_y_lo, const int box_x_hi, const int box_y_hi, const float react, const float react_target)
void _aniso_tensor(const float *const restrict luminance, float *const restrict tensor_xx, float *const restrict tensor_xy, float *const restrict tensor_yy, float *const restrict scratch, const int region_w, const int region_h)
void _aniso_chroma(_hl_region_ctx_t *const ctx)
int _aniso_div_solve(float *const restrict ratios, const float *const restrict valid, const float *const restrict luminance, float *const restrict scratch_planes, const int region_w, const int region_h, const float react, const dt_aligned_pixel_t react_target, const dt_dev_pixelpipe_t *pipe)
static float _aniso_edge_w(const float *const restrict tensor_xx, const float *const restrict tensor_xy, const float *const restrict tensor_yy, const size_t i, const size_t j, const int offset_x, const int offset_y)
float *const restrict luminance
DT_ALIGNED_PIXEL float dt_aligned_pixel_t[4]