/home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-rocal/checkouts/latest/rocAL/include/api/rocal_api_types.h Source File

/home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-rocal/checkouts/latest/rocAL/include/api/rocal_api_types.h Source File#

rocAL: /home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-rocal/checkouts/latest/rocAL/include/api/rocal_api_types.h Source File
rocal_api_types.h
Go to the documentation of this file.
1 /*
2 Copyright (c) 2019 - 2023 Advanced Micro Devices, Inc. All rights reserved.
3 
4 Permission is hereby granted, free of charge, to any person obtaining a copy
5 of this software and associated documentation files (the "Software"), to deal
6 in the Software without restriction, including without limitation the rights
7 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 copies of the Software, and to permit persons to whom the Software is
9 furnished to do so, subject to the following conditions:
10 
11 The above copyright notice and this permission notice shall be included in
12 all copies or substantial portions of the Software.
13 
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 THE SOFTWARE.
21 */
22 
23 #ifndef MIVISIONX_ROCAL_API_TYPES_H
24 #define MIVISIONX_ROCAL_API_TYPES_H
25 
26 #include <cstdlib>
27 
28 #ifndef ROCAL_API_CALL
29 #if defined(_WIN32)
30 #define ROCAL_API_CALL __stdcall
31 #else
35 #define ROCAL_API_CALL
36 #endif
37 #endif
38 
47 #include <half/half.hpp>
48 using half_float::half;
49 
53 typedef void* RocalFloatParam;
54 
58 typedef void* RocalIntParam;
59 
63 typedef void* RocalContext;
64 
69 typedef std::vector<int> ImageIDBatch, AnnotationIDBatch;
70 typedef std::vector<std::string> ImagePathBatch;
71 typedef std::vector<float> ScoreBatch, RotationBatch;
72 typedef std::vector<std::vector<float>> CenterBatch, ScaleBatch;
73 typedef std::vector<std::vector<std::vector<float>>> JointsBatch, JointsVisibilityBatch;
75 
79 struct TimingInfo {
80  long long unsigned load_time;
81  long long unsigned decode_time;
82  long long unsigned process_time;
83  long long unsigned transfer_time;
84 };
85 
86 // HRNet training expects meta data (joints_data) in below format, so added here as a type for exposing to user
91  ImageIDBatch image_id_batch;
92  AnnotationIDBatch annotation_id_batch;
93  ImagePathBatch image_path_batch;
94  CenterBatch center_batch;
95  ScaleBatch scale_batch;
96  JointsBatch joints_batch;
97  JointsVisibilityBatch joints_visibility_batch;
98  ScoreBatch score_batch;
99  RotationBatch rotation_batch;
100 };
101 
102 struct ROIxywh {
103  unsigned x;
104  unsigned y;
105  unsigned w;
106  unsigned h;
107 };
108 
115  ROCAL_OK = 0,
128 };
129 
146 };
147 
158 };
159 
170 };
171 
187  ROCAL_USE_USER_GIVEN_SIZE_RESTRICTED = 3, // use the given size only if the actual decoded size is greater than the given size
190  ROCAL_USE_MAX_SIZE_RESTRICTED = 4, // use max size if the actual decoded size is greater than max
191 };
192 
202  ROCAL_SW_DECODE = 1
203 };
204 
223  ROCAL_NONE = 4 // Layout for generic tensors (Non-Image or Non-Video)
224 };
225 
241  ROCAL_INT8 = 3
242 };
243 
267 };
268 
279 };
280 
281 // rocal external memcpy flags
285 #define ROCAL_MEMCPY_TO_HOST 1 // force copy to user provided host memory
289 #define ROCAL_MEMCPY_TO_DEVICE 2 // force copy to user provided device memory (gpu)
293 #define ROCAL_MEMCPY_IS_PINNED 4 // for future use
294 
314 };
315 
320 {
339 };
340 
350  ROCAL_GPU = 1
351 };
352 
356 enum class RocalROICordsType {
359  ROCAL_LTRB = 0,
362  ROCAL_XYWH = 1
363 };
364 
378 };
379 
380 #endif // MIVISIONX_ROCAL_API_TYPES_H
std::vector< float > RotationBatch
typedef std::vectors
Definition: rocal_api_types.h:71
std::vector< int > AnnotationIDBatch
typedef std::vectors
Definition: rocal_api_types.h:69
RocalDecoderType
rocAL Decoder Type enum
Definition: rocal_api_types.h:247
RocalResizeScalingMode
rocAL Resize Scaling Mode enum
Definition: rocal_api_types.h:298
RocalTensorLayout
rocAL Tensor Layout enum
Definition: rocal_api_types.h:208
RocalStatus
rocAL Status enum
Definition: rocal_api_types.h:112
RocalTensorOutputType
rocAL Tensor Output Type enum
Definition: rocal_api_types.h:229
std::vector< std::string > ImagePathBatch
typedef std::vectors
Definition: rocal_api_types.h:70
RocalTensorBackend
Tensor Backend.
Definition: rocal_api_types.h:344
void * RocalIntParam
typedef void* rocAL Int Param
Definition: rocal_api_types.h:58
RocalImageSizeEvaluationPolicy
rocAL Image Size Evaluation Policy enum
Definition: rocal_api_types.h:175
std::vector< int > ImageIDBatch
typedef std::vectors
Definition: rocal_api_types.h:69
RocalExternalSourceMode
RocalExternalSourceMode struct.
Definition: rocal_api_types.h:368
std::vector< std::vector< float > > CenterBatch
typedef std::vectors
Definition: rocal_api_types.h:72
std::vector< float > ScoreBatch
typedef std::vectors
Definition: rocal_api_types.h:71
std::vector< std::vector< float > > ScaleBatch
typedef std::vectors
Definition: rocal_api_types.h:72
RocalProcessMode
rocAL Process Mode enum
Definition: rocal_api_types.h:151
RocalFlipAxis
rocAL Flip Axis enum
Definition: rocal_api_types.h:163
RocalDecodeDevice
rocAL Decode Device enum
Definition: rocal_api_types.h:196
std::vector< std::vector< std::vector< float > > > JointsVisibilityBatch
typedef std::vectors
Definition: rocal_api_types.h:73
void * RocalFloatParam
typedef void* Float Param
Definition: rocal_api_types.h:53
void * RocalContext
typedef void* rocAL Context
Definition: rocal_api_types.h:63
RocalROICordsType
Tensor ROI type.
Definition: rocal_api_types.h:356
RocalResizeInterpolationType
rocAL Resize Interpolation Type enum
Definition: rocal_api_types.h:320
RocalImageColor
rocAL Image Color enum
Definition: rocal_api_types.h:133
std::vector< std::vector< std::vector< float > > > JointsBatch
typedef std::vectors
Definition: rocal_api_types.h:73
@ ROCAL_DECODER_AUDIO_GENERIC
AMD ROCAL_DECODER_AUDIO_GENERIC Uses SndFile library to read audio files.
Definition: rocal_api_types.h:266
@ ROCAL_DECODER_OPENCV
AMD ROCAL_DECODER_OPENCV.
Definition: rocal_api_types.h:253
@ ROCAL_DECODER_VIDEO_FFMPEG_HW
AMD ROCAL_DECODER_VIDEO_FFMPEG_HW.
Definition: rocal_api_types.h:262
@ ROCAL_DECODER_VIDEO_FFMPEG_SW
AMD ROCAL_DECODER_VIDEO_FFMPEG_SW.
Definition: rocal_api_types.h:259
@ ROCAL_DECODER_TJPEG
AMD ROCAL_DECODER_TJPEG.
Definition: rocal_api_types.h:250
@ ROCAL_DECODER_HW_JPEG
AMD ROCAL_DECODER_HW_JPEG.
Definition: rocal_api_types.h:256
@ ROCAL_SCALING_MODE_NOT_SMALLER
scales wrt to aspect ratio, so that resize width/height is not lesser than the specified size
Definition: rocal_api_types.h:307
@ ROCAL_SCALING_MODE_NOT_LARGER
scales wrt to aspect ratio, so that resize width/height does not exceed specified size
Definition: rocal_api_types.h:310
@ ROCAL_SCALING_MODE_STRETCH
scales wrt specified size, if only resize width/height is provided the other dimension is not scaled
Definition: rocal_api_types.h:304
@ ROCAL_SCALING_MODE_MIN_MAX
scales wrt to aspect ratio, so that resize width/height does not exceed specified min and max size
Definition: rocal_api_types.h:313
@ ROCAL_SCALING_MODE_DEFAULT
scales wrt specified size, if only resize width/height is provided the other dimension is scaled acco...
Definition: rocal_api_types.h:301
@ ROCAL_NCHW
AMD ROCAL_NCHW.
Definition: rocal_api_types.h:214
@ ROCAL_NHWC
AMD ROCAL_NHWC.
Definition: rocal_api_types.h:211
@ ROCAL_NFCHW
AMD ROCAL_NFCHW.
Definition: rocal_api_types.h:220
@ ROCAL_NFHWC
AMD ROCAL_NFHWc.
Definition: rocal_api_types.h:217
@ ROCAL_NONE
AMD ROCAL_NONE.
Definition: rocal_api_types.h:223
@ ROCAL_UPDATE_PARAMETER_FAILED
AMD ROCAL_UPDATE_PARAMETER_FAILED.
Definition: rocal_api_types.h:124
@ ROCAL_OK
AMD ROCAL_OK.
Definition: rocal_api_types.h:115
@ ROCAL_CONTEXT_INVALID
AMD ROCAL_CONTEXT_INVALID.
Definition: rocal_api_types.h:118
@ ROCAL_RUNTIME_ERROR
AMD ROCAL_RUNTIME_ERROR.
Definition: rocal_api_types.h:121
@ ROCAL_INVALID_PARAMETER_TYPE
AMD ROCAL_INVALID_PARAMETER_TYPE.
Definition: rocal_api_types.h:127
@ ROCAL_INT8
AMD ROCAL_INT8.
Definition: rocal_api_types.h:241
@ ROCAL_FP32
AMD ROCAL_FP32.
Definition: rocal_api_types.h:232
@ ROCAL_UINT8
AMD ROCAL_UINT8.
Definition: rocal_api_types.h:238
@ ROCAL_FP16
AMD ROCAL_FP16.
Definition: rocal_api_types.h:235
@ ROCAL_GPU
ROCAL_GPU.
Definition: rocal_api_types.h:350
@ ROCAL_CPU
ROCAL_CPU.
Definition: rocal_api_types.h:347
@ ROCAL_USE_MOST_FREQUENT_SIZE
AMD ROCAL_USE_MOST_FREQUENT_SIZE.
Definition: rocal_api_types.h:184
@ ROCAL_USE_MAX_SIZE
AMD ROCAL_USE_MAX_SIZE.
Definition: rocal_api_types.h:178
@ ROCAL_USE_MAX_SIZE_RESTRICTED
Use max size if the actual decoded size is greater than max.
Definition: rocal_api_types.h:190
@ ROCAL_USE_USER_GIVEN_SIZE
AMD ROCAL_USE_USER_GIVEN_SIZE.
Definition: rocal_api_types.h:181
@ ROCAL_USE_USER_GIVEN_SIZE_RESTRICTED
Use the given size only if the actual decoded size is greater than the given size.
Definition: rocal_api_types.h:187
@ ROCAL_EXTSOURCE_RAW_COMPRESSED
compressed raw buffer passed as input
Definition: rocal_api_types.h:374
@ ROCAL_EXTSOURCE_FNAME
list of filename passed as input
Definition: rocal_api_types.h:371
@ ROCAL_EXTSOURCE_RAW_UNCOMPRESSED
uncompressed raw buffer passed as input
Definition: rocal_api_types.h:377
@ ROCAL_PROCESS_CPU
AMD ROCAL_PROCESS_CPU.
Definition: rocal_api_types.h:157
@ ROCAL_PROCESS_GPU
AMD ROCAL_PROCESS_GPU.
Definition: rocal_api_types.h:154
@ ROCAL_FLIP_HORIZONTAL
AMD ROCAL_FLIP_HORIZONTAL.
Definition: rocal_api_types.h:166
@ ROCAL_FLIP_VERTICAL
AMD ROCAL_FLIP_VERTICAL.
Definition: rocal_api_types.h:169
@ ROCAL_SW_DECODE
AMD ROCAL_SW_DECODE.
Definition: rocal_api_types.h:202
@ ROCAL_HW_DECODE
AMD ROCAL_HW_DECODE.
Definition: rocal_api_types.h:199
@ ROCAL_XYWH
ROCAL_XYWH.
@ ROCAL_LTRB
ROCAL_LTRB.
@ ROCAL_CUBIC_INTERPOLATION
AMD ROCAL_CUBIC_INTERPOLATION.
Definition: rocal_api_types.h:329
@ ROCAL_NEAREST_NEIGHBOR_INTERPOLATION
AMD ROCAL_NEAREST_NEIGHBOR_INTERPOLATION.
Definition: rocal_api_types.h:323
@ ROCAL_GAUSSIAN_INTERPOLATION
AMD ROCAL_GAUSSIAN_INTERPOLATION.
Definition: rocal_api_types.h:335
@ ROCAL_LINEAR_INTERPOLATION
AMD ROCAL_LINEAR_INTERPOLATION.
Definition: rocal_api_types.h:326
@ ROCAL_TRIANGULAR_INTERPOLATION
AMD ROCAL_TRIANGULAR_INTERPOLATION.
Definition: rocal_api_types.h:338
@ ROCAL_LANCZOS_INTERPOLATION
AMD ROCAL_LANCZOS_INTERPOLATION.
Definition: rocal_api_types.h:332
@ ROCAL_COLOR_U8
AMD ROCAL_COLOR_U8.
Definition: rocal_api_types.h:142
@ ROCAL_COLOR_RGB24
AMD ROCAL_COLOR_RGB24.
Definition: rocal_api_types.h:136
@ ROCAL_COLOR_RGB_PLANAR
AMD ROCAL_COLOR_RGB_PLANAR.
Definition: rocal_api_types.h:145
@ ROCAL_COLOR_BGR24
AMD ROCAL_COLOR_BGR24.
Definition: rocal_api_types.h:139
RocalOutputMemType
Definition: rocal_api_types.h:269
@ ROCAL_MEMCPY_GPU
AMD ROCAL_MEMCPY_GPU.
Definition: rocal_api_types.h:275
@ ROCAL_MEMCPY_HOST
AMD ROCAL_MEMCPY_HOST.
Definition: rocal_api_types.h:272
@ ROCAL_MEMCPY_PINNED
AMD ROCAL_MEMCPY_PINNED.
Definition: rocal_api_types.h:278
Definition: rocal_api_types.h:102
rocAL Joints Data struct - HRNet training expects meta data (joints_data) in below format,...
Definition: rocal_api_types.h:90
Timing Info struct.
Definition: rocal_api_types.h:79