48 #define VXLIB_BOX_NUMERIC_MIN(x) std::numeric_limits<x>::min()
49 #define VXLIB_BOX_NUMERIC_MAX(x) std::numeric_limits<x>::max()
57 template <
typename dTypeIn,
typename dTypeOut>
64 printf(
"Enter VXLIB_box_exec_cn\n");
71 size_t width = pKerPrivArgs->
width;
72 size_t height = pKerPrivArgs->
height;
80 bool isNotPadded = (padLeft == 0) && (padRight == 0) && (padTop == 0) && (padBottom == 0);
85 dTypeIn *restrict pInLocal = (dTypeIn *) pIn;
86 dTypeOut *restrict pOutLocal = (dTypeOut *) pOut;
89 printf(
"In VXLIB_box_exec_cn, width: %d, height: %d\n", width, height);
97 int32_t outWidth = (width - filterDim + 1);
98 int32_t outHeight = (height - filterDim + 1);
99 float spCoeff = 1.0 / (filterDim * filterDim);
101 int32_t
Q_FACTOR = (int32_t)(1u << (uint32_t)Q_BIT);
102 int16_t fixedCoeff = spCoeff *
Q_FACTOR;
104 for (y = 0; y < outHeight; y++) {
105 for (x = 0; x < outWidth; x++) {
109 for (j = 0; j < filterDim; j++) {
110 for (i = 0; i < filterDim; i++) {
112 sum += (pInLocal[(y + j) * strideInElements + (x + i)]) * fixedCoeff;
116 pOutLocal[y * strideOutElements + x] = (dTypeOut)((uint32_t)sum >> (uint32_t)Q_BIT);
template VXLIB_STATUS VXLIB_box_exec_cn< VXLIB_BOX_TYPENAME_I8U_O8U >(VXLIB_kernelHandle handle, void *restrict pIn, void *restrict pOut)
VXLIB_STATUS VXLIB_box_exec_cn(VXLIB_kernelHandle handle, void *restrict pIn, void *restrict pOut)
This function is the main execution function for the natural C implementation of the kernel....
Header file for kernel's internal use. For the kernel's interface, please see VXLIB_box.
void * VXLIB_kernelHandle
Handle type for VXLIB operations.
VXLIB_STATUS_NAME
The enumeration of all status codes.
@ VXLIB_ERR_NOT_IMPLEMENTED
int8_t filterSize
Width and height of filter
int32_t padLeft
Padding options
Structure that is reserved for internal use by the kernel.
size_t strideOutElements
Stride of output in elements.
size_t height
Height of image
VXLIB_box_InitArgs pKerInitArgs
Initargs of the kernel.
size_t strideInElements
Stride of input in elements.
size_t width
Width of image