IDS peak IPL v1.13.0
Loading...
Searching...
No Matches
peak_ipl_pixel_format.hpp
Go to the documentation of this file.
1
11#pragma once
12
16
17#include <cstddef>
18#include <cstdint>
19
23namespace peak
24{
25namespace ipl
26{
27
31class PixelFormat final
32{
33public:
41 : m_name(peak::ipl::PixelFormatName::Invalid)
42 {}
43
52 PixelFormat(peak::ipl::PixelFormatName name); // NOLINT (note: implicitly used by Image...)
53
54
61 ~PixelFormat() = default;
62
71 PixelFormat(PixelFormat&& other) = default;
72
81 PixelFormat(const PixelFormat& other) = default;
82
91 PixelFormat& operator=(const PixelFormat& other) = default;
92
101 PixelFormat& operator=(PixelFormat&& other) = default;
102
110 PEAK_IPL_NO_DISCARD std::string Name() const
111 {
112 return peak::ipl::ToString(m_name);
113 }
114
123 {
124 return m_name;
125 }
126
138 {
139 return m_name == other.m_name;
140 }
141
151
161
170 PEAK_IPL_NO_DISCARD size_t NumChannels() const;
171
184
195
209
210
220
233 PEAK_IPL_NO_DISCARD uint64_t CalculateStorageSizeOfPixels(uint64_t numPixels) const;
234
243 PEAK_IPL_NO_DISCARD bool IsPacked() const;
244
253 PEAK_IPL_NO_DISCARD bool IsBayered() const;
254
263 PEAK_IPL_NO_DISCARD bool IsYUV() const;
264
273 PEAK_IPL_NO_DISCARD bool IsCoord3D() const;
274
283 PEAK_IPL_NO_DISCARD bool IsFloat() const;
284
294
295
296private:
298};
299
301 : m_name(name)
302{}
303
305{
306 size_t numSignificantBitsPerChannel = 0;
307
310 static_cast<PEAK_IPL_PIXEL_FORMAT>(m_name), &numSignificantBitsPerChannel);
311 });
312
313 return numSignificantBitsPerChannel;
314}
315
317{
318 size_t numStorageBitsPerChannel = 0;
319
322 static_cast<PEAK_IPL_PIXEL_FORMAT>(m_name), &numStorageBitsPerChannel);
323 });
324
325 return numStorageBitsPerChannel;
326}
327
328inline size_t PixelFormat::NumChannels() const
329{
330 size_t numChannels = 0;
331
334 static_cast<PEAK_IPL_PIXEL_FORMAT>(m_name), &numChannels);
335 });
336
337 return numChannels;
338}
339
341{
342 uint32_t maximumValuePerChannel = 0;
343
346 static_cast<PEAK_IPL_PIXEL_FORMAT>(m_name), &maximumValuePerChannel);
347 });
348
349 return maximumValuePerChannel;
350}
351
353{
354 size_t numSignificantBitsPerPixel = 0;
355
358 static_cast<PEAK_IPL_PIXEL_FORMAT>(m_name), &numSignificantBitsPerPixel);
359 });
360
361 return numSignificantBitsPerPixel;
362}
363
365{
366 size_t numStorageBitsPerPixel = 0;
367
370 static_cast<PEAK_IPL_PIXEL_FORMAT>(m_name), &numStorageBitsPerPixel);
371 });
372
373 return numStorageBitsPerPixel;
374}
375
377{
379
382 static_cast<PEAK_IPL_PIXEL_FORMAT>(m_name), reinterpret_cast<PEAK_IPL_ENDIANNESS*>(&endianness));
383 });
384
385 return endianness;
386}
387
388inline uint64_t PixelFormat::CalculateStorageSizeOfPixels(uint64_t numPixels) const
389{
390 uint64_t sizeOfPixels = 0;
391
394 static_cast<PEAK_IPL_PIXEL_FORMAT>(m_name), numPixels, &sizeOfPixels);
395 });
396
397 return sizeOfPixels;
398}
399
400inline bool PixelFormat::IsPacked() const
401{
402 bool isPacked = false;
403
406 static_cast<PEAK_IPL_PIXEL_FORMAT>(m_name), reinterpret_cast<PEAK_IPL_BOOL8*>(&isPacked));
407 });
408
409 return isPacked;
410}
411
412inline bool PixelFormat::IsBayered() const
413{
414 bool isPacked = false;
415
418 static_cast<PEAK_IPL_PIXEL_FORMAT>(m_name), reinterpret_cast<PEAK_IPL_BOOL8*>(&isPacked));
419 });
420
421 return isPacked;
422}
423
424inline bool PixelFormat::IsYUV() const
425{
426 auto result{ false };
427
430 static_cast<PEAK_IPL_PIXEL_FORMAT>(m_name), reinterpret_cast<PEAK_IPL_BOOL8*>(&result));
431 });
432
433 return result;
434}
435
436inline bool PixelFormat::IsCoord3D() const
437{
438 auto result{ false };
439
442 static_cast<PEAK_IPL_PIXEL_FORMAT>(m_name), reinterpret_cast<PEAK_IPL_BOOL8*>(&result));
443 });
444
445 return result;
446}
447
448inline bool PixelFormat::IsFloat() const
449{
450 auto result{ false };
451
454 static_cast<PEAK_IPL_PIXEL_FORMAT>(m_name), reinterpret_cast<PEAK_IPL_BOOL8*>(&result));
455 });
456
457 return result;
458}
459
461{
463
466 static_cast<PEAK_IPL_PIXEL_FORMAT>(m_name), reinterpret_cast<PEAK_IPL_BAYER_PATTERN*>(&pattern));
467 });
468
469 return pattern;
470}
471
472} /* namespace ipl */
473} /* namespace peak */
Represents a pixel format and its specific properties.
Definition peak_ipl_pixel_format.hpp:32
size_t NumChannels() const
Returns the number of channels the given pixel format has.
Definition peak_ipl_pixel_format.hpp:328
peak::ipl::BayerPattern BayerPattern() const
Queries the bayer pattern of the given pixel format.
Definition peak_ipl_pixel_format.hpp:460
peak::ipl::PixelFormatName PixelFormatName() const
Returns the name of the pixel format as enum value.
Definition peak_ipl_pixel_format.hpp:122
std::string Name() const
Returns the name of the pixel format as String.
Definition peak_ipl_pixel_format.hpp:110
bool IsBayered() const
Returns whether the pixel format is a bayer format.
Definition peak_ipl_pixel_format.hpp:412
PixelFormat()
Constructor for a new PixelFormat instance.
Definition peak_ipl_pixel_format.hpp:40
bool IsFloat() const
Returns whether the pixel format is a float format.
Definition peak_ipl_pixel_format.hpp:448
peak::ipl::Endianness Endianness() const
Returns the endianness of the given pixel format.
Definition peak_ipl_pixel_format.hpp:376
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:388
bool IsPacked() const
Returns whether the pixel format is packed.
Definition peak_ipl_pixel_format.hpp:400
size_t NumStorageBitsPerPixel() const
Returns the number of storage bits per pixel the given pixel format has.
Definition peak_ipl_pixel_format.hpp:364
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:137
bool IsCoord3D() const
Returns whether the pixel format is a 3D coordinate format.
Definition peak_ipl_pixel_format.hpp:436
size_t NumSignificantBitsPerPixel() const
Returns the number of significant bits per pixel the given pixel format has.
Definition peak_ipl_pixel_format.hpp:352
~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:316
bool IsYUV() const
Returns whether the pixel format is a yuv format.
Definition peak_ipl_pixel_format.hpp:424
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:340
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:304
PixelFormat(const PixelFormat &other)=default
Move constructor for PixelFormat instance.
std::string ToString(ConversionMode entry)
Convert a ConversionMode to a string.
Definition peak_ipl_simple_types.hpp:275
Endianness
Enum holding the possible endianness (the byte order).
Definition peak_ipl_simple_types.hpp:183
@ LittleEndian
Little endian (lower bytes first)
BayerPattern
Enum holding the possible bayer patterns.
Definition peak_ipl_simple_types.hpp:170
@ Unknown
Unknown pattern.
PixelFormatName
Enum holding the possible pixel format names.
Definition peak_ipl_simple_types.hpp:39
@ Invalid
Invalid Pixel Format.
void ExecuteAndMapReturnCodes(const CallableType &callableObject)
Definition peak_ipl_exception.hpp:182
The "peak::ipl" namespace contains the whole image processing library.
Definition peak_ipl_binning.hpp:23
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:41
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:200
#define PEAK_IPL_NO_DISCARD
Definition peak_ipl_backend.h:26
int32_t PEAK_IPL_PIXEL_FORMAT
Definition peak_ipl_backend.h:188
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:209
#define PEAK_IPL_C_ABI_PREFIX
Definition peak_ipl_dll_defines.h:16