43 #include <x86intrin.h>
44 #include <smmintrin.h>
45 #include <immintrin.h>
50 #define RPP_MIN_8U ( 0 )
52 #define RPP_MAX_8U ( 255 )
54 #define RPPT_MAX_DIMS ( 5 )
56 #define RPPT_MAX_AUDIO_CHANNELS ( 16 )
58 #define CHECK_RETURN_STATUS(x) do { \
61 fprintf(stderr, "Runtime error: %s returned %d at %s:%d", #x, retval, __FILE__, __LINE__); \
67 #include <hip/hip_runtime.h>
68 #define RPP_HOST_DEVICE __host__ __device__
70 #define RPP_HOST_DEVICE
73 const float ONE_OVER_6 = 1.0f / 6;
74 const float ONE_OVER_3 = 1.0f / 3;
75 const float ONE_OVER_255 = 1.0f / 255;
76 const uint MMS_MAX_SCRATCH_MEMORY = 76800000;
165 rppStatusSuccess = 0,
166 rppStatusBadParm = -1,
167 rppStatusUnknownError = -2,
168 rppStatusNotInitialized = -3,
169 rppStatusInvalidValue = -4,
170 rppStatusAllocFailed = -5,
171 rppStatusInternalError = -6,
172 rppStatusNotImplemented = -7,
173 rppStatusUnsupportedOp = -8,
181 RPP_SCALAR_OP_AND = 1,
186 RPP_SCALAR_OP_NOTEQUAL,
188 RPP_SCALAR_OP_LESSEQ,
189 RPP_SCALAR_OP_GREATER,
190 RPP_SCALAR_OP_GREATEREQ,
192 RPP_SCALAR_OP_SUBTRACT,
193 RPP_SCALAR_OP_MULTIPLY,
194 RPP_SCALAR_OP_DIVIDE,
195 RPP_SCALAR_OP_MODULUS,
286 RPPI_HORIZONTAL_AXIS,
368 unsigned int roiWidth;
369 unsigned int roiHeight;
431 NEAREST_NEIGHBOR = 0,
492 int roiWidth, roiHeight;
502 int roiWidth, roiHeight, roiDepth;
625 float boxMullerExtra;
660 switch(interpolationType)
662 case RpptInterpolationType::BICUBIC:
667 case RpptInterpolationType::LANCZOS:
669 if(in_size > out_size)
671 this->radius = 3.0f * scaleRatio;
672 this->scale = (1 / scaleRatio);
678 case RpptInterpolationType::GAUSSIAN:
680 if(in_size > out_size)
682 this->radius = scaleRatio;
683 this->scale = (1 / scaleRatio);
687 case RpptInterpolationType::TRIANGULAR:
689 if(in_size > out_size)
691 this->radius = scaleRatio;
692 this->scale = (1 / scaleRatio);
703 this->size = std::ceil(2 * this->radius);
721 Rpp32f locRaw = x * scale + center;
722 Rpp32s locFloor = std::floor(locRaw);
723 Rpp32f weight = locRaw - locFloor;
724 locFloor = std::max(std::min(locFloor, lookupSize - 2), 0);
725 Rpp32f current = lookup[locFloor];
726 Rpp32f next = lookup[locFloor + 1];
727 return current + weight * (next - current);
730 inline __m128 operator()(__m128 x)
732 __m128 pLocRaw = _mm_add_ps(_mm_mul_ps(x, pScale), pCenter);
733 __m128i pxLocFloor = _mm_cvttps_epi32(pLocRaw);
734 __m128 pLocFloor = _mm_cvtepi32_ps(pxLocFloor);
735 __m128 pWeight = _mm_sub_ps(pLocRaw, pLocFloor);
737 _mm_storeu_si128(
reinterpret_cast<__m128i*
>(idx), pxLocFloor);
738 __m128 pCurrent = _mm_setr_ps(lookup[idx[0]], lookup[idx[1]], lookup[idx[2]], lookup[idx[3]]);
739 __m128 pNext = _mm_setr_ps(lookup[idx[0] + 1], lookup[idx[1] + 1], lookup[idx[2] + 1], lookup[idx[3] + 1]);
740 return _mm_add_ps(pCurrent, _mm_mul_ps(pWeight, _mm_sub_ps(pNext, pCurrent)));
743 Rpp32f scale = 1, center = 1;
744 Rpp32s lobes = 0, coeffs = 0;
746 Rpp32f *lookupPinned =
nullptr;
747 std::vector<Rpp32f> lookup;
748 __m128 pCenter, pScale;
849 Rpp32f *scratchBufferHost;
936 clmemSize maxSrcSize;
937 clmemSize maxDstSize;
939 clmemRpp32f floatArr[10];
940 clmemRpp64f doubleArr[10];
941 clmemRpp32u uintArr[10];
942 clmemRpp32s intArr[10];
943 clmemRpp8u ucharArr[10];
944 clmemRpp8s charArr[10];
945 cl_mem srcBatchIndex;
946 cl_mem dstBatchIndex;
960 #elif defined(HIP_COMPILE)
RppiPad
RPPI Image pad type enum.
Definition: rppdefs.h:308
RppiFormat
RPPI Image format type enum.
Definition: rppdefs.h:317
unsigned int Rpp32u
32 bit unsigned int
Definition: rppdefs.h:89
RppConvertBitDepthMode
RPP BitDepth Conversion type enum.
Definition: rppdefs.h:204
int Rpp32s
32 bit signed int
Definition: rppdefs.h:91
signed char Rpp8s
8 bit signed char
Definition: rppdefs.h:83
RppiChnFormat
RPPI Image channel format type enum.
Definition: rppdefs.h:276
RpptMelScaleFormula
RPPT Mel Scale Formula.
Definition: rppdefs.h:453
unsigned short Rpp16u
16 bit unsigned short
Definition: rppdefs.h:85
unsigned char Rpp8u
8 bit unsigned char
Definition: rppdefs.h:81
void * RppPtr_t
void pointer
Definition: rppdefs.h:101
RpptLayout
RPPT Tensor layout type enum.
Definition: rppdefs.h:389
RppiBlur
RPPI Image blur type enum.
Definition: rppdefs.h:295
RppiAxis
RPP Image axis type enum.
Definition: rppdefs.h:285
RpptRoiType
RPPT Tensor 2D ROI type enum.
Definition: rppdefs.h:403
RpptDataType
RPPT Tensor datatype enum.
Definition: rppdefs.h:378
struct RpptResamplingWindow RpptResamplingWindow
RPPT Tensor RpptResamplingWindow type struct.
double Rpp64f
64 bit double
Definition: rppdefs.h:99
RpptAudioBorderType
RPPT Audio Border Type.
Definition: rppdefs.h:443
size_t RppSize_t
size_t
Definition: rppdefs.h:103
struct GenericFilter GenericFilter
RPPT Tensor GenericFilter type struct.
RppStatus
RPP RppStatus type enums.
Definition: rppdefs.h:109
RpptRoi3DType
RPPT Tensor 3D ROI type enum.
Definition: rppdefs.h:412
RppOp
RPP Operations type enum.
Definition: rppdefs.h:180
unsigned long long Rpp64u
64 bit unsigned long long
Definition: rppdefs.h:93
#define RPPT_MAX_DIMS
RPP maximum dimensions in tensor .
Definition: rppdefs.h:54
RpptInterpolationType
RPPT Tensor interpolation type enum.
Definition: rppdefs.h:430
RpptSubpixelLayout
RPPT Tensor subpixel layout type enum.
Definition: rppdefs.h:421
short Rpp16s
16 bit signed short
Definition: rppdefs.h:87
RppiColorConvertMode
RPPI Image color convert mode type enum.
Definition: rppdefs.h:257
float Rpp32f
32 bit float
Definition: rppdefs.h:97
RppiFuzzyLevel
RPPI Image fuzzy level type enum.
Definition: rppdefs.h:266
long long Rpp64s
64 bit long long
Definition: rppdefs.h:95
rppStatus_t
RPP rppStatus_t type enums.
Definition: rppdefs.h:164
@ RPP_ERROR_NOT_IMPLEMENTED
Function variant requested is not implemented / unsupported.
Definition: rppdefs.h:123
@ RPP_ERROR_INVALID_DST_DATATYPE
Invalid dst tensor datatype. (Needs to adhere to function specification.)
Definition: rppdefs.h:135
@ RPP_ERROR_INVALID_OUTPUT_TILE_LENGTH
Invalid output tile length (Needs to adhere to function specification.)
Definition: rppdefs.h:151
@ RPP_ERROR_OUT_OF_BOUND_SRC_ROI
Out of bound source ROI.
Definition: rppdefs.h:145
@ RPP_ERROR_OUT_OF_BOUND_SHARED_MEMORY_SIZE
Shared memory size needed is beyond the bounds (Needs to adhere to function specification....
Definition: rppdefs.h:153
@ RPP_ERROR_ZERO_DIVISION
Arguments provided will result in zero division error.
Definition: rppdefs.h:119
@ RPP_ERROR_INVALID_ARGUMENTS
One or more arguments invalid. (Needs to adhere to function specification.)
Definition: rppdefs.h:115
@ RPP_ERROR_LAYOUT_MISMATCH
src and dst layout mismatch
Definition: rppdefs.h:147
@ RPP_ERROR_INVALID_CHANNELS
Number of channels is invalid. (Needs to adhere to function specification.)
Definition: rppdefs.h:149
@ RPP_ERROR_INVALID_SRC_CHANNELS
Invalid src tensor number of channels. (Needs to adhere to function specification....
Definition: rppdefs.h:125
@ RPP_ERROR_INVALID_SRC_OR_DST_DATATYPE
Invalid src/dst tensor datatype. (Needs to adhere to function specification.)
Definition: rppdefs.h:137
@ RPP_ERROR_INVALID_PARAMETER_DATATYPE
Invalid datatype.
Definition: rppdefs.h:141
@ RPP_ERROR_NOT_ENOUGH_MEMORY
Not enough memory to write outputs, as per dim-lengths and strides set in descriptor.
Definition: rppdefs.h:143
@ RPP_ERROR
Unspecified error.
Definition: rppdefs.h:113
@ RPP_ERROR_INVALID_SRC_DIMS
Number of src dims is invalid. (Needs to adhere to function specification.)
Definition: rppdefs.h:157
@ RPP_ERROR_OUT_OF_BOUND_SCRATCH_MEMORY_SIZE
Scratch memory size needed is beyond the bounds (Needs to adhere to function specification....
Definition: rppdefs.h:155
@ RPP_ERROR_INVALID_DST_LAYOUT
Invalid dst tensor layout. (Needs to adhere to function specification.)
Definition: rppdefs.h:131
@ RPP_ERROR_INVALID_DST_CHANNELS
Invalid dst tensor number of channels. (Needs to adhere to function specification....
Definition: rppdefs.h:127
@ RPP_ERROR_INVALID_SRC_DATATYPE
Invalid src tensor datatype. (Needs to adhere to function specification.)
Definition: rppdefs.h:133
@ RPP_ERROR_INVALID_SRC_LAYOUT
Invalid src tensor layout. (Needs to adhere to function specification.)
Definition: rppdefs.h:129
@ RPP_ERROR_HIGH_SRC_DIMENSION
Src tensor / src ROI dimension too high. (Needs to adhere to function specification....
Definition: rppdefs.h:121
@ RPP_SUCCESS
No error.
Definition: rppdefs.h:111
@ RPP_ERROR_INSUFFICIENT_DST_BUFFER_LENGTH
Insufficient dst buffer length provided. (Needs to adhere to function specification....
Definition: rppdefs.h:139
@ RPP_ERROR_LOW_OFFSET
Low tensor offsetInBytes provided for src/dst tensor.
Definition: rppdefs.h:117
RPPT Tensor GenericFilter type struct.
Definition: rppdefs.h:654
RPP initialize handle.
Definition: rppdefs.h:1096
RPP 24 float vector.
Definition: rppdefs.h:247
RPP 6 float vector.
Definition: rppdefs.h:231
RPP 24 signed int vector.
Definition: rppdefs.h:239
RPP layout params.
Definition: rppdefs.h:222
RPP polar point.
Definition: rppdefs.h:213
RPPI Image 3D point type struct.
Definition: rppdefs.h:344
RPPI Image 2D cartesian point type struct.
Definition: rppdefs.h:335
RPPI Image 2D ROI (XYWH format) type struct.
Definition: rppdefs.h:365
RPPI Image 2D Rectangle (XYWH format) type struct.
Definition: rppdefs.h:354
RPPI Image size(Width/Height dimensions) type struct.
Definition: rppdefs.h:326
RPPT Tensor 2D bilinear neighborhood 32-bit signed int 8-length-vectors type struct.
Definition: rppdefs.h:632
RPPT Tensor 2D bilinear neighborhood 32-bit float 8-length-vectors type struct.
Definition: rppdefs.h:643
RPPT Tensor Channel Offsets struct.
Definition: rppdefs.h:471
RPPT Tensor descriptor type struct.
Definition: rppdefs.h:541
RPPT Tensor 32-bit float RGB type struct.
Definition: rppdefs.h:577
RPPT Tensor 2D 32-bit float vector type struct.
Definition: rppdefs.h:596
RPPT Tensor Generic descriptor type struct.
Definition: rppdefs.h:554
RPPT Tensor 2D image patch dimensions type struct.
Definition: rppdefs.h:605
RPPT Tensor 8-bit uchar RGB type struct.
Definition: rppdefs.h:567
RPPT Tensor RpptResamplingWindow type struct.
Definition: rppdefs.h:711
RPPT Tensor 3D ROI LTFRBB struct.
Definition: rppdefs.h:481
RPPT Tensor 2D ROI LTRB struct.
Definition: rppdefs.h:462
RPPT Tensor 2D ROI XYWH struct.
Definition: rppdefs.h:490
RPPT Tensor 3D ROI XYZWHD struct.
Definition: rppdefs.h:500
RPPT Tensor strides type struct.
Definition: rppdefs.h:530
RPPT Tensor 2D 32-bit uint vector type struct.
Definition: rppdefs.h:587
RPPT Tensor random number generator state (xorwow box muller state) type struct.
Definition: rppdefs.h:622
RPPT Tensor random number generator state (xorwow state) type struct.
Definition: rppdefs.h:614
RPP HIP 2D ROI memory.
Definition: rppdefs.h:1033
RPP HIP 32-bit float memory.
Definition: rppdefs.h:968
RPP HIP 32-bit signed int memory.
Definition: rppdefs.h:992
RPP HIP 32-bit unsigned int memory.
Definition: rppdefs.h:984
RPP HIP 64-bit double memory.
Definition: rppdefs.h:976
RPP HIP 8-bit signed char memory.
Definition: rppdefs.h:1008
RPP HIP 8-bit unsigned char memory.
Definition: rppdefs.h:1000
RPP HIP RGB memory.
Definition: rppdefs.h:1016
RPP HIP 2D dimensions memory.
Definition: rppdefs.h:1024
RPP HOST memory type struct.
Definition: rppdefs.h:832
RPP OCL memory management type struct.
Definition: rppdefs.h:1044
RPP HIP-HOST memory management.
Definition: rppdefs.h:1075
RPP HOST 2D ROI memory.
Definition: rppdefs.h:822
RPP HOST 32-bit float memory.
Definition: rppdefs.h:757
RPP HOST 32-bit signed int memory.
Definition: rppdefs.h:781
RPP HOST 32-bit unsigned int memory.
Definition: rppdefs.h:773
RPP HOST 64-bit double memory.
Definition: rppdefs.h:765
RPP HOST 8-bit signed char memory.
Definition: rppdefs.h:797
RPP HOST 8-bit unsigned char memory.
Definition: rppdefs.h:789
RPP HOST RGB memory.
Definition: rppdefs.h:805
RPP HOST 2D dimensions memory.
Definition: rppdefs.h:813
RPPT Tensor 3D ROI union.
Definition: rppdefs.h:520
RPPT Tensor 2D ROI union.
Definition: rppdefs.h:510