IDS peak IPL v1.17.1
Loading...
Searching...
No Matches
peak_ipl_pixel_format.hpp
Go to the documentation of this file.
1
10
11#pragma once
12
16
17#include <cstddef>
18#include <cstdint>
19
24
25namespace peak
26{
27namespace ipl
28{
29
34class PixelFormat final
35{
36public:
44 : m_name(peak::ipl::PixelFormatName::Invalid)
45 {}
46
55 PixelFormat(peak::ipl::PixelFormatName name); // NOLINT (note: implicitly used by Image...)
56
57
64 ~PixelFormat() = default;
65
74 PixelFormat(PixelFormat&& other) = default;
75
84 PixelFormat(const PixelFormat& other) = default;
85
94 PixelFormat& operator=(const PixelFormat& other) = default;
95
104 PixelFormat& operator=(PixelFormat&& other) = default;
105
113 PEAK_IPL_NO_DISCARD std::string Name() const
114 {
115 return peak::ipl::ToString(m_name);
116 }
117
126 {
127 return m_name;
128 }
129
141 {
142 return m_name == other.m_name;
143 }
144
154
164
173 PEAK_IPL_NO_DISCARD size_t NumChannels() const;
174
187
198
212
213
223
236 PEAK_IPL_NO_DISCARD uint64_t CalculateStorageSizeOfPixels(uint64_t numPixels) const;
237
246 PEAK_IPL_NO_DISCARD bool IsPacked() const;
247
256 PEAK_IPL_NO_DISCARD bool IsBayered() const;
257
266 PEAK_IPL_NO_DISCARD bool IsYUV() const;
267
276 PEAK_IPL_NO_DISCARD bool IsCoord3D() const;
277
286 PEAK_IPL_NO_DISCARD bool IsFloat() const;
287
297
298
299private:
301};
302
304 : m_name(name)
305{}
306
308{
309 size_t numSignificantBitsPerChannel = 0;
310
313 static_cast<PEAK_IPL_PIXEL_FORMAT>(m_name), &numSignificantBitsPerChannel);
314 });
315
316 return numSignificantBitsPerChannel;
317}
318
320{
321 size_t numStorageBitsPerChannel = 0;
322
325 static_cast<PEAK_IPL_PIXEL_FORMAT>(m_name), &numStorageBitsPerChannel);
326 });
327
328 return numStorageBitsPerChannel;
329}
330
331inline size_t PixelFormat::NumChannels() const
332{
333 size_t numChannels = 0;
334
337 static_cast<PEAK_IPL_PIXEL_FORMAT>(m_name), &numChannels);
338 });
339
340 return numChannels;
341}
342
344{
345 uint32_t maximumValuePerChannel = 0;
346
349 static_cast<PEAK_IPL_PIXEL_FORMAT>(m_name), &maximumValuePerChannel);
350 });
351
352 return maximumValuePerChannel;
353}
354
356{
357 size_t numSignificantBitsPerPixel = 0;
358
361 static_cast<PEAK_IPL_PIXEL_FORMAT>(m_name), &numSignificantBitsPerPixel);
362 });
363
364 return numSignificantBitsPerPixel;
365}
366
368{
369 size_t numStorageBitsPerPixel = 0;
370
373 static_cast<PEAK_IPL_PIXEL_FORMAT>(m_name), &numStorageBitsPerPixel);
374 });
375
376 return numStorageBitsPerPixel;
377}
378
380{
382
385 static_cast<PEAK_IPL_PIXEL_FORMAT>(m_name), reinterpret_cast<PEAK_IPL_ENDIANNESS*>(&endianness));
386 });
387
388 return endianness;
389}
390
391inline uint64_t PixelFormat::CalculateStorageSizeOfPixels(uint64_t numPixels) const
392{
393 uint64_t sizeOfPixels = 0;
394
397 static_cast<PEAK_IPL_PIXEL_FORMAT>(m_name), numPixels, &sizeOfPixels);
398 });
399
400 return sizeOfPixels;
401}
402
403inline bool PixelFormat::IsPacked() const
404{
405 bool isPacked = false;
406
409 static_cast<PEAK_IPL_PIXEL_FORMAT>(m_name), reinterpret_cast<PEAK_IPL_BOOL8*>(&isPacked));
410 });
411
412 return isPacked;
413}
414
415inline bool PixelFormat::IsBayered() const
416{
417 bool isPacked = false;
418
421 static_cast<PEAK_IPL_PIXEL_FORMAT>(m_name), reinterpret_cast<PEAK_IPL_BOOL8*>(&isPacked));
422 });
423
424 return isPacked;
425}
426
427inline bool PixelFormat::IsYUV() const
428{
429 auto result{ false };
430
433 static_cast<PEAK_IPL_PIXEL_FORMAT>(m_name), reinterpret_cast<PEAK_IPL_BOOL8*>(&result));
434 });
435
436 return result;
437}
438
439inline bool PixelFormat::IsCoord3D() const
440{
441 auto result{ false };
442
445 static_cast<PEAK_IPL_PIXEL_FORMAT>(m_name), reinterpret_cast<PEAK_IPL_BOOL8*>(&result));
446 });
447
448 return result;
449}
450
451inline bool PixelFormat::IsFloat() const
452{
453 auto result{ false };
454
457 static_cast<PEAK_IPL_PIXEL_FORMAT>(m_name), reinterpret_cast<PEAK_IPL_BOOL8*>(&result));
458 });
459
460 return result;
461}
462
464{
466
469 static_cast<PEAK_IPL_PIXEL_FORMAT>(m_name), reinterpret_cast<PEAK_IPL_BAYER_PATTERN*>(&pattern));
470 });
471
472 return pattern;
473}
474
475} /* namespace ipl */
476} /* namespace peak */
size_t NumChannels() const
Returns the number of channels the given pixel format has.
Definition peak_ipl_pixel_format.hpp:331
peak::ipl::BayerPattern BayerPattern() const
Queries the bayer pattern of the given pixel format.
Definition peak_ipl_pixel_format.hpp:463
peak::ipl::PixelFormatName PixelFormatName() const
Returns the name of the pixel format as enum value.
Definition peak_ipl_pixel_format.hpp:125
std::string Name() const
Returns the name of the pixel format as String.
Definition peak_ipl_pixel_format.hpp:113
bool IsBayered() const
Returns whether the pixel format is a bayer format.
Definition peak_ipl_pixel_format.hpp:415
PixelFormat()
Constructor for a new PixelFormat instance.
Definition peak_ipl_pixel_format.hpp:43
bool IsFloat() const
Returns whether the pixel format is a float format.
Definition peak_ipl_pixel_format.hpp:451
peak::ipl::Endianness Endianness() const
Returns the endianness of the given pixel format.
Definition peak_ipl_pixel_format.hpp:379
PixelFormat & operator=(const PixelFormat &other)=default
Copy assigment for PixelFormat instance.
uint64_t CalculateStorageSizeOfPixels(uint64_t numPixels) const
Returns the storage size the given number pixels of the given pixel format in bytes.
Definition peak_ipl_pixel_format.hpp:391
bool IsPacked() const
Returns whether the pixel format is packed.
Definition peak_ipl_pixel_format.hpp:403
size_t NumStorageBitsPerPixel() const
Returns the number of storage bits per pixel the given pixel format has.
Definition peak_ipl_pixel_format.hpp:367
PixelFormat(PixelFormat &&other)=default
Copy Constructor for a new PixelFormat instance.
bool operator==(const PixelFormat &other) const
Compare PixelFormat.
Definition peak_ipl_pixel_format.hpp:140
bool IsCoord3D() const
Returns whether the pixel format is a 3D coordinate format.
Definition peak_ipl_pixel_format.hpp:439
size_t NumSignificantBitsPerPixel() const
Returns the number of significant bits per pixel the given pixel format has.
Definition peak_ipl_pixel_format.hpp:355
~PixelFormat()=default
Destructor for the PixelFormat instance.
size_t NumStorageBitsPerChannel() const
Returns the number of storage bits per pixel per channel of the given pixel format.
Definition peak_ipl_pixel_format.hpp:319
bool IsYUV() const
Returns whether the pixel format is a yuv format.
Definition peak_ipl_pixel_format.hpp:427
PixelFormat & operator=(PixelFormat &&other)=default
Move assignment for PixelFormat instance.
uint32_t MaximumValuePerChannel() const
Returns the maximum value of one pixel channel the given pixel format has.
Definition peak_ipl_pixel_format.hpp:343
size_t NumSignificantBitsPerChannel() const
Returns the number of significant bits per pixel per channel of the given pixel format.
Definition peak_ipl_pixel_format.hpp:307
PixelFormat(const PixelFormat &other)=default
Move constructor for PixelFormat instance.
PixelFormatName
Enum holding the possible pixel format names.
Definition peak_ipl_simple_types.hpp:43
@ Invalid
Invalid Pixel Format.
Definition peak_ipl_simple_types.hpp:44
std::string ToString(ConversionMode entry)
Convert a ConversionMode to a string.
Definition peak_ipl_simple_types.hpp:287
Endianness
Enum holding the possible endianness (the byte order).
Definition peak_ipl_simple_types.hpp:189
BayerPattern
Enum holding the possible bayer patterns.
Definition peak_ipl_simple_types.hpp:175
@ LittleEndian
Little endian (lower bytes first)
Definition peak_ipl_simple_types.hpp:191
@ Unknown
Unknown pattern.
Definition peak_ipl_simple_types.hpp:176
The "peak::ipl" namespace contains the whole image processing library.
void ExecuteAndMapReturnCodes(const CallableType &callableObject)
Definition peak_ipl_exception.hpp:289
#define PEAK_IPL_NO_DISCARD
Definition peak_ipl_attribute_defines.h:25
PEAK_IPL_C_API PEAK_IPL_PixelFormat_IsPacked(PEAK_IPL_PIXEL_FORMAT pixelFormat, PEAK_IPL_BOOL8 *isPacked)
Check if the supplied format is packed.
PEAK_IPL_C_API PEAK_IPL_PixelFormat_GetMaximumValuePerChannel(PEAK_IPL_PIXEL_FORMAT pixelFormat, uint32_t *channelMaximumValue)
Queries the maximum value of one pixel channel of the given pixel format.
PEAK_IPL_C_API PEAK_IPL_PixelFormat_GetNumSignificantBitsPerChannel(PEAK_IPL_PIXEL_FORMAT pixelFormat, size_t *numSignificantBits)
Queries the number of significant bits per pixel per channel of the given pixel format.
PEAK_IPL_C_API PEAK_IPL_PixelFormat_GetNumChannels(PEAK_IPL_PIXEL_FORMAT pixelFormat, size_t *numChannels)
Queries the number of channels of the given pixel format.
PEAK_IPL_C_API PEAK_IPL_PixelFormat_GetNumStorageBitsPerChannel(PEAK_IPL_PIXEL_FORMAT pixelFormat, size_t *numStorageBits)
Queries the number of storage bits per pixel per channel of the given pixel format.
PEAK_IPL_C_API PEAK_IPL_PixelFormat_GetNumSignificantBitsPerPixel(PEAK_IPL_PIXEL_FORMAT pixelFormat, size_t *numSignificantBits)
Queries the number of significant bits per pixel of the given pixel format.
PEAK_IPL_C_API PEAK_IPL_PixelFormat_IsBayered(PEAK_IPL_PIXEL_FORMAT pixelFormat, PEAK_IPL_BOOL8 *isBayered)
Check if the supplied format is a bayer format.
PEAK_IPL_C_API PEAK_IPL_PixelFormat_GetBayerPattern(PEAK_IPL_PIXEL_FORMAT pixelFormat, PEAK_IPL_BAYER_PATTERN *pattern)
Queries the bayer pattern of the given pixel format.
PEAK_IPL_C_API PEAK_IPL_PixelFormat_CalculateStorageSizeOfPixels(PEAK_IPL_PIXEL_FORMAT pixelFormat, uint64_t numPixels, uint64_t *size)
Calculates the storage size of the given number of pixels of the given pixel format in bytes.
PEAK_IPL_C_API PEAK_IPL_PixelFormat_IsFloat(PEAK_IPL_PIXEL_FORMAT pixelFormat, PEAK_IPL_BOOL8 *isFloat)
Check if the supplied format is a float format.
int8_t PEAK_IPL_BOOL8
Definition peak_ipl_backend.h:26
PEAK_IPL_C_API PEAK_IPL_PixelFormat_GetEndianness(PEAK_IPL_PIXEL_FORMAT pixelFormat, PEAK_IPL_ENDIANNESS *endianness)
Queries the endianness of the given pixel format.
int32_t PEAK_IPL_BAYER_PATTERN
Definition peak_ipl_backend.h:185
int32_t PEAK_IPL_PIXEL_FORMAT
Definition peak_ipl_backend.h:173
PEAK_IPL_C_API PEAK_IPL_PixelFormat_GetNumStorageBitsPerPixel(PEAK_IPL_PIXEL_FORMAT pixelFormat, size_t *numStorageBits)
Queries the number of storage bits per pixel of the given pixel format.
PEAK_IPL_C_API PEAK_IPL_PixelFormat_IsYUV(PEAK_IPL_PIXEL_FORMAT pixelFormat, PEAK_IPL_BOOL8 *isYUV)
Check if the supplied format is a yuv format.
PEAK_IPL_C_API PEAK_IPL_PixelFormat_IsCoord3D(PEAK_IPL_PIXEL_FORMAT pixelFormat, PEAK_IPL_BOOL8 *isCoord3D)
Check if the supplied format is a 3D coordinate format.
int32_t PEAK_IPL_ENDIANNESS
Definition peak_ipl_backend.h:194
#define PEAK_IPL_C_ABI_PREFIX
Definition peak_ipl_dll_defines.h:16