IDS peak IPL  v1.5.0
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 
23 namespace peak
24 {
25 namespace ipl
26 {
27 
31 class PixelFormat final
32 {
33 public:
35  : m_name(peak::ipl::PixelFormatName::Invalid)
36  {}
38  ~PixelFormat() = default;
39  PixelFormat(const PixelFormat& other) = default;
40  PixelFormat& operator=(const PixelFormat& other) = default;
41  PixelFormat(PixelFormat&& other) = default;
42  PixelFormat& operator=(PixelFormat&& other) = default;
43 
53  std::string Name() const
54  {
55  return peak::ipl::ToString(m_name);
56  }
57 
68  {
69  return m_name;
70  }
71 
72  bool operator==(const PixelFormat& other) const
73  {
74  return m_name == other.m_name;
75  }
76 
85  size_t NumSignificantBitsPerChannel() const;
86 
96  size_t NumStorageBitsPerChannel() const;
97 
106  size_t NumChannels() const;
107 
117  uint32_t MaximumValuePerChannel() const;
118 
128  size_t NumSignificantBitsPerPixel() const;
129 
139  size_t NumStorageBitsPerPixel() const;
140 
141 
151 
162  uint64_t CalculateStorageSizeOfPixels(uint64_t numPixels) const;
163 
164 private:
166 };
167 
169  : m_name(name)
170 {}
171 
173 {
174  size_t numSignificantBitsPerChannel = 0;
175 
178  static_cast<PEAK_IPL_PIXEL_FORMAT>(m_name), &numSignificantBitsPerChannel);
179  });
180 
181  return numSignificantBitsPerChannel;
182 }
183 
185 {
186  size_t numStorageBitsPerChannel = 0;
187 
190  static_cast<PEAK_IPL_PIXEL_FORMAT>(m_name), &numStorageBitsPerChannel);
191  });
192 
193  return numStorageBitsPerChannel;
194 }
195 
196 inline size_t PixelFormat::NumChannels() const
197 {
198  size_t numChannels = 0;
199 
202  static_cast<PEAK_IPL_PIXEL_FORMAT>(m_name), &numChannels);
203  });
204 
205  return numChannels;
206 }
207 
208 inline uint32_t PixelFormat::MaximumValuePerChannel() const
209 {
210  uint32_t maximumValuePerChannel = 0;
211 
214  static_cast<PEAK_IPL_PIXEL_FORMAT>(m_name), &maximumValuePerChannel);
215  });
216 
217  return maximumValuePerChannel;
218 }
219 
221 {
222  size_t numSignificantBitsPerPixel = 0;
223 
226  static_cast<PEAK_IPL_PIXEL_FORMAT>(m_name), &numSignificantBitsPerPixel);
227  });
228 
229  return numSignificantBitsPerPixel;
230 }
231 
233 {
234  size_t numStorageBitsPerPixel = 0;
235 
238  static_cast<PEAK_IPL_PIXEL_FORMAT>(m_name), &numStorageBitsPerPixel);
239  });
240 
241  return numStorageBitsPerPixel;
242 }
243 
245 {
247 
250  static_cast<PEAK_IPL_PIXEL_FORMAT>(m_name), reinterpret_cast<PEAK_IPL_ENDIANNESS*>(&endianness));
251  });
252 
253  return endianness;
254 }
255 
256 inline uint64_t PixelFormat::CalculateStorageSizeOfPixels(uint64_t numPixels) const
257 {
258  uint64_t sizeOfPixels = 0;
259 
262  static_cast<PEAK_IPL_PIXEL_FORMAT>(m_name), numPixels, &sizeOfPixels);
263  });
264 
265  return sizeOfPixels;
266 }
267 
268 } /* namespace ipl */
269 } /* namespace peak */
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_GetEndianness(PEAK_IPL_PIXEL_FORMAT pixelFormat, PEAK_IPL_ENDIANNESS *endianness)
Queries the endianness of the given pixel format.
#define PEAK_IPL_C_ABI_PREFIX
Definition: peak_ipl_dll_defines.h:16
PixelFormat()
Definition: peak_ipl_pixel_format.hpp:34
PixelFormatName
Enum holding the possible pixel format names.
Definition: peak_ipl_simple_types.hpp:38
PixelFormat & operator=(const PixelFormat &other)=default
The "peak::ipl" namespace contains the whole image processing library.
Definition: peak_ipl_binning.hpp:16
std::string Name() const
Returns the name of the pixel format as String.
Definition: peak_ipl_pixel_format.hpp:53
uint64_t CalculateStorageSizeOfPixels(uint64_t numPixels) const
Returns the storage size of the given number of pixels of the given pixel format in bytes...
Definition: peak_ipl_pixel_format.hpp:256
void ExecuteAndMapReturnCodes(const CallableType &callableObject)
Definition: peak_ipl_exception.hpp:182
Endianness
Enum holding the possible endianness (the byte order).
Definition: peak_ipl_simple_types.hpp:144
peak::ipl::Endianness Endianness() const
Returns the endianness of the given pixel format.
Definition: peak_ipl_pixel_format.hpp:244
uint32_t MaximumValuePerChannel() const
Returns the maximum value of one pixel channel of the given pixel format.
Definition: peak_ipl_pixel_format.hpp:208
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.
size_t NumSignificantBitsPerPixel() const
Returns the number of significant bits per pixel of the given pixel format.
Definition: peak_ipl_pixel_format.hpp:220
peak::ipl::PixelFormatName PixelFormatName() const
Returns the name of the pixel format as enum value.
Definition: peak_ipl_pixel_format.hpp:67
size_t NumChannels() const
Returns the number of channels of the given pixel format.
Definition: peak_ipl_pixel_format.hpp:196
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...
bool operator==(const PixelFormat &other) const
Definition: peak_ipl_pixel_format.hpp:72
size_t NumStorageBitsPerPixel() const
Returns the number of storage bits per pixel of the given pixel format.
Definition: peak_ipl_pixel_format.hpp:232
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.
Represents a pixel format and its specific properties.
Definition: peak_ipl_pixel_format.hpp:31
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.
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:172
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.
std::string ToString(ConversionMode entry)
Definition: peak_ipl_simple_types.hpp:160
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:184
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.