41 #include "VXLIB_types.h"
49 #define VXLIB_CONVOLVE_NUMERIC_MIN(x) std::numeric_limits<x>::min()
50 #define VXLIB_CONVOLVE_NUMERIC_MAX(x) std::numeric_limits<x>::max()
59 template <
typename dTypeIn,
typename dTypeFilter,
typename dTypeOut>
67 printf(
"Enter VXLIB_convolve_exec_cn\n");
74 size_t width = pKerPrivArgs->
width;
75 size_t height = pKerPrivArgs->
height;
88 bool isNotPadded = (padLeft == 0) && (padRight == 0) && (padTop == 0) && (padBottom == 0);
91 dTypeIn *restrict pInLocal = (dTypeIn *) pIn;
92 dTypeFilter *restrict pFilterLocal = (dTypeFilter *) pFilter;
93 dTypeOut *restrict pOutLocal = (dTypeOut *) pOut;
96 printf(
"In VXLIB_convolve_exec_cn, width: %d, height: %d\n", width, height);
102 int32_t outHeight = (height - filterHeight + 1);
103 int32_t outWidth = (width - filterWidth + 1);
110 for (i = 0; i < outHeight; i++) {
111 for (j = 0; j < outWidth; j++) {
115 for (m = 0; m < filterHeight; m++) {
116 for (n = 0; n < filterWidth; n++) {
117 sum += (pInLocal[(i + m) * strideInElements + (j + n)]) *
118 pFilterLocal[(filterHeight - 1 - m) * filterWidth + (filterWidth - 1 - n)];
122 result = (int32_t)((uint64_t)sum >> (uint64_t)scale);
125 result = (result > MAX) ? MAX : result;
126 result = (result < MIN) ? MIN : result;
128 pOutLocal[i * strideOutElements + j] = result;
150 void *restrict pFilter,
151 void *restrict pOut);
155 void *restrict pFilter,
156 void *restrict pOut);
template VXLIB_STATUS VXLIB_convolve_exec_cn< VXLIB_CONVOLVE_TYPENAME_I8U_C16S_O8U >(VXLIB_kernelHandle handle, void *restrict pIn, void *restrict pFilter, void *restrict pOut)
VXLIB_STATUS VXLIB_convolve_exec_cn(VXLIB_kernelHandle handle, void *restrict pIn, void *restrict pFilter, void *restrict pOut)
This function is the main execution function for the natural C implementation of the kernel....
#define VXLIB_CONVOLVE_NUMERIC_MAX(x)
template VXLIB_STATUS VXLIB_convolve_exec_cn< VXLIB_CONVOLVE_TYPENAME_I8U_C16S_O16S >(VXLIB_kernelHandle handle, void *restrict pIn, void *restrict pFilter, void *restrict pOut)
#define VXLIB_CONVOLVE_NUMERIC_MIN(x)
Header file for kernel's internal use. For the kernel's interface, please see VXLIB_convolve.
void * VXLIB_kernelHandle
Handle type for VXLIB operations.
VXLIB_STATUS_NAME
The enumeration of all status codes.
@ VXLIB_ERR_CONVOLVE_PADDED_NOT_IMPLEMENTED
int32_t padLeft
Padding options
int32_t filterWidth
filter columns
int32_t filterHeight
filter rows
uint32_t scale
scale factor
Structure that is reserved for internal use by the kernel.
VXLIB_convolve_InitArgs pKerInitArgs
Initargs of the kernel.
size_t width
Width of image
size_t strideInElements
Stride of input in elements.
size_t strideOutElements
Stride of output in elements.
size_t height
Height of image