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, float_v refWhite=203.0) noexcept
 
static ALWAYS_INLINE void removeSMPTE_ST_428Curve (float_v &x) noexcept
 

Detailed Description

template<typename Arch>
struct KoColorTransferFunctions< Arch >

Definition at line 157 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 158 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 175 of file KoColorTransferFunctions.h.

176 {
177 constexpr float a = 0.17883277f;
178 constexpr float b = 0.28466892f;
179 constexpr float c = 0.55991073f;
180
181 constexpr float scale = 3.7743f;
182
183 const float_v x1 = x * x * (1.f / 3.0f);
184 const float_v x2 =
185 (xsimd::exp((x - c) * (1.f / a)) + b) * (1.f / 12.0f);
186 x = xsimd::select(x <= float_v(0.5f), x1, x2) * scale;
187 }
typename KoStreamedMath< Arch >::float_v float_v

◆ removeSmpte2048Curve()

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

Definition at line 160 of file KoColorTransferFunctions.h.

161 {
162 constexpr float m1_r = 4096.0f * 4.0f / 2610.0f;
163 constexpr float m2_r = 4096.0f / 2523.0f / 128.0f;
164 constexpr float a1 = 3424.0f / 4096.0f;
165 constexpr float c2 = 2413.0f / 4096.0f * 32.0f;
166 constexpr float c3 = 2392.0f / 4096.0f * 32.0f;
167
168 const float_v x_p = xsimd::pow(x, float_v(m2_r));
169 const float_v res =
170 xsimd::pow(xsimd::max(float_v(0.0f), x_p - a1) / (c2 - c3 * x_p),
171 float_v(m1_r));
172 x = res * (10000.0f/refWhite);
173 }
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 189 of file KoColorTransferFunctions.h.

190 {
191 x = (52.37f / 48.0f) * xsimd::pow(x, float_v(2.6f));
192 }

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