25void hsv_to_rgb(
float h,
float s,
float v,
float *r_r,
float *r_g,
float *r_b)
29 nr =
fabsf(h * 6.0f - 3.0f) - 1.0f;
30 ng = 2.0f -
fabsf(h * 6.0f - 2.0f);
31 nb = 2.0f -
fabsf(h * 6.0f - 4.0f);
33 CLAMP(nr, 0.0f, 1.0f);
34 CLAMP(nb, 0.0f, 1.0f);
35 CLAMP(ng, 0.0f, 1.0f);
37 *r_r = ((nr - 1.0f) * s + 1.0f) *
v;
38 *r_g = ((ng - 1.0f) * s + 1.0f) *
v;
39 *r_b = ((nb - 1.0f) * s + 1.0f) *
v;
42void hsl_to_rgb(
float h,
float s,
float l,
float *r_r,
float *r_g,
float *r_b)
44 float nr, ng, nb, chroma;
46 nr =
fabsf(h * 6.0f - 3.0f) - 1.0f;
47 ng = 2.0f -
fabsf(h * 6.0f - 2.0f);
48 nb = 2.0f -
fabsf(h * 6.0f - 4.0f);
50 CLAMP(nr, 0.0f, 1.0f);
51 CLAMP(nb, 0.0f, 1.0f);
52 CLAMP(ng, 0.0f, 1.0f);
54 chroma = (1.0f -
fabsf(2.0f *
l - 1.0f)) * s;
56 *r_r = (nr - 0.5f) * chroma +
l;
57 *r_g = (ng - 0.5f) * chroma +
l;
58 *r_b = (nb - 0.5f) * chroma +
l;
63 hsv_to_rgb(hsv[0], hsv[1], hsv[2], &r_rgb[0], &r_rgb[1], &r_rgb[2]);
68 hsl_to_rgb(hsl[0], hsl[1], hsl[2], &r_rgb[0], &r_rgb[1], &r_rgb[2]);
77 y = 0.299f * r + 0.587f * g + 0.114f *
b;
78 u = -0.147f * r - 0.289f * g + 0.436f *
b;
79 v = 0.615f * r - 0.515f * g - 0.100f *
b;
84 y = 0.2126f * r + 0.7152f * g + 0.0722f *
b;
85 u = -0.09991f * r - 0.33609f * g + 0.436f *
b;
86 v = 0.615f * r - 0.55861f * g - 0.05639f *
b;
102 g =
y - 0.394f * u - 0.581f *
v;
108 r =
y + 1.28033f *
v;
109 g =
y - 0.21482f * u - 0.38059f *
v;
110 b =
y + 2.12798f * u;
122 float y = 128.0f, cr = 128.0f, cb = 128.0f;
130 y = (0.257f * sr) + (0.504f * sg) + (0.098f * sb) + 16.0f;
131 cb = (-0.148f * sr) - (0.291f * sg) + (0.439f * sb) + 128.0f;
132 cr = (0.439f * sr) - (0.368f * sg) - (0.071f * sb) + 128.0f;
135 y = (0.183f * sr) + (0.614f * sg) + (0.062f * sb) + 16.0f;
136 cb = (-0.101f * sr) - (0.338f * sg) + (0.439f * sb) + 128.0f;
137 cr = (0.439f * sr) - (0.399f * sg) - (0.040f * sb) + 128.0f;
140 y = (0.299f * sr) + (0.587f * sg) + (0.114f * sb);
141 cb = (-0.16874f * sr) - (0.33126f * sg) + (0.5f * sb) + 128.0f;
142 cr = (0.5f * sr) - (0.41869f * sg) - (0.08131f * sb) + 128.0f;
162 float r = 128.0f, g = 128.0f,
b = 128.0f;
166 r = 1.164f * (
y - 16.0f) + 1.596f * (cr - 128.0f);
167 g = 1.164f * (
y - 16.0f) - 0.813f * (cr - 128.0f) - 0.392f * (cb - 128.0f);
168 b = 1.164f * (
y - 16.0f) + 2.017f * (cb - 128.0f);
171 r = 1.164f * (
y - 16.0f) + 1.793f * (cr - 128.0f);
172 g = 1.164f * (
y - 16.0f) - 0.534f * (cr - 128.0f) - 0.213f * (cb - 128.0f);
173 b = 1.164f * (
y - 16.0f) + 2.115f * (cb - 128.0f);
176 r =
y + 1.402f * cr - 179.456f;
177 g =
y - 0.34414f * cb - 0.71414f * cr + 135.45984f;
178 b =
y + 1.772f * cb - 226.816f;
189void hex_to_rgb(
const char *hexcol,
float *r_r,
float *r_g,
float *r_b)
204bool hex_to_rgba(
const char *hexcol,
float *r_r,
float *r_g,
float *r_b,
float *r_a)
206 if (hexcol[0] ==
'#') {
210 size_t hex_len = strlen(hexcol);
212 bool alpha_parsed =
false;
216 if (sscanf(hexcol,
"%2x%2x%2x%2x", &r, &g, &
b, &a) != 4) {
222 if (sscanf(hexcol,
"%2x%2x%2x%1x", &r, &g, &
b, &a) != 4) {
229 if (sscanf(hexcol,
"%2x%2x%2x", &r, &g, &
b) != 3) {
234 if (sscanf(hexcol,
"%1x%1x%1x%2x", &r, &g, &
b, &a) != 4) {
243 if (sscanf(hexcol,
"%1x%1x%1x%1x", &r, &g, &
b, &a) != 4) {
253 if (sscanf(hexcol,
"%1x%1x%1x", &r, &g, &
b) != 3) {
261 if (sscanf(hexcol,
"%2x", &r) != 1) {
268 if (sscanf(hexcol,
"%1x", &r) != 1) {
281 const float scale = 1.0f / 255.0f;
286 CLAMP(*r_r, 0.0f, 1.0f);
287 CLAMP(*r_g, 0.0f, 1.0f);
288 CLAMP(*r_b, 0.0f, 1.0f);
291 if (r_a && alpha_parsed) {
293 CLAMP(*r_a, 0.0f, 1.0f);
298void rgb_to_hsv(
float r,
float g,
float b,
float *r_h,
float *r_s,
float *r_v)
311 k = -2.0f / 6.0f - k;
317 *r_h =
fabsf(k + (g -
b) / (6.0f * chroma + 1e-20f));
318 *r_s = chroma / (r + 1e-20f);
324 rgb_to_hsv(rgb[0], rgb[1], rgb[2], &r_hsv[0], &r_hsv[1], &r_hsv[2]);
327void rgb_to_hsl(
float r,
float g,
float b,
float *r_h,
float *r_s,
float *r_l)
329 const float cmax = std::max({r, g,
b});
330 const float cmin = std::min({r, g,
b});
331 float h, s,
l =
min_ff(1.0f, (cmax + cmin) / 2.0f);
337 float d = cmax - cmin;
338 s =
l > 0.5f ? d / (2.0f - cmax - cmin) : d / (cmax + cmin);
340 h = (g -
b) / d + (g <
b ? 6.0f : 0.0f);
342 else if (cmax == g) {
343 h = (
b - r) / d + 2.0f;
346 h = (r - g) / d + 4.0f;
361 const float orig_s = *r_s;
362 const float orig_h = *r_h;
363 const float threshold = 1e-5f;
369 if (*r_l <= threshold) {
373 else if (*r_s <= threshold) {
379 if (
fabsf(*r_h) <= threshold &&
fabsf(orig_h - 1.0f) <= threshold) {
382 else if (
fabsf(*r_h - 1.0f) <= threshold &&
fabsf(orig_h) <= threshold) {
394 rgb_to_hsl(rgb[0], rgb[1], rgb[2], &r_hsl[0], &r_hsl[1], &r_hsl[2]);
402 const float orig_h = *r_h;
403 const float orig_s = *r_s;
404 const float threshold = 1e-5f;
410 if (*r_v <= threshold) {
414 else if (*r_s <= threshold) {
419 if (
fabsf(*r_h) <= threshold &&
fabsf(orig_h - 1.0f) <= threshold) {
422 else if (
fabsf(*r_h - 1.0f) <= threshold &&
fabsf(orig_h) <= threshold) {
434 if (hsv[0] < 0.0f || hsv[0] > 1.0f) [[unlikely]] {
435 hsv[0] = hsv[0] -
floorf(hsv[0]);
437 CLAMP(hsv[1], 0.0f, 1.0f);
438 CLAMP(hsv[2], 0.0f, v_max);
449 r =
uint(rf * 255.0f);
450 g =
uint(gf * 255.0f);
451 b =
uint(bf * 255.0f);
453 col = (r + (g * 256) + (
b * 256 * 256));
465 ir = std::min<uint>(ir, 255);
466 ig = std::min<uint>(ig, 255);
467 ib = std::min<uint>(ib, 255);
469 return (ir + (ig * 256) + (ib * 256 * 256));
474 *r_r =
float(col & 0xFF) * (1.0f / 255.0f);
475 *r_g =
float((col >> 8) & 0xFF) * (1.0f / 255.0f);
476 *r_b =
float((col >> 16) & 0xFF) * (1.0f / 255.0f);
486 return (c < 0.0f) ? 0.0f : c * (1.0f / 12.92f);
489 return powf((c + 0.055f) * (1.0f / 1.055f), 2.4f);
494 if (c < 0.0031308f) {
495 return (c < 0.0f) ? 0.0f : c * 12.92f;
498 return 1.055f *
powf(c, 1.0f / 2.4f) - 0.055f;
521# if BLI_HAVE_ARM_NEON
522 return vreinterpretq_m128i_s32(vcvtnq_s32_f32(a));
524 return _mm_cvtps_epi32(a);
531 ret = _mm_mul_ps(arg, _mm_castsi128_ps(_mm_set1_epi32(e2coeff)));
532 ret = _mm_cvtepi32_ps(_mm_castps_si128(
ret));
533 ret = _mm_mul_ps(
ret, _mm_castsi128_ps(_mm_set1_epi32(
exp)));
534 ret = _mm_castsi128_ps(_bli_float_to_int_nearest(
ret));
541 __m128 approx2 = _mm_mul_ps(old_result, old_result);
542 __m128 approx4 = _mm_mul_ps(approx2, approx2);
543 __m128 t = _mm_div_ps(
x, approx4);
544 __m128 summ = _mm_add_ps(_mm_mul_ps(_mm_set1_ps(4.0f), old_result), t);
545 return _mm_mul_ps(summ, _mm_set1_ps(1.0f / 5.0f));
561 __m128 arg2 = _mm_mul_ps(arg, arg);
562 __m128 arg4 = _mm_mul_ps(arg2, arg2);
569 return _mm_mul_ps(
x, _mm_mul_ps(
x,
x));
574 __m128 r = _mm_rsqrt_ps(
in);
579# if defined(__SSE2__)
580 r = _mm_add_ps(_mm_mul_ps(_mm_set1_ps(1.5f), r),
581 _mm_mul_ps(_mm_mul_ps(_mm_mul_ps(
in, _mm_set1_ps(-0.5f)), r), _mm_mul_ps(r, r)));
594 __m128 xover = _mm_mul_ps(arg, xf);
596 __m128 x2 = _mm_mul_ps(arg, arg);
597 __m128 xunder = _mm_mul_ps(x2, xfm1);
599 __m128 xavg = _mm_mul_ps(_mm_set1_ps(1.0f / (3.0f * 0.629960524947437f) * 0.999852f),
600 _mm_add_ps(xover, xunder));
606MALWAYS_INLINE __m128 _bli_math_blend_sse(
const __m128
mask,
const __m128 a,
const __m128
b)
609 return _mm_blendv_ps(
b, a,
mask);
611 return _mm_or_ps(_mm_and_ps(
mask, a), _mm_andnot_ps(
mask,
b));
617 __m128 cmp = _mm_cmplt_ps(c, _mm_set1_ps(0.04045f));
618 __m128 lt = _mm_max_ps(_mm_mul_ps(c, _mm_set1_ps(1.0f / 12.92f)), _mm_set1_ps(0.0f));
619 __m128 gtebase = _mm_mul_ps(_mm_add_ps(c, _mm_set1_ps(0.055f)),
620 _mm_set1_ps(1.0f / 1.055f));
622 return _bli_math_blend_sse(cmp, lt, gte);
627 __m128 cmp = _mm_cmplt_ps(c, _mm_set1_ps(0.0031308f));
628 __m128 lt = _mm_max_ps(_mm_mul_ps(c, _mm_set1_ps(12.92f)), _mm_set1_ps(0.0f));
630 _mm_set1_ps(-0.055f));
631 return _bli_math_blend_sse(cmp, lt, gte);
636 float r[4] = {srgb[0], srgb[1], srgb[2], 1.0f};
637 __m128 *rv =
reinterpret_cast<__m128 *
>(&r);
638 *rv = srgb_to_linearrgb_v4_simd(*rv);
646 float r[4] = {linear[0], linear[1], linear[2], 1.0f};
647 __m128 *rv =
reinterpret_cast<__m128 *
>(&r);
648 *rv = linearrgb_to_srgb_v4_simd(*rv);
657 const __m128 clamped = _mm_min_ps(_mm_max_ps(
v, _mm_setzero_ps()), _mm_set1_ps(1.0f));
658 const __m128
scaled = _mm_add_ps(_mm_mul_ps(clamped, _mm_set1_ps(255.0f)), _mm_set1_ps(0.5f));
659 return _mm_cvttps_epi32(
scaled);
663MALWAYS_INLINE __m128i linearrgb_to_srgb_uchar4_block(
const float (*linear)[4],
664 const float (*matrix)[3])
666 __m128 c0 = _mm_loadu_ps(linear[0]);
667 __m128 c1 = _mm_loadu_ps(linear[1]);
668 __m128 c2 = _mm_loadu_ps(linear[2]);
669 __m128 c3 = _mm_loadu_ps(linear[3]);
672 _MM_TRANSPOSE4_PS(c0, c1, c2, c3);
676 const __m128 r = c0, g = c1,
b = c2;
677 c0 = _mm_add_ps(_mm_add_ps(_mm_mul_ps(_mm_set1_ps(matrix[0][0]), r),
678 _mm_mul_ps(_mm_set1_ps(matrix[1][0]), g)),
679 _mm_mul_ps(_mm_set1_ps(matrix[2][0]),
b));
680 c1 = _mm_add_ps(_mm_add_ps(_mm_mul_ps(_mm_set1_ps(matrix[0][1]), r),
681 _mm_mul_ps(_mm_set1_ps(matrix[1][1]), g)),
682 _mm_mul_ps(_mm_set1_ps(matrix[2][1]),
b));
683 c2 = _mm_add_ps(_mm_add_ps(_mm_mul_ps(_mm_set1_ps(matrix[0][2]), r),
684 _mm_mul_ps(_mm_set1_ps(matrix[1][2]), g)),
685 _mm_mul_ps(_mm_set1_ps(matrix[2][2]),
b));
689 c0 = linearrgb_to_srgb_v4_simd(c0);
690 c1 = linearrgb_to_srgb_v4_simd(c1);
691 c2 = linearrgb_to_srgb_v4_simd(c2);
694 _MM_TRANSPOSE4_PS(c0, c1, c2, c3);
697 const __m128i lo = _mm_packs_epi32(_bli_float_to_uchar_simd(c0), _bli_float_to_uchar_simd(c1));
698 const __m128i hi = _mm_packs_epi32(_bli_float_to_uchar_simd(c2), _bli_float_to_uchar_simd(c3));
699 return _mm_packus_epi16(lo, hi);
709 memcpy(&r, &
v,
sizeof(
v));
716 memcpy(&r, &
v,
sizeof(
v));
731 float approx2 = old_result * old_result;
732 float approx4 = approx2 * approx2;
733 float t =
x / approx4;
734 float summ = 4.0f * old_result + t;
735 return summ * (1.0f / 5.0f);
741 float arg2 = arg * arg;
742 float arg4 = arg2 * arg2;
757 float xover = arg * xf;
759 float x2 = arg * arg;
760 float xunder = x2 * xfm1;
761 float xavg = (1.0f / (3.0f * 0.629960524947437f) * 0.999852f) * (xover + xunder);
770 return (c < 0.0f) ? 0.0f : c * (1.0f / 12.92f);
778 if (c < 0.0031308f) {
779 return (c < 0.0f) ? 0.0f : c * 12.92f;
802 const float (*__restrict linear)[4],
804 const float (*__restrict matrix)[3])
810 for (; i + 4 <= size; i += 4) {
811 const __m128i bytes = linearrgb_to_srgb_uchar4_block(&linear[i], matrix);
812 _mm_storeu_si128(
reinterpret_cast<__m128i *
>(srgb[i]), bytes);
816 const int remainder = size - 4;
817 const __m128i bytes = linearrgb_to_srgb_uchar4_block(&linear[remainder], matrix);
818 _mm_storeu_si128(
reinterpret_cast<__m128i *
>(srgb[remainder]), bytes);
826 for (
int i = 0; i < size; i++) {
835 for (
int i = 0; i < size; i++) {
854 rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv + 1, hsv + 2);
856 hsv[0] += hue_offset;
860 else if (hsv[0] < 0.0f) {
864 hsv_to_rgb(hsv[0], hsv[1], hsv[2], rgb, rgb + 1, rgb + 2);
880 static bool initialized =
false;
887 for (
int b = 0;
b <= 255;
b++) {
912 {0.0f, {0.18006f, 0.26352f}, -0.24341f}, {10.0f, {0.18066f, 0.26589f}, -0.25479f},
913 {20.0f, {0.18133f, 0.26846f}, -0.26876f}, {30.0f, {0.18208f, 0.27119f}, -0.28539f},
914 {40.0f, {0.18293f, 0.27407f}, -0.30470f}, {50.0f, {0.18388f, 0.27709f}, -0.32675f},
915 {60.0f, {0.18494f, 0.28021f}, -0.35156f}, {70.0f, {0.18611f, 0.28342f}, -0.37915f},
916 {80.0f, {0.18740f, 0.28668f}, -0.40955f}, {90.0f, {0.18880f, 0.28997f}, -0.44278f},
917 {100.0f, {0.19032f, 0.29326f}, -0.47888f}, {125.0f, {0.19462f, 0.30141f}, -0.58204f},
918 {150.0f, {0.19962f, 0.30921f}, -0.70471f}, {175.0f, {0.20525f, 0.31647f}, -0.84901f},
919 {200.0f, {0.21142f, 0.32312f}, -1.0182f}, {225.0f, {0.21807f, 0.32909f}, -1.2168f},
920 {250.0f, {0.22511f, 0.33439f}, -1.4512f}, {275.0f, {0.23247f, 0.33904f}, -1.7298f},
921 {300.0f, {0.24010f, 0.34308f}, -2.0637f}, {325.0f, {0.24792f, 0.34655f}, -2.4681f},
922 {350.0f, {0.25591f, 0.34951f}, -2.9641f}, {375.0f, {0.26400f, 0.35200f}, -3.5814f},
923 {400.0f, {0.27218f, 0.35407f}, -4.3633f}, {425.0f, {0.28039f, 0.35577f}, -5.3762f},
924 {450.0f, {0.28863f, 0.35714f}, -6.7262f}, {475.0f, {0.29685f, 0.35823f}, -8.5955f},
925 {500.0f, {0.30505f, 0.35907f}, -11.324f}, {525.0f, {0.31320f, 0.35968f}, -15.628f},
926 {550.0f, {0.32129f, 0.36011f}, -23.325f}, {575.0f, {0.32931f, 0.36038f}, -40.770f},
927 {600.0f, {0.33724f, 0.36051f}, -116.45f},
933 const float2 uv =
float2{4.0f * white.x, 6.0f * white.y} /
dot(white, {1.0f, 15.0f, 3.0f});
936 auto check = [uv](
const float val,
const locus_entry_t &entry) {
return entry.dist(uv) < val; };
937 std::array<locus_entry_t, 31>::const_iterator entry = std::upper_bound(
946 const float d_low = low.
dist(uv) /
sqrtf(1.0f + low.
t * low.
t);
947 const float d_high = high.dist(uv) /
sqrtf(1.0f + high.t * high.t);
948 const float f = d_low / (d_low - d_high);
952 const float abs_tint =
length(uv - uv_temp) * 3000.0f;
953 if (abs_tint > 150.0f) {
958 tint = abs_tint * ((uv.x < uv_temp.x) ? 1.0f : -1.0f);
965 const float mired =
clamp(
967 auto check = [](
const locus_entry_t &entry,
const float val) {
return entry.
mired < val; };
968 std::array<locus_entry_t, 31>::const_iterator entry = std::lower_bound(
974 const float f = (mired - low.
mired) / (high.mired - low.
mired);
986 uv -= isotherm * tint / 3000.0f;
989 const float x = 3.0f * uv.x / (2.0f * uv.x - 8.0f * uv.y + 4.0f);
990 const float y = 2.0f * uv.y / (2.0f * uv.x - 8.0f * uv.y + 4.0f);
1000 {0.8951f, -0.7502f, 0.0389f},
1001 {0.2664f, 1.7135f, -0.0685f},
1002 {-0.1614f, 0.0367f, 1.0296f},
1006 const float3 from_LMS = bradford * from_XYZ / from_XYZ.y;
1007 const float3 to_LMS = bradford * to_XYZ / to_XYZ.y;
#define BLI_YUV_ITU_BT709
#define BLI_YCC_JFIF_0_255
#define BLI_YCC_ITU_BT601
#define BLI_YUV_ITU_BT601
#define BLI_YCC_ITU_BT709
#define BLI_assert_unreachable()
#define BLI_assert_msg(a, msg)
btMatrix3x3 scaled(const btVector3 &s) const
Create a scaled copy of the matrix.
IMETHOD Vector diff(const Vector &a, const Vector &b, double dt)
float3x3 scale(float3x3 mat, float2 scale)
T clamp(const T &a, const T &min, const T &max)
float3 whitepoint_from_temp_tint(float temperature, float tint)
T length(const VecBase< T, Size > &a)
bool whitepoint_to_temp_tint(const float3 &white, float &temperature, float &tint)
T dot(const QuaternionBase< T > &a, const QuaternionBase< T > &b)
static const std::array< locus_entry_t, 31 > planck_locus
CartesianBasis invert(const CartesianBasis &basis)
MatT from_scale(const VecBase< typename MatT::base_type, ScaleDim > &scale)
T interpolate(const T &a, const T &b, const FactorT &t)
MatBase< T, NumCol, NumRow > normalize(const MatBase< T, NumCol, NumRow > &a)
float3x3 chromatic_adaption_matrix(const float3 &from_XYZ, const float3 &to_XYZ)
MINLINE float min_ff(float a, float b)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
MALWAYS_INLINE float _bli_math_fastpow(const int exp, const int e2coeff, const float arg)
void linearrgb_to_srgb_v3_v3(float srgb[3], const float linear[3])
void rgb_float_set_hue_float_offset(float rgb[3], float hue_offset)
void hsv_to_rgb(float h, float s, float v, float *r_r, float *r_g, float *r_b)
MALWAYS_INLINE float srgb_to_linearrgb_approx(float c)
MALWAYS_INLINE float linearrgb_to_srgb_approx(float c)
ATTR_WARN_UNUSED_RESULT const BMLoop * l
void cpack_to_rgb(unsigned int col, float *r_r, float *r_g, float *r_b)
float srgb_to_linearrgb(float c)
void rgb_to_hsl(float r, float g, float b, float *r_h, float *r_s, float *r_l)
void ycc_to_rgb(float y, float cb, float cr, float *r_r, float *r_g, float *r_b, int colorspace)
void rgb_byte_set_hue_float_offset(unsigned char rgb[3], float hue_offset)
void srgb_to_linearrgb_v3_v3(float linear[3], const float srgb[3])
void rgb_to_hsl_v(const float rgb[3], float r_hsl[3])
void rgb_to_hsv_v(const float rgb[3], float r_hsv[3])
void BLI_init_srgb_conversion()
void rgb_to_hsv_compat_v(const float rgb[3], float r_hsv[3])
unsigned int hsv_to_cpack(float h, float s, float v)
void rgb_to_hsv(float r, float g, float b, float *r_h, float *r_s, float *r_v)
ATTR_WARN_UNUSED_RESULT const BMVert * v
unsigned int rgb_to_cpack(float r, float g, float b)
MINLINE void rgb_float_to_uchar(unsigned char r_col[3], const float col_f[3])
void rgb_to_ycc(float r, float g, float b, float *r_y, float *r_cb, float *r_cr, int colorspace)
float BLI_color_from_srgb_table[256]
VecBase< float, 2 > float2
void hsv_to_rgb_v(const float hsv[3], float r_rgb[3])
void hsv_clamp_v(float hsv[3], float v_max)
MINLINE float int_as_float(int i)
void rgb_to_hsl_compat_v(const float rgb[3], float r_hsl[3])
void rgb_to_yuv(float r, float g, float b, float *r_y, float *r_u, float *r_v, int colorspace)
MatBase< float, 3, 3 > float3x3
void hsl_to_rgb(float h, float s, float l, float *r_r, float *r_g, float *r_b)
void hsl_to_rgb_v(const float hsl[3], float r_rgb[3])
MALWAYS_INLINE float _bli_math_fastpow512(const float arg)
void yuv_to_rgb(float y, float u, float v, float *r_r, float *r_g, float *r_b, int colorspace)
bool hex_to_rgba(const char *hexcol, float *r_r, float *r_g, float *r_b, float *r_a)
MINLINE float max_ff(float a, float b)
void rgb_to_hsl_compat(float r, float g, float b, float *r_h, float *r_s, float *r_l)
void hex_to_rgb(const char *hexcol, float *r_r, float *r_g, float *r_b)
MALWAYS_INLINE float _bli_math_improve_5throot_solution(const float old_result, const float x)
MINLINE void rgb_uchar_to_float(float r_col[3], const unsigned char col_ub[3])
void rgb_to_hsv_compat(float r, float g, float b, float *r_h, float *r_s, float *r_v)
VecBase< float, 3 > float3
MALWAYS_INLINE float _bli_math_rsqrt(float in)
MALWAYS_INLINE float _bli_math_fastpow24(const float arg)
void mul_v3_m3v3(float r[3], const float M[3][3], const float a[3])
float linearrgb_to_srgb(float c)
void linearrgb_to_srgb_uchar4_n(unsigned char(*srgb)[4], const float(*linear)[4], int size, const float(*matrix)[3]=nullptr)
MINLINE int float_as_int(float f)
MINLINE void rgba_float_to_uchar(unsigned char r_col[4], const float col_f[4])
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
float dist(const float2 p) const