11#ifndef GAMP_RENDER_PIXEL_PIXELUTIL_HPP_
12#define GAMP_RENDER_PIXEL_PIXELUTIL_HPP_
62 inline constexpr uint32_t
npos = std::numeric_limits<uint32_t>::max();
67 while( i < poolCount && pool[i] != s) { ++i; }
69 if( poolCount == i ) {
71 if( mapRGB2Y && 1 == poolCount && pool[0] ==
CType::Y &&
110 : m_dstCount(dstCompCount), m_srcCount(srcCompCount), dst2src(), src2dst()
113 dst2src[i] =
find(dstCompOrder[i], srcCompCount, srcCompOrder,
true);
116 src2dst[i] =
find(srcCompOrder[i], dstCompCount, dstCompOrder,
true);
118 srcRGBA[0] =
find(
CType::R, srcCompCount, srcCompOrder,
false);
119 srcRGBA[0] =
find(
CType::G, srcCompCount, srcCompOrder,
false);
120 srcRGBA[0] =
find(
CType::B, srcCompCount, srcCompOrder,
false);
121 srcRGBA[0] =
find(
CType::A, srcCompCount, srcCompOrder,
false);
122 hasSrcRGB =
npos != srcRGBA[0] &&
npos != srcRGBA[1] &&
npos != srcRGBA[2];
133 inline uint32_t
getShifted32(uint32_t bytesPerPixel,
const uint8_t* data) {
134 if( bytesPerPixel > 4 ) {
138 for(uint32_t i=0; i<bytesPerPixel; ++i) {
139 res |= ( 0xffU & data[i] ) << CHAR_BIT*i;
150 inline uint64_t
getShifted64(uint32_t bytesPerPixel,
const uint8_t* data) {
151 if( bytesPerPixel > 8 ) {
155 for(uint32_t i=0; i<bytesPerPixel; ++i) {
156 res |= ( 0xffU & data[i] ) << CHAR_BIT*i;
#define JAU_MAKE_ENUM_STRING(type,...)
std::array< uint32_t, 4 > u32array4_t
uint32_t find(CType s, jau::nsize_t poolCount, const comparray4_t &pool, bool mapRGB2Y) noexcept
Returns first index of given CType within pool , npos if not exists.
uint64_t getShifted64(uint32_t bytesPerPixel, const uint8_t *data)
Returns shifted bytes from the given data at given offset of maximal 8 bytesPerPixel.
constexpr uint32_t npos
maximum index, denoting no position or not found.
std::array< CType, 4 > comparray4_t
uint32_t getShifted32(uint32_t bytesPerPixel, const uint8_t *data)
Returns shifted bytes from the given data at given offset of maximal 4 bytesPerPixel.
constexpr ComponentMap(jau::nsize_t srcCompCount, const comparray4_t &srcCompOrder, jau::nsize_t dstCompCount, const comparray4_t &dstCompOrder) noexcept
@ Y
Luminance component, e.g.
uint_bytes_t< sizeof(unsigned long int)> nsize_t
Natural 'size_t' alternative using uint<XX>_t with xx = sizeof(unsigned long int)*8 as its natural si...