33template<u
int8_t BitDepth>
76template<u
int8_t BitDepth>
89 static constexpr uint64_t
max()
91 return (1ULL << BitDepth) - 1;
99 static constexpr uint64_t
min()
121template<u
int8_t SourceBitDepth, u
int8_t TargetBitDepth>
159 template<
typename Iterator>
163 begin <= end,
"PixelByteSwapper: begin iterator must not be after end iterator");
171 template<
typename Iterator>
175 begin <= end,
"PixelByteSwapper: begin iterator must not be after end iterator");
177 for(
auto it = begin; it != end; ++it) {
178 auto next = std::next(it);
181 std::iter_swap(it, next);
Assertion macros and utilities based on the PPK_ASSERT library.
#define IRSOL_ASSERT_ERROR
Error-level assertion macro.
Common portability and diagnostic macros for the irsol library.
#define IRSOL_MAYBE_UNUSED
Suppresses compiler warnings about unused variables or parameters.
void operator()(Iterator begin, Iterator end) const
Utility for swapping pixel bytes in a buffer.
void operator()(IRSOL_MAYBE_UNUSED Iterator begin, IRSOL_MAYBE_UNUSED Iterator end) const
Helper to convert pixel values from one bit depth to another with scaling.
static constexpr double factor
Compile-time scaling factor: max(Target) / max(Source)
static Pixel< TargetBitDepth >::representation scale(typename Pixel< SourceBitDepth >::representation value)
Scales a pixel value from source bit depth to target bit depth.
Helper trait to map a pixel bit depth to an appropriate integral representation type.
Represents a pixel with a given bit depth.
typename PixelRepresentation< BitDepth >::type representation
The integral type used to represent pixel values at this bit depth.
static constexpr uint64_t max()
Returns the maximum representable pixel value for this bit depth.
static constexpr uint64_t min()
Returns the minimum representable pixel value (always zero).