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 676 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 679 of file KoStreamedMath.h.

◆ int_v

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

Definition at line 677 of file KoStreamedMath.h.

◆ uint_v

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

Definition at line 678 of file KoStreamedMath.h.

Constructor & Destructor Documentation

◆ PixelWrapper()

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

Definition at line 710 of file KoStreamedMath.h.

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

Member Function Documentation

◆ clearPixels()

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

Definition at line 734 of file KoStreamedMath.h.

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

◆ copyPixels()

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

Definition at line 740 of file KoStreamedMath.h.

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

◆ denormalizeAlpha()

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

Definition at line 704 of file KoStreamedMath.h.

705 {
706 const float uint8Max = 255.0f;
707 alpha *= uint8Max;
708 }

◆ lerpMixedUintFloat()

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

Definition at line 685 of file KoStreamedMath.h.

686 {
688 }
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 697 of file KoStreamedMath.h.

698 {
699 const float uint8Rec1 = 1.0f / 255.0f;
700 alpha *= uint8Rec1;
701 }

◆ 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 717 of file KoStreamedMath.h.

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

◆ roundFloatToUint()

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

Definition at line 691 of file KoStreamedMath.h.

692 {
694 }
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 726 of file KoStreamedMath.h.

727 {
728 const auto alpha = a * uint8Max;
729
730 KoStreamedMath<_impl>::write_channels_32_unaligned(dataDst, alpha, c1, c2, c3);
731 }
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 745 of file KoStreamedMath.h.

◆ uint8Max

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

Definition at line 746 of file KoStreamedMath.h.

◆ uint8Rec1

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

Definition at line 747 of file KoStreamedMath.h.


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