24 #ifndef ARM_COMPUTE_HELPER_H 25 #define ARM_COMPUTE_HELPER_H 27 #pragma OPENCL EXTENSION cl_khr_fp16 : enable 29 #define CLAMP(x, min_val, max_val) min(max(x, min_val), max_val) 31 #define VEC_DATA_TYPE_STR(type, size) type##size 32 #define VEC_DATA_TYPE(type, size) VEC_DATA_TYPE_STR(type, size) 34 #define CONVERT_STR(x, type) (convert_##type((x))) 35 #define CONVERT(x, type) CONVERT_STR(x, type) 37 #define CONVERT_SAT_STR(x, type) (convert_##type##_sat((x))) 38 #define CONVERT_SAT(x, type) CONVERT_SAT_STR(x, type) 40 #define CONVERT_SAT_ROUND_STR(x, type, round) (convert_##type##_sat_##round((x))) 41 #define CONVERT_SAT_ROUND(x, type, round) CONVERT_SAT_ROUND_STR(x, type, round) 43 #define VECTOR_DECLARATION(name) \ 44 __global uchar *name##_ptr, \ 45 uint name##_stride_x, \ 47 uint name##_offset_first_element_in_bytes 49 #define IMAGE_DECLARATION(name) \ 50 __global uchar *name##_ptr, \ 51 uint name##_stride_x, \ 53 uint name##_stride_y, \ 55 uint name##_offset_first_element_in_bytes 57 #define TENSOR3D_DECLARATION(name) \ 58 __global uchar *name##_ptr, \ 59 uint name##_stride_x, \ 61 uint name##_stride_y, \ 63 uint name##_stride_z, \ 65 uint name##_offset_first_element_in_bytes 67 #define CONVERT_TO_VECTOR_STRUCT(name) \ 68 update_vector_workitem_ptr(name##_ptr, name##_offset_first_element_in_bytes, name##_stride_x, name##_step_x) 70 #define CONVERT_TO_VECTOR_STRUCT_NO_STEP(name) \ 71 update_vector_workitem_ptr(name##_ptr, name##_offset_first_element_in_bytes, name##_stride_x, 0) 73 #define CONVERT_TO_IMAGE_STRUCT(name) \ 74 update_image_workitem_ptr(name##_ptr, name##_offset_first_element_in_bytes, name##_stride_x, name##_step_x, name##_stride_y, name##_step_y) 76 #define CONVERT_TO_IMAGE_STRUCT_NO_STEP(name) \ 77 update_image_workitem_ptr(name##_ptr, name##_offset_first_element_in_bytes, name##_stride_x, 0, name##_stride_y, 0) 79 #define CONVERT_TO_TENSOR3D_STRUCT(name) \ 80 update_tensor3D_workitem_ptr(name##_ptr, name##_offset_first_element_in_bytes, name##_stride_x, name##_step_x, name##_stride_y, name##_step_y, \ 81 name##_stride_z, name##_step_z) 83 #define CONVERT_TO_TENSOR3D_STRUCT_NO_STEP(name) \ 84 update_tensor3D_workitem_ptr(name##_ptr, name##_offset_first_element_in_bytes, name##_stride_x, 0, name##_stride_y, 0, name##_stride_z, 0) 178 .stride_y = stride_y,
Structure to hold Vector information.
Vector update_vector_workitem_ptr(__global uchar *ptr, uint offset_first_element_in_bytes, uint stride_x, uint step_x)
Wrap vector information into an Vector structure, and make the pointer point at this workitem's data...
int stride_z
Stride of the image in Z dimension (in bytes)
int stride_x
Stride of the image in X dimension (in bytes)
int offset_first_element_in_bytes
The offset of the first element in the source image.
Structure to hold 3D tensor information.
__global uchar * offset(const Image *img, int x, int y)
Get the pointer position of a Image.
struct Tensor3D Tensor3D
Structure to hold 3D tensor information.
Tensor3D update_tensor3D_workitem_ptr(__global uchar *ptr, uint offset_first_element_in_bytes, uint stride_x, uint step_x, uint stride_y, uint step_y, uint stride_z, uint step_z)
Wrap 3D tensor information into an tensor structure, and make the pointer point at this workitem's da...
int stride_x
Stride of the image in X dimension (in bytes)
struct Image Image
Structure to hold Image information.
__global uchar * ptr
Pointer to the starting postion of the buffer.
__global const uchar * tensor3D_offset(const Tensor3D *tensor, int x, int y, int z)
Get the pointer position of a Tensor3D.
Image update_image_workitem_ptr(__global uchar *ptr, uint offset_first_element_in_bytes, uint stride_x, uint step_x, uint stride_y, uint step_y)
Wrap image information into an Image structure, and make the pointer point at this workitem's data...
Structure to hold Image information.
int offset_first_element_in_bytes
The offset of the first element in the source image.
__global uchar * ptr
Pointer to the starting postion of the buffer.
__global uchar * ptr
Pointer to the starting postion of the buffer.
struct Vector Vector
Structure to hold Vector information.
int stride_y
Stride of the image in Y dimension (in bytes)
__global const uchar * vector_offset(const Image *img, int x)
Get the pointer position of a Vector.
int offset_first_element_in_bytes
The offset of the first element in the source image.
int stride_y
Stride of the image in Y dimension (in bytes)
int stride_x
Stride of the image in X dimension (in bytes)