Krita Source Code Documentation
Loading...
Searching...
No Matches
PixelWrapper< quint8, _impl > Struct Template Reference

#include <KoStreamedMath.h>

Public Types

using float_v = xsimd::batch<float, _impl>
 
using int_v = xsimd::batch<int, _impl>
 
using uint_v = xsimd::batch<unsigned int, _impl>
 

Public Member Functions

ALWAYS_INLINE void clearPixels (quint8 *dataDst)
 
ALWAYS_INLINE void copyPixels (const quint8 *dataSrc, quint8 *dataDst)
 
 PixelWrapper ()
 
ALWAYS_INLINE void read (const void *src, float_v &dst_c1, float_v &dst_c2, float_v &dst_c3, float_v &dst_alpha)
 
ALWAYS_INLINE void write (quint8 *dataDst, const float_v &c1, const float_v &c2, const float_v &c3, const float_v &a)
 

Static Public Member Functions

static ALWAYS_INLINE void denormalizeAlpha (float &alpha)
 
static ALWAYS_INLINE quint8 lerpMixedUintFloat (quint8 a, quint8 b, float alpha)
 
static ALWAYS_INLINE void normalizeAlpha (float &alpha)
 
static ALWAYS_INLINE quint8 roundFloatToUint (float x)
 

Public Attributes

const uint_v mask
 
const float_v uint8Max
 
const float_v uint8Rec1
 

Detailed Description

template<typename _impl>
struct PixelWrapper< quint8, _impl >

Definition at line 678 of file KoStreamedMath.h.

Member Typedef Documentation

◆ float_v

template<typename _impl >
using PixelWrapper< quint8, _impl >::float_v = xsimd::batch<float, _impl>

Definition at line 681 of file KoStreamedMath.h.

◆ int_v

template<typename _impl >
using PixelWrapper< quint8, _impl >::int_v = xsimd::batch<int, _impl>

Definition at line 679 of file KoStreamedMath.h.

◆ uint_v

template<typename _impl >
using PixelWrapper< quint8, _impl >::uint_v = xsimd::batch<unsigned int, _impl>

Definition at line 680 of file KoStreamedMath.h.

Constructor & Destructor Documentation

◆ PixelWrapper()

template<typename _impl >
PixelWrapper< quint8, _impl >::PixelWrapper ( )
inline

Definition at line 712 of file KoStreamedMath.h.

713 : mask(quint32(0xFF))
714 , uint8Max(255.0f)
715 , uint8Rec1(1.0f / 255.0f)
716 {
717 }

Member Function Documentation

◆ clearPixels()

template<typename _impl >
ALWAYS_INLINE void PixelWrapper< quint8, _impl >::clearPixels ( quint8 * dataDst)
inline

Definition at line 736 of file KoStreamedMath.h.

737 {
738 memset(dataDst, 0, float_v::size * sizeof(quint8) * 4);
739 }

◆ copyPixels()

template<typename _impl >
ALWAYS_INLINE void PixelWrapper< quint8, _impl >::copyPixels ( const quint8 * dataSrc,
quint8 * dataDst )
inline

Definition at line 742 of file KoStreamedMath.h.

743 {
744 memcpy(dataDst, dataSrc, float_v::size * sizeof(quint8) * 4);
745 }

◆ denormalizeAlpha()

template<typename _impl >
static ALWAYS_INLINE void PixelWrapper< quint8, _impl >::denormalizeAlpha ( float & alpha)
inlinestatic

Definition at line 706 of file KoStreamedMath.h.

707 {
708 const float uint8Max = 255.0f;
709 alpha *= uint8Max;
710 }

◆ lerpMixedUintFloat()

template<typename _impl >
static ALWAYS_INLINE quint8 PixelWrapper< quint8, _impl >::lerpMixedUintFloat ( quint8 a,
quint8 b,
float alpha )
inlinestatic

Definition at line 687 of file KoStreamedMath.h.

688 {
690 }
static quint8 lerp_mixed_u8_float(quint8 a, quint8 b, float alpha)

References KoStreamedMath< _impl >::lerp_mixed_u8_float().

◆ normalizeAlpha()

template<typename _impl >
static ALWAYS_INLINE void PixelWrapper< quint8, _impl >::normalizeAlpha ( float & alpha)
inlinestatic

Definition at line 699 of file KoStreamedMath.h.

700 {
701 const float uint8Rec1 = 1.0f / 255.0f;
702 alpha *= uint8Rec1;
703 }

◆ read()

template<typename _impl >
ALWAYS_INLINE void PixelWrapper< quint8, _impl >::read ( const void * src,
float_v & dst_c1,
float_v & dst_c2,
float_v & dst_c3,
float_v & dst_alpha )
inline

Definition at line 719 of file KoStreamedMath.h.

720 {
721 dst_alpha = KoStreamedMath<_impl>::template fetch_alpha_32<false>(src);
722 KoStreamedMath<_impl>::template fetch_colors_32<false>(src, dst_c1, dst_c2, dst_c3);
723
724 dst_alpha *= uint8Rec1;
725 }

◆ roundFloatToUint()

template<typename _impl >
static ALWAYS_INLINE quint8 PixelWrapper< quint8, _impl >::roundFloatToUint ( float x)
inlinestatic

Definition at line 693 of file KoStreamedMath.h.

694 {
696 }
static quint8 round_float_to_u8(float x)

References KoStreamedMath< _impl >::round_float_to_u8().

◆ write()

template<typename _impl >
ALWAYS_INLINE void PixelWrapper< quint8, _impl >::write ( quint8 * dataDst,
const float_v & c1,
const float_v & c2,
const float_v & c3,
const float_v & a )
inline

Definition at line 728 of file KoStreamedMath.h.

729 {
730 const auto alpha = a * uint8Max;
731
732 KoStreamedMath<_impl>::write_channels_32_unaligned(dataDst, alpha, c1, c2, c3);
733 }
static void write_channels_32_unaligned(void *data, const float_v alpha, const float_v c1, const float_v c2, const float_v c3)

References KoStreamedMath< _impl >::write_channels_32_unaligned().

Member Data Documentation

◆ mask

template<typename _impl >
const uint_v PixelWrapper< quint8, _impl >::mask

Definition at line 747 of file KoStreamedMath.h.

◆ uint8Max

template<typename _impl >
const float_v PixelWrapper< quint8, _impl >::uint8Max

Definition at line 748 of file KoStreamedMath.h.

◆ uint8Rec1

template<typename _impl >
const float_v PixelWrapper< quint8, _impl >::uint8Rec1

Definition at line 749 of file KoStreamedMath.h.


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