VPI - Vision Programming Interface

3.2 Release

PixelType.h
Go to the documentation of this file.
1 /*
2  * Copyright 2020-2021 NVIDIA Corporation. All rights reserved.
3  *
4  * NOTICE TO LICENSEE:
5  *
6  * This source code and/or documentation ("Licensed Deliverables") are
7  * subject to NVIDIA intellectual property rights under U.S. and
8  * international Copyright laws.
9  *
10  * These Licensed Deliverables contained herein is PROPRIETARY and
11  * CONFIDENTIAL to NVIDIA and is being provided under the terms and
12  * conditions of a form of NVIDIA software license agreement by and
13  * between NVIDIA and Licensee ("License Agreement") or electronically
14  * accepted by Licensee. Notwithstanding any terms or conditions to
15  * the contrary in the License Agreement, reproduction or disclosure
16  * of the Licensed Deliverables to any third party without the express
17  * written consent of NVIDIA is prohibited.
18  *
19  * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
20  * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
21  * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
22  * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
23  * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
24  * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
25  * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
26  * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
27  * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
28  * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
29  * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
30  * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
31  * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
32  * OF THESE LICENSED DELIVERABLES.
33  *
34  * U.S. Government End Users. These Licensed Deliverables are a
35  * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
36  * 1995), consisting of "commercial computer software" and "commercial
37  * computer software documentation" as such terms are used in 48
38  * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
39  * only as a commercial end item. Consistent with 48 C.F.R.12.212 and
40  * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
41  * U.S. Government End Users acquire the Licensed Deliverables with
42  * only those rights set forth herein.
43  *
44  * Any use of the Licensed Deliverables in individual and commercial
45  * software must include, in the user documentation and internal
46  * comments to the code, the above Disclaimer and U.S. Government End
47  * Users Notice.
48  */
49 
56 #ifndef NV_VPI_PIXEL_TYPE_H
57 #define NV_VPI_PIXEL_TYPE_H
58 
59 #include "DataLayout.h"
60 #include "detail/FormatUtils.h"
61 
62 #ifdef __cplusplus
63 extern "C" {
64 #endif
65 
78 typedef uint64_t VPIPixelType;
79 
80 /* clang-format off */
81 
83 #define VPI_PIXEL_TYPE_DEFAULT ((VPIPixelType)0)
85 #define VPI_PIXEL_TYPE_INVALID VPI_PIXEL_TYPE_DEFAULT
86 
88 #define VPI_PIXEL_TYPE_U8 VPI_DETAIL_MAKE_PIX_TYPE(PL, UNSIGNED, X8)
90 #define VPI_PIXEL_TYPE_2U8 VPI_DETAIL_MAKE_PIX_TYPE(PL, UNSIGNED, X8_Y8)
92 #define VPI_PIXEL_TYPE_3U8 VPI_DETAIL_MAKE_PIX_TYPE(PL, UNSIGNED, X8_Y8_Z8)
94 #define VPI_PIXEL_TYPE_4U8 VPI_DETAIL_MAKE_PIX_TYPE(PL, UNSIGNED, X8_Y8_Z8_W8)
95 
97 #define VPI_PIXEL_TYPE_S8 VPI_DETAIL_MAKE_PIX_TYPE(PL, SIGNED, X8)
99 #define VPI_PIXEL_TYPE_2S8 VPI_DETAIL_MAKE_PIX_TYPE(PL, SIGNED, X8_Y8)
101 #define VPI_PIXEL_TYPE_3S8 VPI_DETAIL_MAKE_PIX_TYPE(PL, SIGNED, X8_Y8_Z8)
103 #define VPI_PIXEL_TYPE_4S8 VPI_DETAIL_MAKE_PIX_TYPE(PL, SIGNED, X8_Y8_Z8_W8)
104 
106 #define VPI_PIXEL_TYPE_U16 VPI_DETAIL_MAKE_PIX_TYPE(PL, UNSIGNED, X16)
108 #define VPI_PIXEL_TYPE_2U16 VPI_DETAIL_MAKE_PIX_TYPE(PL, UNSIGNED, X16_Y16)
110 #define VPI_PIXEL_TYPE_3U16 VPI_DETAIL_MAKE_PIX_TYPE(PL, UNSIGNED, X16_Y16_Z16)
112 #define VPI_PIXEL_TYPE_4U16 VPI_DETAIL_MAKE_PIX_TYPE(PL, UNSIGNED, X16_Y16_Z16_W16)
113 
115 #define VPI_PIXEL_TYPE_S16 VPI_DETAIL_MAKE_PIX_TYPE(PL, SIGNED, X16)
117 #define VPI_PIXEL_TYPE_2S16 VPI_DETAIL_MAKE_PIX_TYPE(PL, SIGNED, X16_Y16)
119 #define VPI_PIXEL_TYPE_3S16 VPI_DETAIL_MAKE_PIX_TYPE(PL, SIGNED, X16_Y16_Z16)
121 #define VPI_PIXEL_TYPE_4S16 VPI_DETAIL_MAKE_PIX_TYPE(PL, SIGNED, X16_Y16_Z16_W16)
122 
124 #define VPI_PIXEL_TYPE_U32 VPI_DETAIL_MAKE_PIX_TYPE(PL, UNSIGNED, X32)
126 #define VPI_PIXEL_TYPE_2U32 VPI_DETAIL_MAKE_PIX_TYPE(PL, UNSIGNED, X32_Y32)
128 #define VPI_PIXEL_TYPE_3U32 VPI_DETAIL_MAKE_PIX_TYPE(PL, UNSIGNED, X32_Y32_Z32)
130 #define VPI_PIXEL_TYPE_4U32 VPI_DETAIL_MAKE_PIX_TYPE(PL, UNSIGNED, X32_Y32_Z32_W32)
131 
133 #define VPI_PIXEL_TYPE_S32 VPI_DETAIL_MAKE_PIX_TYPE(PL, SIGNED, X32)
135 #define VPI_PIXEL_TYPE_2S32 VPI_DETAIL_MAKE_PIX_TYPE(PL, SIGNED, X32_Y32)
137 #define VPI_PIXEL_TYPE_3S32 VPI_DETAIL_MAKE_PIX_TYPE(PL, SIGNED, X32_Y32_Z32)
139 #define VPI_PIXEL_TYPE_4S32 VPI_DETAIL_MAKE_PIX_TYPE(PL, SIGNED, X32_Y32_Z32_W32)
140 
142 #define VPI_PIXEL_TYPE_F32 VPI_DETAIL_MAKE_PIX_TYPE(PL, FLOAT, X32)
144 #define VPI_PIXEL_TYPE_2F32 VPI_DETAIL_MAKE_PIX_TYPE(PL, FLOAT, X32_Y32)
146 #define VPI_PIXEL_TYPE_3F32 VPI_DETAIL_MAKE_PIX_TYPE(PL, FLOAT, X32_Y32_Z32)
148 #define VPI_PIXEL_TYPE_4F32 VPI_DETAIL_MAKE_PIX_TYPE(PL, FLOAT, X32_Y32_Z32_W32)
149 
151 #define VPI_PIXEL_TYPE_U64 VPI_DETAIL_MAKE_PIX_TYPE(PL, UNSIGNED, X64)
153 #define VPI_PIXEL_TYPE_2U64 VPI_DETAIL_MAKE_PIX_TYPE(PL, UNSIGNED, X64_Y64)
155 #define VPI_PIXEL_TYPE_3U64 VPI_DETAIL_MAKE_PIX_TYPE(PL, UNSIGNED, X64_Y64_Z64)
157 #define VPI_PIXEL_TYPE_4U64 VPI_DETAIL_MAKE_PIX_TYPE(PL, UNSIGNED, X64_Y64_Z64_W64)
158 
160 #define VPI_PIXEL_TYPE_S64 VPI_DETAIL_MAKE_PIX_TYPE(PL, SIGNED, X64)
162 #define VPI_PIXEL_TYPE_2S64 VPI_DETAIL_MAKE_PIX_TYPE(PL, SIGNED, X64_Y64)
164 #define VPI_PIXEL_TYPE_3S64 VPI_DETAIL_MAKE_PIX_TYPE(PL, SIGNED, X64_Y64_Z64)
166 #define VPI_PIXEL_TYPE_4S64 VPI_DETAIL_MAKE_PIX_TYPE(PL, SIGNED, X64_Y64_Z64_W64)
167 
169 #define VPI_PIXEL_TYPE_F64 VPI_DETAIL_MAKE_PIX_TYPE(PL, FLOAT, X64)
171 #define VPI_PIXEL_TYPE_2F64 VPI_DETAIL_MAKE_PIX_TYPE(PL, FLOAT, X64_Y64)
173 #define VPI_PIXEL_TYPE_3F64 VPI_DETAIL_MAKE_PIX_TYPE(PL, FLOAT, X64_Y64_Z64)
175 #define VPI_PIXEL_TYPE_4F64 VPI_DETAIL_MAKE_PIX_TYPE(PL, FLOAT, X64_Y64_Z64_W64)
176 
177 /* clang-format on */
178 
193 #ifdef VPI_DOXYGEN
194 # define VPI_MAKE_PIXEL_TYPE_ABBREV(memLayout, dataType, packing)
195 #else
196 # define VPI_MAKE_PIXEL_TYPE_ABBREV (VPIPixelType) VPI_DETAIL_MAKE_PIX_TYPE
197 #endif
198 
212 #ifdef VPI_DOXYGEN
213 # define VPI_MAKE_PIXEL_TYPE(memLayout, dataType, packing)
214 #else
215 # define VPI_MAKE_PIXEL_TYPE (VPIPixelType) VPI_DETAIL_MAKE_PIXEL_TYPE
216 #endif
217 
236 VPI_PUBLIC VPIPixelType vpiMakePixelType(VPIMemLayout memLayout, VPIDataType dataType, VPIPacking packing);
237 
248 
259 
268 VPI_PUBLIC void vpiPixelTypeGetBitsPerChannel(VPIPixelType type, int32_t *bits);
269 
280 
291 
305 
316 
325 VPI_PUBLIC const char *vpiPixelTypeGetName(VPIPixelType type);
326 
361 
364 #ifdef __cplusplus
365 }
366 #endif
367 
368 #endif /* NV_VPI_PIXEL_TYPE_H */
Defines types and functions to handle data layouts.
VPIMemLayout vpiPixelTypeGetMemLayout(VPIPixelType type)
Get the memory layout of a pixel type.
VPIPixelType vpiMakePixelType(VPIMemLayout memLayout, VPIDataType dataType, VPIPacking packing)
Creates a user-defined pixel type.
VPIPixelType vpiPixelTypeSetMemLayout(VPIPixelType type, VPIMemLayout layout)
Set the memory layout of a pixel type.
VPIPacking vpiPixelTypeGetPacking(VPIPixelType type)
Get the packing of a pixel type.
int vpiPixelTypeGetChannelCount(VPIPixelType type)
Get the number of channels of a pixel type.
VPIDataType vpiPixelTypeGetDataType(VPIPixelType type)
Get the data type of a pixel type.
int vpiPixelTypeGetBitsPerPixel(VPIPixelType type)
Get the number of bits per pixel of a pixel type.
void vpiPixelTypeGetBitsPerChannel(VPIPixelType type, int32_t *bits)
Get the number of bits per channel of a pixel type.
const char * vpiPixelTypeGetName(VPIPixelType type)
Returns a string representation of the pixel type.
VPIPixelType vpiPixelTypeGetChannelType(VPIPixelType type, int channel)
Get the pixel type for a given channel index.
VPIPacking
Defines how channels are packed into an image plane element.
Definition: DataLayout.h:133
VPIMemLayout
Defines how the 2D plane pixels are laid out in memory.
Definition: DataLayout.h:283
VPIDataType
Defines the channel data type.
Definition: DataLayout.h:265
uint64_t VPIPixelType
Pre-defined pixel types.
Definition: PixelType.h:78