/home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-roccv/checkouts/latest/include/core/image_format.hpp Source File

/home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-roccv/checkouts/latest/include/core/image_format.hpp Source File#

6 min read time

Applies to Linux

rocCV: /home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-roccv/checkouts/latest/include/core/image_format.hpp Source File
image_format.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2025 Advanced Micro Devices, Inc. All rights reserved.
3  * Permission is hereby granted, free of charge, to any person obtaining a copy
4  * of this software and associated documentation files (the "Software"), to deal
5  * in the Software without restriction, including without limitation the rights
6  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7  * copies of the Software, and to permit persons to whom the Software is
8  * furnished to do so, subject to the following conditions:
9  *
10  * The above copyright notice and this permission notice shall be included in
11  * all copies or substantial portions of the Software.
12  *
13  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19  * THE SOFTWARE.
20  */
21 
22 #pragma once
23 
24 #include "data_type.hpp"
25 
26 namespace roccv {
27 
32 enum class eSwizzle {
33  XYZW,
34  ZYXW,
35 };
36 
41 class ImageFormat {
42  public:
43  explicit ImageFormat() {}
44  explicit constexpr ImageFormat(eDataType dtype, int32_t numChannels, eSwizzle swizzle = eSwizzle::XYZW)
45  : m_dtype(dtype), m_numChannels(numChannels), m_swizzle(swizzle) {}
46 
47  eDataType dtype() const noexcept;
48  int32_t channels() const noexcept;
49  eSwizzle swizzle() const noexcept;
50 
51  private:
52  eDataType m_dtype;
53  int32_t m_numChannels;
54  eSwizzle m_swizzle;
55 };
56 
57 // Single plane with one 8-bit unsigned integer channel.
59 
60 // Single plane with one 8-bit signed integer channel.
62 
63 // Single plane with one 16-bit unsigned integer channel.
65 
66 // Single plane with one 16-bit signed integer channel.
68 
69 // Single plane with one 32-bit unsigned integer channel.
71 
72 // Single plane with one 32-bit signed integer channel.
74 
75 // Single plane with one 32-bit floating point channel.
77 
78 // Single plane with one 64-bit floating point channel.
80 
81 // Single plane with interleaved RGB 8-bit channel.
83 
84 // Single plane with interleaved BGR 8-bit channel.
86 
87 // Single plane with interleaved RGBA 8-bit channel.
89 
90 // Single plane with interleaved BGRA 8-bit channel.
92 
93 // Single plane with interleaved RGB signed 8-bit channel.
95 
96 // Single plane with interleaved RGBA signed 8-bit channel.
98 
99 // Single plane with interleaved RGB 16-bit channel.
101 
102 // Single plane with interleaved RGBA 16-bit channel.
104 
105 // Single plane with interleaved RGB signed 16-bit channel.
107 
108 // Single plane with interleaved RGBA signed 16-bit channel.
110 
111 // Single plane with interleaved RGB 32-bit channel.
113 
114 // Single plane with interleaved RGBA 32-bit channel.
116 
117 // Single plane with interleaved RGB float32 channel.
119 
120 // Single plane with interleaved RGBA float32 channel.
122 
123 // Single plane with interleaved RGB float64 channel.
125 
126 // Single plane with interleaved RGBA float32 channel.
128 
129 } // namespace roccv
Acts as a container for data corresponding to how image data is laid out in memory.
Definition: image_format.hpp:41
eSwizzle swizzle() const noexcept
int32_t channels() const noexcept
constexpr ImageFormat(eDataType dtype, int32_t numChannels, eSwizzle swizzle=eSwizzle::XYZW)
Definition: image_format.hpp:44
eDataType dtype() const noexcept
ImageFormat()
Definition: image_format.hpp:43
Definition: strided_data_wrap.hpp:33
constexpr ImageFormat FMT_F32(eDataType::DATA_TYPE_F32, 1, eSwizzle::XYZW)
constexpr ImageFormat FMT_RGBAs8(eDataType::DATA_TYPE_S8, 4, eSwizzle::XYZW)
constexpr ImageFormat FMT_RGB16(eDataType::DATA_TYPE_U16, 3, eSwizzle::XYZW)
constexpr ImageFormat FMT_RGBs8(eDataType::DATA_TYPE_S8, 3, eSwizzle::XYZW)
constexpr ImageFormat FMT_RGB32(eDataType::DATA_TYPE_U32, 3, eSwizzle::XYZW)
constexpr ImageFormat FMT_BGRA8(eDataType::DATA_TYPE_U8, 4, eSwizzle::ZYXW)
constexpr ImageFormat FMT_U32(eDataType::DATA_TYPE_U32, 1, eSwizzle::XYZW)
constexpr ImageFormat FMT_RGBAf64(eDataType::DATA_TYPE_F64, 4, eSwizzle::XYZW)
constexpr ImageFormat FMT_RGB8(eDataType::DATA_TYPE_U8, 3, eSwizzle::XYZW)
constexpr ImageFormat FMT_RGBs16(eDataType::DATA_TYPE_S16, 3)
constexpr ImageFormat FMT_RGBAf32(eDataType::DATA_TYPE_F32, 4, eSwizzle::XYZW)
constexpr ImageFormat FMT_RGBf32(eDataType::DATA_TYPE_F32, 3, eSwizzle::XYZW)
constexpr ImageFormat FMT_U8(eDataType::DATA_TYPE_U8, 1, eSwizzle::XYZW)
constexpr ImageFormat FMT_S32(eDataType::DATA_TYPE_S32, 1, eSwizzle::XYZW)
constexpr ImageFormat FMT_RGBAs16(eDataType::DATA_TYPE_S16, 4)
constexpr ImageFormat FMT_BGR8(eDataType::DATA_TYPE_U8, 3, eSwizzle::ZYXW)
constexpr ImageFormat FMT_F64(eDataType::DATA_TYPE_F64, 1, eSwizzle::XYZW)
constexpr ImageFormat FMT_RGBA8(eDataType::DATA_TYPE_U8, 4, eSwizzle::XYZW)
constexpr ImageFormat FMT_S8(eDataType::DATA_TYPE_S8, 1, eSwizzle::XYZW)
constexpr ImageFormat FMT_RGBA16(eDataType::DATA_TYPE_U16, 4, eSwizzle::XYZW)
constexpr ImageFormat FMT_RGBA32(eDataType::DATA_TYPE_U32, 4, eSwizzle::XYZW)
constexpr ImageFormat FMT_S16(eDataType::DATA_TYPE_S16, 1, eSwizzle::XYZW)
eSwizzle
Defines the swizzling for channel ordering.
Definition: image_format.hpp:32
constexpr ImageFormat FMT_U16(eDataType::DATA_TYPE_U16, 1, eSwizzle::XYZW)
constexpr ImageFormat FMT_RGBf64(eDataType::DATA_TYPE_F64, 3, eSwizzle::XYZW)
eDataType
Definition: util_enums.h:25
@ DATA_TYPE_S8
Definition: util_enums.h:27
@ DATA_TYPE_U32
Definition: util_enums.h:30
@ DATA_TYPE_F32
Definition: util_enums.h:32
@ DATA_TYPE_U16
Definition: util_enums.h:28
@ DATA_TYPE_F64
Definition: util_enums.h:33
@ DATA_TYPE_U8
Definition: util_enums.h:26
@ DATA_TYPE_S16
Definition: util_enums.h:29
@ DATA_TYPE_S32
Definition: util_enums.h:31