33#define DT_BLENDIF_LAB_CH 4
34#define DT_BLENDIF_LAB_BCH 3
38 float *
const restrict
out,
const float *
const restrict mask,
const size_t stride,
43static inline
float _CLAMP(const
float x, const
float min, const
float max)
45 return fminf(fmaxf(
x,
min),
max);
56 const
float *const restrict parameters)
59 if(
value <= parameters[0])
64 else if(
value < parameters[1])
69 else if(
value <= parameters[2])
74 else if(
value < parameters[3])
77 factor = 1.0f - (
value - parameters[2]) * parameters[5];
88static inline
void _blendif_lab_l(const float *const restrict pixels, float *const restrict mask,
89 const size_t stride, const float *const restrict parameters,
90 const unsigned int invert_mask)
99static inline
void _blendif_lab_a(const float *const restrict pixels, float *const restrict
mask,
100 const size_t stride, const float *const restrict parameters,
101 const unsigned int invert_mask)
110static inline
void _blendif_lab_b(const float *const restrict pixels, float *const restrict
mask,
111 const size_t stride, const float *const restrict parameters,
112 const unsigned int invert_mask)
121static inline
void _blendif_lch(const float *const restrict pixels, float *const restrict mask,
122 const size_t stride, const float *const restrict parameters,
123 const unsigned int *const restrict invert_mask)
125 const float c_scale = 1.0f / (128.0f * sqrtf(2.0f));
129 dt_Lab_2_LCH(pixels + j,
LCH);
138static
void _blendif_combine_channels(const float *const restrict pixels, float *const restrict mask,
139 const size_t stride, const unsigned int blendif,
140 const float *const restrict parameters)
175 const float *
const restrict b,
float *
const restrict mask)
183 const int xoffs = roi_out->
x - roi_in->
x;
184 const int yoffs = roi_out->
y - roi_in->
y;
185 const int iwidth = roi_in->
width;
186 const int owidth = roi_out->
width;
187 const int oheight = roi_out->
height;
199 const size_t buffsize = (size_t)owidth * oheight;
202 const float global_opacity =
clamp_simd(
d->opacity / 100.0f);
210 for(
size_t x = 0;
x < buffsize;
x++) mask[
x] = global_opacity * (1.0f - mask[
x]);
217 else if(canceling_channel || !any_channel_active)
222 if((mask_inversed == 0) ^ (mask_inclusive == 0))
249 for(
size_t x = 0;
x < buffsize;
x++) temp_mask[
x] = 1.0f;
253 for(
size_t y = 0; y < oheight; y++)
256 _blendif_combine_channels(a + start, temp_mask + (y * owidth), owidth, blendif, parameters);
259 for(
size_t y = 0; y < oheight; y++)
262 _blendif_combine_channels(b + start, temp_mask + (y * owidth), owidth, blendif >>
DEVELOP_BLENDIF_L_out,
272 for(
size_t x = 0;
x < buffsize;
x++) mask[
x] = global_opacity * (1.0f - mask[
x]) * temp_mask[
x];
277 for(
size_t x = 0;
x < buffsize;
x++) mask[
x] = global_opacity * (1.0f - (1.0f - mask[
x]) * temp_mask[
x]);
285 for(
size_t x = 0;
x < buffsize;
x++) mask[
x] = global_opacity * (1.0f - mask[
x] * temp_mask[
x]);
290 for(
size_t x = 0;
x < buffsize;
x++) mask[
x] = global_opacity * mask[
x] * temp_mask[
x];
305 o[c] =
i[c] * scale[c];
313 o[c] =
i[c] * scale[c];
319static
void _blend_normal_bounded(const float *const restrict a, const float *const restrict b,
320 float *const restrict
out, const float *const restrict mask, const size_t stride,
323 for(
size_t i = 0;
i < stride;
i++)
326 const float local_opacity = mask[
i];
333 tb[
x] =
_CLAMP(ta[
x] * (1.0f - local_opacity) + tb[
x] * local_opacity,
min[
x],
max[
x]);
342static
void _blend_normal_unbounded(const float *const restrict a, const float *const restrict
b,
343 float *const restrict
out,
344 const float *const restrict
mask, const size_t stride,
347 for(
size_t i = 0;
i < stride;
i++)
350 const float local_opacity =
mask[
i];
357 tb[
x] = ta[
x] * (1.0f - local_opacity) + tb[
x] * local_opacity;
366static
void _blend_lighten(const float *const restrict a, const float *const restrict
b,
367 float *const restrict
out, const float *const restrict
mask, const size_t stride,
372 const float local_opacity =
mask[
i];
378 tb[0] =
_CLAMP(ta[0] * (1.0f - local_opacity) + (ta[0] > tb[0] ? ta[0] : tb[0]) * local_opacity,
380 tb[1] =
_CLAMP(ta[1] * (1.0f - fabsf(tb[0] - ta[0])) + 0.5f * (ta[1] + tb[1]) * fabsf(tb[0] - ta[0]),
382 tb[2] =
_CLAMP(ta[2] * (1.0f - fabsf(tb[0] - ta[0])) + 0.5f * (ta[2] + tb[2]) * fabsf(tb[0] - ta[0]),
392static
void _blend_darken(const float *const restrict a, const float *const restrict
b,
393 float *const restrict
out, const float *const restrict
mask, const size_t stride,
398 const float local_opacity =
mask[
i];
404 tb[0] =
_CLAMP(ta[0] * (1.0f - local_opacity) + (ta[0] < tb[0] ? ta[0] : tb[0]) * local_opacity,
406 tb[1] =
_CLAMP(ta[1] * (1.0f - fabsf(tb[0] - ta[0])) + 0.5f * (ta[1] + tb[1]) * fabsf(tb[0] - ta[0]),
408 tb[2] =
_CLAMP(ta[2] * (1.0f - fabsf(tb[0] - ta[0])) + 0.5f * (ta[2] + tb[2]) * fabsf(tb[0] - ta[0]),
418static
void _blend_multiply(const float *const restrict a, const float *const restrict
b,
419 float *const restrict
out, const float *const restrict
mask, const size_t stride,
424 const float local_opacity =
mask[
i];
430 tb[0] =
_CLAMP(ta[0] * (1.0f - local_opacity) + (ta[0] * tb[0]) * local_opacity,
min[0],
max[0]);
432 const float f = fmaxf(ta[0], 0.01f);
433 tb[1] =
_CLAMP(ta[1] * (1.0f - local_opacity) + (ta[1] + tb[1]) * tb[0] /
f * local_opacity,
min[1],
max[1]);
434 tb[2] =
_CLAMP(ta[2] * (1.0f - local_opacity) + (ta[2] + tb[2]) * tb[0] /
f * local_opacity,
min[2],
max[2]);
443static
void _blend_average(const float *const restrict a, const float *const restrict
b,
444 float *const restrict
out, const float *const restrict
mask, const size_t stride,
447 for(
size_t i = 0;
i < stride;
i++)
450 const float local_opacity =
mask[
i];
457 tb[
x] =
_CLAMP(ta[
x] * (1.0f - local_opacity) + (ta[
x] + tb[
x]) / 2.0f * local_opacity,
min[
x],
max[
x]);
466static
void _blend_add(const float *const restrict a, const float *const restrict
b,
467 float *const restrict
out, const float *const restrict
mask, const size_t stride,
470 for(
size_t i = 0;
i < stride;
i++)
473 const float local_opacity =
mask[
i];
480 tb[
x] =
_CLAMP(ta[
x] * (1.0f - local_opacity) + (ta[
x] + tb[
x]) * local_opacity,
min[
x],
max[
x]);
489static
void _blend_subtract(const float *const restrict a, const float *const restrict
b,
490 float *const restrict
out, const float *const restrict
mask, const size_t stride,
493 for(
size_t i = 0;
i < stride;
i++)
496 float local_opacity =
mask[
i];
503 tb[
x] =
_CLAMP(ta[
x] * (1.0f - local_opacity) + ((tb[
x] + ta[
x]) - (fabsf(
min[
x] +
max[
x]))) * local_opacity,
513static
void _blend_difference(const float *const restrict a, const float *const restrict
b,
514 float *const restrict
out, const float *const restrict
mask, const size_t stride,
519 const float local_opacity =
mask[
i];
525 const float lmin = 0.0f;
526 for(
size_t x = 0;
x < 3;
x++)
528 float lmax =
max[
x] + fabsf(
min[
x]);
529 float la =
_CLAMP(ta[
x] + fabsf(
min[
x]), lmin, lmax);
530 float lb =
_CLAMP(tb[
x] + fabsf(
min[
x]), lmin, lmax);
531 tb[
x] =
_CLAMP(la * (1.0f - local_opacity) + fabsf(la - lb) * local_opacity, lmin, lmax) - fabsf(
min[
x]);
541static
void _blend_difference2(const float *const restrict a, const float *const restrict
b,
542 float *const restrict
out, const float *const restrict
mask, const size_t stride,
547 const float local_opacity =
mask[
i];
554 tb[
x] = fabsf(ta[
x] - tb[
x]) / fabsf(
max[
x] -
min[
x]);
555 tb[0] = fmaxf(tb[0], fmaxf(tb[1], tb[2]));
557 tb[0] =
_CLAMP(ta[0] * (1.0f - local_opacity) + tb[0] * local_opacity,
min[0],
max[0]);
568static
void _blend_screen(const float *const restrict a, const float *const restrict
b,
569 float *const restrict
out, const float *const restrict
mask, const size_t stride,
574 const float local_opacity =
mask[
i];
580 const float lmin = 0.0f;
581 const float lmax =
max[0] + fabsf(
min[0]);
582 const float la =
_CLAMP(ta[0] + fabsf(
min[0]), lmin, lmax);
583 const float lb =
_CLAMP(tb[0] + fabsf(
min[0]), lmin, lmax);
585 tb[0] =
_CLAMP(la * (1.0f - local_opacity) + ((lmax - (lmax - la) * (lmax - lb))) * local_opacity, lmin, lmax)
588 const float f = fmaxf(ta[0], 0.01f);
589 tb[1] =
_CLAMP(ta[1] * (1.0f - local_opacity) + 0.5f * (ta[1] + tb[1]) * tb[0] /
f * local_opacity,
591 tb[2] =
_CLAMP(ta[2] * (1.0f - local_opacity) + 0.5f * (ta[2] + tb[2]) * tb[0] /
f * local_opacity,
601static
void _blend_overlay(const float *const restrict a, const float *const restrict
b,
602 float *const restrict
out, const float *const restrict
mask, const size_t stride,
607 const float local_opacity =
mask[
i];
608 const float local_opacity2 = local_opacity * local_opacity;
614 const float lmin = 0.0f;
615 const float lmax =
max[0] + fabsf(
min[0]);
616 const float la =
_CLAMP(ta[0] + fabsf(
min[0]), lmin, lmax);
617 const float lb =
_CLAMP(tb[0] + fabsf(
min[0]), lmin, lmax);
618 const float halfmax = lmax / 2.0f;
619 const float doublemax = lmax * 2.0f;
621 tb[0] =
_CLAMP(la * (1.0f - local_opacity2)
622 + (la > halfmax ? lmax - (lmax - doublemax * (la - halfmax)) * (lmax - lb)
623 : (doublemax * la) * lb)
624 * local_opacity2, lmin, lmax)
627 const float f = fmaxf(ta[0], 0.01f);
628 tb[1] =
_CLAMP(ta[1] * (1.0f - local_opacity2) + (ta[1] + tb[1]) * tb[0] /
f * local_opacity2,
min[1],
max[1]);
629 tb[2] =
_CLAMP(ta[2] * (1.0f - local_opacity2) + (ta[2] + tb[2]) * tb[0] /
f * local_opacity2,
min[2],
max[2]);
638static
void _blend_softlight(const float *const restrict a, const float *const restrict
b,
639 float *const restrict
out, const float *const restrict
mask, const size_t stride,
644 const float local_opacity =
mask[
i];
645 const float local_opacity2 = local_opacity * local_opacity;
651 const float lmin = 0.0f;
652 const float lmax =
max[0] + fabsf(
min[0]);
653 const float la =
_CLAMP(ta[0] + fabsf(
min[0]), lmin, lmax);
654 const float lb =
_CLAMP(tb[0] + fabsf(
min[0]), lmin, lmax);
655 const float halfmax = lmax / 2.0f;
657 tb[0] =
_CLAMP(la * (1.0f - local_opacity2)
658 + (lb > halfmax ? lmax - (lmax - la) * (lmax - (lb - halfmax))
659 : la * (lb + halfmax))
660 * local_opacity2, lmin, lmax)
663 const float f = fmaxf(ta[0], 0.01f);
664 tb[1] =
_CLAMP(ta[1] * (1.0f - local_opacity2) + (ta[1] + tb[1]) * tb[0] /
f * local_opacity2,
min[1],
max[1]);
665 tb[2] =
_CLAMP(ta[2] * (1.0f - local_opacity2) + (ta[2] + tb[2]) * tb[0] /
f * local_opacity2,
min[2],
max[2]);
674static
void _blend_hardlight(const float *const restrict a, const float *const restrict
b,
675 float *const restrict
out, const float *const restrict
mask, const size_t stride,
680 const float local_opacity =
mask[
i];
681 const float local_opacity2 = local_opacity * local_opacity;
687 const float lmin = 0.0f;
688 const float lmax =
max[0] + fabsf(
min[0]);
689 const float la =
_CLAMP(ta[0] + fabsf(
min[0]), lmin, lmax);
690 const float lb =
_CLAMP(tb[0] + fabsf(
min[0]), lmin, lmax);
691 const float halfmax = lmax / 2.0f;
692 const float doublemax = lmax * 2.0f;
694 tb[0] =
_CLAMP(la * (1.0f - local_opacity2)
695 + (lb > halfmax ? lmax - (lmax - doublemax * (la - halfmax)) * (lmax - lb)
696 : doublemax * la * lb)
697 * local_opacity2, lmin, lmax)
700 const float f = fmaxf(ta[0], 0.01f);
701 tb[1] =
_CLAMP(ta[1] * (1.0f - local_opacity2) + (ta[1] + tb[1]) * tb[0] /
f * local_opacity2,
min[1],
max[1]);
702 tb[2] =
_CLAMP(ta[2] * (1.0f - local_opacity2) + (ta[2] + tb[2]) * tb[0] /
f * local_opacity2,
min[2],
max[2]);
711static
void _blend_vividlight(const float *const restrict a, const float *const restrict
b,
712 float *const restrict
out, const float *const restrict
mask, const size_t stride,
717 const float local_opacity =
mask[
i];
718 const float local_opacity2 = local_opacity * local_opacity;
724 const float lmin = 0.0f;
725 const float lmax =
max[0] + fabsf(
min[0]);
726 const float la =
_CLAMP(ta[0] + fabsf(
min[0]), lmin, lmax);
727 const float lb =
_CLAMP(tb[0] + fabsf(
min[0]), lmin, lmax);
728 const float halfmax = lmax / 2.0f;
729 const float doublemax = lmax * 2.0f;
731 tb[0] =
_CLAMP(la * (1.0f - local_opacity2)
732 + (lb > halfmax ? (lb >= lmax ? lmax : la / (doublemax * (lmax - lb)))
733 : (lb <= lmin ? lmin : lmax - (lmax - la) / (doublemax * lb)))
734 * local_opacity2, lmin, lmax)
737 const float f = fmaxf(ta[0], 0.01f);
738 tb[1] =
_CLAMP(ta[1] * (1.0f - local_opacity2) + (ta[1] + tb[1]) * tb[0] /
f * local_opacity2,
min[1],
max[1]);
739 tb[2] =
_CLAMP(ta[2] * (1.0f - local_opacity2) + (ta[2] + tb[2]) * tb[0] /
f * local_opacity2,
min[2],
max[2]);
748static
void _blend_linearlight(const float *const restrict a, const float *const restrict
b,
749 float *const restrict
out, const float *const restrict
mask, const size_t stride,
754 const float local_opacity =
mask[
i];
755 const float local_opacity2 = local_opacity * local_opacity;
761 const float lmin = 0.0f;
762 const float lmax =
max[0] + fabsf(
min[0]);
763 const float la =
_CLAMP(ta[0] + fabsf(
min[0]), lmin, lmax);
764 const float lb =
_CLAMP(tb[0] + fabsf(
min[0]), lmin, lmax);
765 const float doublemax = lmax * 2.0f;
767 tb[0] =
_CLAMP(la * (1.0f - local_opacity2) + (la + doublemax * lb - lmax) * local_opacity2, lmin, lmax)
770 const float f = fmaxf(ta[0], 0.01f);
771 tb[1] =
_CLAMP(ta[1] * (1.0f - local_opacity2) + (ta[1] + tb[1]) * tb[0] /
f * local_opacity2,
min[1],
max[1]);
772 tb[2] =
_CLAMP(ta[2] * (1.0f - local_opacity2) + (ta[2] + tb[2]) * tb[0] /
f * local_opacity2,
min[2],
max[2]);
781static
void _blend_pinlight(const float *const restrict a, const float *const restrict
b,
782 float *const restrict
out, const float *const restrict
mask, const size_t stride,
787 const float local_opacity =
mask[
i];
788 const float local_opacity2 = local_opacity * local_opacity;
794 const float lmin = 0.0f;
795 const float lmax =
max[0] + fabsf(
min[0]);
796 const float la =
_CLAMP(ta[0] + fabsf(
min[0]), lmin, lmax);
797 const float lb =
_CLAMP(tb[0] + fabsf(
min[0]), lmin, lmax);
798 const float halfmax = lmax / 2.0f;
799 const float doublemax = lmax * 2.0f;
801 tb[0] =
_CLAMP(la * (1.0f - local_opacity2)
802 + (lb > halfmax ? fmaxf(la, doublemax * (lb - halfmax))
803 : fminf(la, doublemax * lb))
804 * local_opacity2, lmin, lmax)
817static
void _blend_lightness(const float *const restrict a, const float *const restrict
b,
818 float *const restrict
out, const float *const restrict
mask, const size_t stride,
823 const float local_opacity =
mask[
i];
831 tb[0] =
_CLAMP(ta[0] * (1.0f - local_opacity) + tb[0] * local_opacity,
min[0],
max[0]);
842static
void _blend_chromaticity(const float *const restrict a, const float *const restrict
b,
843 float *const restrict
out, const float *const restrict
mask, const size_t stride,
848 const float local_opacity =
mask[
i];
854 dt_Lab_2_LCH(ta, tta);
858 dt_Lab_2_LCH(tb, ttb);
861 ttb[1] = (tta[1] * (1.0f - local_opacity)) + ttb[1] * local_opacity;
864 dt_LCH_2_Lab(ttb, tb);
873static
void _blend_hue(const float *const restrict a, const float *const restrict
b,
874 float *const restrict
out, const float *const restrict
mask, const size_t stride,
879 const float local_opacity =
mask[
i];
885 dt_Lab_2_LCH(ta, tta);
889 dt_Lab_2_LCH(tb, ttb);
894 const float d = fabsf(tta[2] - ttb[2]);
895 const float s =
d > 0.5f ? -local_opacity * (1.0f -
d) /
d : local_opacity;
896 ttb[2] = fmodf((tta[2] * (1.0f - s)) + ttb[2] * s + 1.0f, 1.0f);
898 dt_LCH_2_Lab(ttb, tb);
907static
void _blend_color(const float *const restrict a, const float *const restrict
b,
908 float *const restrict
out, const float *const restrict
mask, const size_t stride,
913 const float local_opacity =
mask[
i];
919 dt_Lab_2_LCH(ta, tta);
923 dt_Lab_2_LCH(tb, ttb);
926 ttb[1] = (tta[1] * (1.0f - local_opacity)) + ttb[1] * local_opacity;
929 const float d = fabsf(tta[2] - ttb[2]);
930 const float s =
d > 0.5f ? -local_opacity * (1.0f -
d) /
d : local_opacity;
931 ttb[2] = fmodf((tta[2] * (1.0f - s)) + ttb[2] * s + 1.0f, 1.0f);
933 dt_LCH_2_Lab(ttb, tb);
942static
void _blend_coloradjust(const float *const restrict a, const float *const restrict
b,
943 float *const restrict
out, const float *const restrict
mask, const size_t stride,
948 const float local_opacity =
mask[
i];
954 dt_Lab_2_LCH(ta, tta);
958 dt_Lab_2_LCH(tb, ttb);
961 ttb[1] = (tta[1] * (1.0f - local_opacity)) + ttb[1] * local_opacity;
964 const float d = fabsf(tta[2] - ttb[2]);
965 const float s =
d > 0.5f ? -local_opacity * (1.0f -
d) /
d : local_opacity;
966 ttb[2] = fmodf((tta[2] * (1.0f - s)) + ttb[2] * s + 1.0f, 1.0f);
968 dt_LCH_2_Lab(ttb, tb);
977static
void _blend_Lab_lightness(const float *const restrict a, const float *const restrict
b,
978 float *const restrict
out, const float *const restrict
mask, const size_t stride,
983 const float local_opacity =
mask[
i];
989 tb[0] = ta[0] * (1.0f - local_opacity) + tb[0] * local_opacity;
1000static
void _blend_Lab_a(const float *const restrict a, const float *const restrict
b,
1001 float *const restrict
out, const float *const restrict
mask, const size_t stride,
1006 const float local_opacity =
mask[
i];
1013 tb[1] = ta[1] * (1.0f - local_opacity) + tb[1] * local_opacity;
1023static
void _blend_Lab_b(const float *const restrict a, const float *const restrict
b,
1024 float *const restrict
out, const float *const restrict
mask, const size_t stride,
1029 const float local_opacity =
mask[
i];
1037 tb[2] = ta[2] * (1.0f - local_opacity) + tb[2] * local_opacity;
1047static
void _blend_Lab_color(const float *const restrict a, const float *const restrict
b,
1048 float *const restrict
out, const float *const restrict
mask, const size_t stride,
1053 float local_opacity =
mask[
i];
1060 tb[1] = ta[1] * (1.0f - local_opacity) + tb[1] * local_opacity;
1061 tb[2] = ta[2] * (1.0f - local_opacity) + tb[2] * local_opacity;
1077 blend = _blend_lighten;
1080 blend = _blend_darken;
1083 blend = _blend_multiply;
1086 blend = _blend_average;
1092 blend = _blend_subtract;
1095 blend = _blend_difference;
1098 blend = _blend_difference2;
1101 blend = _blend_screen;
1104 blend = _blend_overlay;
1107 blend = _blend_softlight;
1110 blend = _blend_hardlight;
1113 blend = _blend_vividlight;
1116 blend = _blend_linearlight;
1119 blend = _blend_pinlight;
1122 blend = _blend_lightness;
1125 blend = _blend_chromaticity;
1131 blend = _blend_color;
1134 blend = _blend_normal_bounded;
1137 blend = _blend_coloradjust;
1141 blend = _blend_Lab_lightness;
1144 blend = _blend_Lab_a;
1147 blend = _blend_Lab_b;
1150 blend = _blend_Lab_color;
1156 blend = _blend_normal_unbounded;
1174static
void _display_channel(const float *const restrict a, float *const restrict b,
1175 const float *const restrict mask, const size_t stride, const int channel,
1176 const float *const restrict boost_factors)
1246 dt_Lab_2_LCH(a + j,
LCH);
1258 dt_Lab_2_LCH(b + j,
LCH);
1269 dt_Lab_2_LCH(a + j,
LCH);
1279 dt_Lab_2_LCH(b + j,
LCH);
1295static inline
void _copy_mask(const float *const restrict a, float *const restrict b, const size_t stride)
1303 const float *
const a,
float *
const b,
1304 const float *
const restrict mask,
1313 const int xoffs = roi_out->
x - roi_in->
x;
1314 const int yoffs = roi_out->
y - roi_in->
y;
1315 const int iwidth = roi_in->
width;
1316 const int owidth = roi_out->
width;
1317 const int oheight = roi_out->
height;
1325 const float *
const restrict boost_factors =
d->blendif_boost_factors;
1329 for(
size_t y = 0; y < oheight; y++)
1333 const size_t m_start = y * owidth;
1334 _display_channel(a + a_start, b + b_start, mask + m_start, owidth, channel, boost_factors);
1350 const float yellow_mask = b[j+3];
1353 b[j+3] = yellow_mask;
1362 const float yellow_mask = b[j+3];
1365 b[j+3] = yellow_mask;
1383 for(
size_t y = 0; y < oheight; y++)
1387 const size_t m_start = y * owidth;
1388 blend(tmp_buffer + b_start, a + a_start, b + b_start, mask + m_start, owidth,
min,
max);
1394 for(
size_t y = 0; y < oheight; y++)
1398 const size_t m_start = y * owidth;
1399 blend(a + a_start, tmp_buffer + b_start, b + b_start, mask + m_start, owidth,
min,
max);
1410 for(
size_t y = 0; y < oheight; y++)
1413 const size_t b_start = y * stride;
1414 _copy_mask(a + a_start, b + b_start, stride);
void dt_develop_blendif_process_parameters(float *const restrict parameters, const dt_develop_blend_params_t *const params)
@ DEVELOP_BLENDIF_Lab_MASK
#define DEVELOP_BLENDIF_PARAMETER_ITEMS
@ DEVELOP_BLEND_CHROMATICITY
@ DEVELOP_BLEND_DIFFERENCE
@ DEVELOP_BLEND_LIGHTNESS
@ DEVELOP_BLEND_MODE_MASK
@ DEVELOP_BLEND_HARDLIGHT
@ DEVELOP_BLEND_LAB_COLOR
@ DEVELOP_BLEND_LINEARLIGHT
@ DEVELOP_BLEND_VIVIDLIGHT
@ DEVELOP_BLEND_SOFTLIGHT
@ DEVELOP_BLEND_COLORADJUST
@ DEVELOP_BLEND_LAB_LIGHTNESS
@ DEVELOP_BLEND_DIFFERENCE2
@ DEVELOP_MASK_PARAMETRIC
#define DT_BLENDIF_LAB_BCH
static _blend_row_func * _choose_blend_func(const unsigned int blend_mode)
static float _blendif_compute_factor(const float value, const unsigned int invert_mask, const float *const restrict parameters)
#define DT_BLENDIF_LAB_CH
void dt_develop_blendif_lab_blend(const struct dt_dev_pixelpipe_t *pipe, const struct dt_dev_pixelpipe_iop_t *piece, const float *const a, float *const b, const float *const restrict mask, const dt_dev_pixelpipe_display_mask_t request_mask_display)
void() _blend_row_func(const float *const restrict a, const float *const restrict b, float *const restrict out, const float *const restrict mask, const size_t stride, const dt_aligned_pixel_t min, const dt_aligned_pixel_t max)
static void _CLAMP_XYZ(dt_aligned_pixel_t XYZ, const dt_aligned_pixel_t min, const dt_aligned_pixel_t max)
static float _CLAMP(const float x, const float min, const float max)
void dt_develop_blendif_lab_make_mask(const struct dt_dev_pixelpipe_iop_t *piece, const float *const restrict a, const float *const restrict b, float *const restrict mask)
static void _display_channel_value(dt_aligned_pixel_t out, const float value, const float mask)
static void _blend_Lab_rescale(const float *i, float *o)
static void _blend_Lab_scale(const float *i, float *o)
const dt_aligned_pixel_t f
static dt_aligned_pixel_t LCH
static const float const float const float min
static dt_aligned_pixel_t XYZ
const dt_colormatrix_t dt_aligned_pixel_t out
dt_Rec709_to_XYZ_D50(rgb, XYZ)
typedef void((*dt_cache_allocate_t)(void *userdata, dt_cache_entry_t *entry))
#define __OMP_SIMD__(...)
#define for_each_channel(_var,...)
#define dt_pixelpipe_cache_alloc_align_float_cache(pixels, id)
#define __OMP_DECLARE_SIMD__(...)
#define __OMP_PARALLEL__(...)
#define dt_pixelpipe_cache_free_align(mem)
#define __OMP_PARALLEL_FOR__(...)
static const dt_aligned_pixel_simd_t value
#define __OMP_FOR_SIMD__(...)
#define __OMP_PARALLEL_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_mask_t
@ DT_DEV_PIXELPIPE_DISPLAY_a
@ DT_DEV_PIXELPIPE_DISPLAY_OUTPUT
@ DT_DEV_PIXELPIPE_DISPLAY_L
@ DT_DEV_PIXELPIPE_DISPLAY_ANY
@ DT_DEV_PIXELPIPE_DISPLAY_LCH_h
@ DT_DEV_PIXELPIPE_DISPLAY_LCH_C
@ DT_DEV_PIXELPIPE_DISPLAY_b
@ DT_DEV_PIXELPIPE_DISPLAY_MASK
__DT_CLONE_TARGETS__ void dt_iop_image_mul_const(float *const buf, const float mul_value, const size_t width, const size_t height, const size_t ch)
__DT_CLONE_TARGETS__ void dt_iop_image_copy(float *const __restrict__ out, const float *const __restrict__ in, const size_t nfloats)
__DT_CLONE_TARGETS__ void dt_iop_image_fill(float *const buf, const float fill_value, const size_t width, const size_t height, const size_t ch)
dt_iop_order_iccprofile_info_t * dt_ioppr_get_pipe_work_profile_info(const struct dt_dev_pixelpipe_t *pipe)
#define DEVELOP_BLENDIF_SIZE
float dt_aligned_pixel_t[4]
static float clamp_simd(const float x)
dt_iop_buffer_dsc_t dsc_in
dt_colormatrix_t matrix_in_transposed
Region of interest passed through the pixelpipe.