Krita Source Code Documentation
Loading...
Searching...
No Matches
KoColorTransferFunctions< Arch > Struct Template Reference

#include <KoColorTransferFunctions.h>

Public Types

using float_v = typename KoStreamedMath<Arch>::float_v
 

Static Public Member Functions

static ALWAYS_INLINE void removeHLGCurve (float_v &x) noexcept
 
static ALWAYS_INLINE void removeSmpte2048Curve (float_v &x) noexcept
 
static ALWAYS_INLINE void removeSMPTE_ST_428Curve (float_v &x) noexcept
 

Detailed Description

template<typename Arch>
struct KoColorTransferFunctions< Arch >

Definition at line 150 of file KoColorTransferFunctions.h.

Member Typedef Documentation

◆ float_v

template<typename Arch >
using KoColorTransferFunctions< Arch >::float_v = typename KoStreamedMath<Arch>::float_v

Definition at line 151 of file KoColorTransferFunctions.h.

Member Function Documentation

◆ removeHLGCurve()

template<typename Arch >
static ALWAYS_INLINE void KoColorTransferFunctions< Arch >::removeHLGCurve ( float_v & x)
inlinestaticnoexcept

Definition at line 168 of file KoColorTransferFunctions.h.

169 {
170 constexpr float a = 0.17883277f;
171 constexpr float b = 0.28466892f;
172 constexpr float c = 0.55991073f;
173
174 const float_v x1 = x * x * (1.f / 3.0f);
175 const float_v x2 =
176 (xsimd::exp((x - c) * (1.f / a)) + b) * (1.f / 12.0f);
177 x = xsimd::select(x <= float_v(0.5f), x1, x2);
178 }
typename KoStreamedMath< Arch >::float_v float_v

◆ removeSmpte2048Curve()

template<typename Arch >
static ALWAYS_INLINE void KoColorTransferFunctions< Arch >::removeSmpte2048Curve ( float_v & x)
inlinestaticnoexcept

Definition at line 153 of file KoColorTransferFunctions.h.

154 {
155 constexpr float m1_r = 4096.0f * 4.0f / 2610.0f;
156 constexpr float m2_r = 4096.0f / 2523.0f / 128.0f;
157 constexpr float a1 = 3424.0f / 4096.0f;
158 constexpr float c2 = 2413.0f / 4096.0f * 32.0f;
159 constexpr float c3 = 2392.0f / 4096.0f * 32.0f;
160
161 const float_v x_p = xsimd::pow(x, float_v(m2_r));
162 const float_v res =
163 xsimd::pow(xsimd::max(float_v(0.0f), x_p - a1) / (c2 - c3 * x_p),
164 float_v(m1_r));
165 x = res * 125.0f;
166 }
constexpr std::enable_if< sizeof...(values)==0, size_t >::type max()

References xsimd::max().

◆ removeSMPTE_ST_428Curve()

template<typename Arch >
static ALWAYS_INLINE void KoColorTransferFunctions< Arch >::removeSMPTE_ST_428Curve ( float_v & x)
inlinestaticnoexcept

Definition at line 180 of file KoColorTransferFunctions.h.

181 {
182 x = (52.37f / 48.0f) * xsimd::pow(x, float_v(2.6f));
183 }

The documentation for this struct was generated from the following file: