/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 
234  ROCAL_NONE = 7 // Layout for generic tensors (Non-Image or Non-Video)
235 };
236 
258  ROCAL_INT32 = 5
259 };
260 
284 };
285 
296 };
297 
298 // rocal external memcpy flags
302 #define ROCAL_MEMCPY_TO_HOST 1 // force copy to user provided host memory
306 #define ROCAL_MEMCPY_TO_DEVICE 2 // force copy to user provided device memory (gpu)
310 #define ROCAL_MEMCPY_IS_PINNED 4 // for future use
311 
331 };
332 
337 {
356 };
357 
367  ROCAL_GPU = 1
368 };
369 
373 enum class RocalROICordsType {
376  ROCAL_LTRB = 0,
379  ROCAL_XYWH = 1
380 };
381 
395 };
396 
409  ROCAL_REFLECT = 2
410 };
411 
425 };
426 
439 };
440 
454 };
455 
460  RocalLastBatchPolicy last_batch_policy;
461  bool pad_last_batch_repeated;
462  bool stick_to_shard;
463  int32_t shard_size;
464 
465  // Constructor with default values
467  : last_batch_policy(RocalLastBatchPolicy::ROCAL_LAST_BATCH_FILL),
468  pad_last_batch_repeated(false),
469  stick_to_shard(true),
470  shard_size(-1)
471  {}
472 };
473 
474 #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:264
RocalResizeScalingMode
rocAL Resize Scaling Mode enum
Definition: rocal_api_types.h:315
RocalTensorLayout
rocAL Tensor Layout enum
Definition: rocal_api_types.h:208
RocalMelScaleFormula
rocAL MelScale formula enum
Definition: rocal_api_types.h:430
RocalStatus
rocAL Status enum
Definition: rocal_api_types.h:112
RocalTensorOutputType
rocAL Tensor Output Type enum
Definition: rocal_api_types.h:240
std::vector< std::string > ImagePathBatch
typedef std::vectors
Definition: rocal_api_types.h:70
RocalTensorBackend
Tensor Backend.
Definition: rocal_api_types.h:361
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:385
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
RocalOutOfBoundsPolicy
rocAL Out Of Bounds Policy Type enum
Definition: rocal_api_types.h:415
RocalFlipAxis
rocAL Flip Axis enum
Definition: rocal_api_types.h:163
RocalDecodeDevice
rocAL Decode Device enum
Definition: rocal_api_types.h:196
RocalAudioBorderType
rocAL Audio Border Type enum
Definition: rocal_api_types.h:400
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:373
RocalLastBatchPolicy
Tensor Last Batch Policy Type enum.
Definition: rocal_api_types.h:444
RocalResizeInterpolationType
rocAL Resize Interpolation Type enum
Definition: rocal_api_types.h:337
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:283
@ ROCAL_DECODER_OPENCV
AMD ROCAL_DECODER_OPENCV.
Definition: rocal_api_types.h:270
@ ROCAL_DECODER_VIDEO_FFMPEG_HW
AMD ROCAL_DECODER_VIDEO_FFMPEG_HW.
Definition: rocal_api_types.h:279
@ ROCAL_DECODER_VIDEO_FFMPEG_SW
AMD ROCAL_DECODER_VIDEO_FFMPEG_SW.
Definition: rocal_api_types.h:276
@ ROCAL_DECODER_TJPEG
AMD ROCAL_DECODER_TJPEG.
Definition: rocal_api_types.h:267
@ ROCAL_DECODER_HW_JPEG
AMD ROCAL_DECODER_HW_JPEG.
Definition: rocal_api_types.h:273
@ 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:324
@ 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:327
@ 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:321
@ 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:330
@ 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:318
@ ROCAL_NCHW
AMD ROCAL_NCHW.
Definition: rocal_api_types.h:214
@ ROCAL_NHWC
AMD ROCAL_NHWC.
Definition: rocal_api_types.h:211
@ ROCAL_NHW
AMD ROCAL_NHW.
Definition: rocal_api_types.h:223
@ ROCAL_NTF
AMD ROCAL_NTF Spectrogram Layout TF.
Definition: rocal_api_types.h:231
@ 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:234
@ ROCAL_NFT
AMD ROCAL_NFT Spectrogram Layout FT.
Definition: rocal_api_types.h:227
@ ROCAL_MELSCALE_SLANEY
Slaney Follows Slaney’s MATLAB Auditory Modelling Work behavior.
Definition: rocal_api_types.h:434
@ ROCAL_MELSCALE_HTK
HTK Follows O’Shaughnessy’s book formula, consistent with Hidden Markov Toolkit(HTK),...
Definition: rocal_api_types.h:438
@ 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:252
@ ROCAL_FP32
AMD ROCAL_FP32.
Definition: rocal_api_types.h:243
@ ROCAL_INT32
AMD ROCAL_INT32.
Definition: rocal_api_types.h:258
@ ROCAL_UINT8
AMD ROCAL_UINT8.
Definition: rocal_api_types.h:249
@ ROCAL_UINT32
AMD ROCAL_UINT32.
Definition: rocal_api_types.h:255
@ ROCAL_FP16
AMD ROCAL_FP16.
Definition: rocal_api_types.h:246
@ ROCAL_GPU
ROCAL_GPU.
Definition: rocal_api_types.h:367
@ ROCAL_CPU
ROCAL_CPU.
Definition: rocal_api_types.h:364
@ 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:391
@ ROCAL_EXTSOURCE_FNAME
list of filename passed as input
Definition: rocal_api_types.h:388
@ ROCAL_EXTSOURCE_RAW_UNCOMPRESSED
uncompressed raw buffer passed as input
Definition: rocal_api_types.h:394
@ 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_ERROR
Error.
Definition: rocal_api_types.h:424
@ ROCAL_PAD
Pad.
Definition: rocal_api_types.h:418
@ ROCAL_TRIMTOSHAPE
Trimtoshape.
Definition: rocal_api_types.h:421
@ 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_ZERO
AMD ROCAL_ZERO.
Definition: rocal_api_types.h:403
@ ROCAL_CLAMP
AMD ROCAL_CLAMP.
Definition: rocal_api_types.h:406
@ ROCAL_REFLECT
AMD ROCAL_REFLECT.
Definition: rocal_api_types.h:409
@ ROCAL_XYWH
ROCAL_XYWH.
@ ROCAL_LTRB
ROCAL_LTRB.
@ ROCAL_LAST_BATCH_DROP
ROCAL_LAST_BATCH_DROP - The last batch is dropped if there are not enough samples from the current ep...
Definition: rocal_api_types.h:450
@ ROCAL_LAST_BATCH_PARTIAL
ROCAL_LAST_BATCH_PARTIAL - The last batch is partially filled with the remaining data from the curren...
Definition: rocal_api_types.h:453
@ ROCAL_LAST_BATCH_FILL
ROCAL_LAST_BATCH_FILL - The last batch is filled by either repeating the last sample or by wrapping u...
Definition: rocal_api_types.h:447
@ ROCAL_CUBIC_INTERPOLATION
AMD ROCAL_CUBIC_INTERPOLATION.
Definition: rocal_api_types.h:346
@ ROCAL_NEAREST_NEIGHBOR_INTERPOLATION
AMD ROCAL_NEAREST_NEIGHBOR_INTERPOLATION.
Definition: rocal_api_types.h:340
@ ROCAL_GAUSSIAN_INTERPOLATION
AMD ROCAL_GAUSSIAN_INTERPOLATION.
Definition: rocal_api_types.h:352
@ ROCAL_LINEAR_INTERPOLATION
AMD ROCAL_LINEAR_INTERPOLATION.
Definition: rocal_api_types.h:343
@ ROCAL_TRIANGULAR_INTERPOLATION
AMD ROCAL_TRIANGULAR_INTERPOLATION.
Definition: rocal_api_types.h:355
@ ROCAL_LANCZOS_INTERPOLATION
AMD ROCAL_LANCZOS_INTERPOLATION.
Definition: rocal_api_types.h:349
@ 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:286
@ ROCAL_MEMCPY_GPU
AMD ROCAL_MEMCPY_GPU.
Definition: rocal_api_types.h:292
@ ROCAL_MEMCPY_HOST
AMD ROCAL_MEMCPY_HOST.
Definition: rocal_api_types.h:289
@ ROCAL_MEMCPY_PINNED
AMD ROCAL_MEMCPY_PINNED.
Definition: rocal_api_types.h:295
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
rocAL RocalShardingInfo enum
Definition: rocal_api_types.h:459
Timing Info struct.
Definition: rocal_api_types.h:79