32 template <
typename Integer8or16or32BitDataType,
typename Integer8or16or32BitPromotedDataType>
34 void *restrict pErrCoefs,
35 const int *restrict pMaxIndex,
36 const void *restrict pMaxVal,
38 uint32_t errCoefsSize,
42 int32_t dataSize =
sizeof(Integer8or16or32BitDataType);
43 Integer8or16or32BitDataType *pInLocal = (Integer8or16or32BitDataType *) pIn;
44 Integer8or16or32BitDataType *pErrCoefsLocal = (Integer8or16or32BitDataType *) pErrCoefs;
45 int *pMaxIndexLocal = (
int *) pMaxIndex;
46 Integer8or16or32BitPromotedDataType *pMaxValLocal = (Integer8or16or32BitPromotedDataType *) pMaxVal;
48 Integer8or16or32BitPromotedDataType val;
49 *pMaxValLocal = std::numeric_limits<Integer8or16or32BitPromotedDataType>::min();
51 for (int32_t counter = 0; counter < (int32_t) vecInSize; counter++) {
53 Integer8or16or32BitPromotedDataType product1 =
54 ((((Integer8or16or32BitPromotedDataType) pInLocal[counter * (strideIn / dataSize) + 0]) *
55 (Integer8or16or32BitPromotedDataType) pErrCoefsLocal[0]));
56 Integer8or16or32BitPromotedDataType product2 =
57 ((((Integer8or16or32BitPromotedDataType) pInLocal[counter * (strideIn / dataSize) + 1]) *
58 (Integer8or16or32BitPromotedDataType) pErrCoefsLocal[1]));
59 Integer8or16or32BitPromotedDataType product3 =
60 ((((Integer8or16or32BitPromotedDataType) pInLocal[counter * (strideIn / dataSize) + 2]) *
61 (Integer8or16or32BitPromotedDataType) pErrCoefsLocal[2]));
62 Integer8or16or32BitPromotedDataType product4 =
63 ((((Integer8or16or32BitPromotedDataType) pInLocal[counter * (strideIn / dataSize) + 3]) *
64 (Integer8or16or32BitPromotedDataType) pErrCoefsLocal[3]));
65 Integer8or16or32BitPromotedDataType product5 =
66 ((((Integer8or16or32BitPromotedDataType) pInLocal[counter * (strideIn / dataSize) + 4]) *
67 (Integer8or16or32BitPromotedDataType) pErrCoefsLocal[4]));
68 Integer8or16or32BitPromotedDataType product6 =
69 ((((Integer8or16or32BitPromotedDataType) pInLocal[counter * (strideIn / dataSize) + 5]) *
70 (Integer8or16or32BitPromotedDataType) pErrCoefsLocal[5]));
71 Integer8or16or32BitPromotedDataType product7 =
72 ((((Integer8or16or32BitPromotedDataType) pInLocal[counter * (strideIn / dataSize) + 6]) *
73 (Integer8or16or32BitPromotedDataType) pErrCoefsLocal[6]));
74 Integer8or16or32BitPromotedDataType product8 =
75 ((((Integer8or16or32BitPromotedDataType) pInLocal[counter * (strideIn / dataSize) + 7]) *
76 (Integer8or16or32BitPromotedDataType) pErrCoefsLocal[7]));
77 Integer8or16or32BitPromotedDataType product9 =
78 ((((Integer8or16or32BitPromotedDataType) pInLocal[counter * (strideIn / dataSize) + 8]) *
79 (Integer8or16or32BitPromotedDataType) pErrCoefsLocal[8]));
81 Integer8or16or32BitPromotedDataType acc1 = (product1 >> 1) + (product2 >> 1);
82 Integer8or16or32BitPromotedDataType acc2 = (product3 >> 1) + (product4 >> 1);
83 Integer8or16or32BitPromotedDataType acc3 = (product5 >> 1) + (product6 >> 1);
84 Integer8or16or32BitPromotedDataType acc4 = (product7 >> 1) + (product8 >> 1);
85 Integer8or16or32BitPromotedDataType acc5 = (acc1 >> 1) + (acc2 >> 1);
86 Integer8or16or32BitPromotedDataType acc6 = (acc3 >> 1) + (acc4 >> 1);
87 Integer8or16or32BitPromotedDataType acc7 = (acc5 >> 1) + (acc6 >> 1);
88 val = (acc7 >> 1) + (product9 >> 1);
91 if (val > (*pMaxValLocal)) {
93 *pMaxIndexLocal = counter;
102 template <
typename Integer64BitDataType,
typename Integer64BitConvertedDataType>
104 void *restrict pErrCoefs,
105 const int *restrict pMaxIndex,
106 const void *restrict pMaxVal,
108 uint32_t errCoefsSize,
113 int32_t dataSize =
sizeof(Integer64BitDataType);
114 Integer64BitDataType *pInLocal = (Integer64BitDataType *) pIn;
115 Integer64BitDataType *pErrCoefsLocal = (Integer64BitDataType *) pErrCoefs;
116 int *pMaxIndexLocal = (
int *) pMaxIndex;
117 Integer64BitConvertedDataType *pMaxValLocal = (Integer64BitConvertedDataType *) pMaxVal;
119 Integer64BitConvertedDataType val, pMaxValScaler;
120 pMaxValScaler = std::numeric_limits<Integer64BitConvertedDataType>::min();
121 *pMaxValLocal = pMaxValScaler;
123 for (int32_t counter = 0; counter < (int32_t) vecInSize; counter++) {
126 for (int32_t j = 0; j < (int32_t) errCoefsSize; j++) {
127 val += ((Integer64BitConvertedDataType) pInLocal[counter * (strideIn / dataSize) + j]) *
128 (Integer64BitDataType) pErrCoefsLocal[j];
132 if (val > (pMaxValScaler)) {
134 *pMaxIndexLocal = counter;
137 *pMaxValLocal = (Integer64BitDataType) pMaxValScaler;
142 template <
typename FloatingPo
intDataType,
typename FloatingPo
intPromotedDataType>
144 void *restrict pErrCoefs,
145 const int *restrict pMaxIndex,
146 const void *restrict pMaxVal,
148 uint32_t errCoefsSize,
152 int32_t dataSize =
sizeof(FloatingPointDataType);
153 FloatingPointDataType *pInLocal = (FloatingPointDataType *) pIn;
154 FloatingPointPromotedDataType *pErrCoefsLocal = (FloatingPointPromotedDataType *) pErrCoefs;
155 int *pMaxIndexLocal = (
int *) pMaxIndex;
156 FloatingPointPromotedDataType *pMaxValLocal = (FloatingPointPromotedDataType *) pMaxVal;
158 FloatingPointPromotedDataType val;
159 *pMaxValLocal = std::numeric_limits<FloatingPointPromotedDataType>::min();
161 for (int32_t counter = 0; counter < (int32_t) vecInSize; counter++) {
164 for (int32_t j = 0; j < (int32_t) errCoefsSize; j++) {
165 val += ((FloatingPointPromotedDataType) pInLocal[counter * (strideIn / dataSize) + j]) * pErrCoefsLocal[j];
169 if (val > (*pMaxValLocal)) {
171 *pMaxIndexLocal = counter;
181 void *restrict pErrCoefs,
182 const int *restrict pMaxIndex,
183 const void *restrict pMaxVal)
191 minerror_exec_cn_integer8or16or32_inputs<int8_t, int16_t>(
201 void *restrict pErrCoefs,
202 const int *restrict pMaxIndex,
203 const void *restrict pMaxVal)
211 minerror_exec_cn_integer8or16or32_inputs<uint8_t, uint16_t>(
221 void *restrict pErrCoefs,
222 const int *restrict pMaxIndex,
223 const void *restrict pMaxVal)
231 minerror_exec_cn_integer8or16or32_inputs<int16_t, int32_t>(
241 void *restrict pErrCoefs,
242 const int *restrict pMaxIndex,
243 const void *restrict pMaxVal)
250 minerror_exec_cn_integer8or16or32_inputs<uint16_t, uint32_t>(
260 void *restrict pErrCoefs,
261 const int *restrict pMaxIndex,
262 const void *restrict pMaxVal)
269 minerror_exec_cn_integer8or16or32_inputs<int32_t, int64_t>(
279 void *restrict pErrCoefs,
280 const int *restrict pMaxIndex,
281 const void *restrict pMaxVal)
288 minerror_exec_cn_integer8or16or32_inputs<uint32_t, uint64_t>(
298 void *restrict pErrCoefs,
299 const int *restrict pMaxIndex,
300 const void *restrict pMaxVal)
307 minerror_exec_cn_integer64_inputs<int64_t, double>(pIn, pErrCoefs, pMaxIndex, pMaxVal, pKerPrivArgs->
vecInSize,
317 void *restrict pErrCoefs,
318 const int *restrict pMaxIndex,
319 const void *restrict pMaxVal)
326 minerror_exec_cn_integer64_inputs<uint64_t, double>(pIn, pErrCoefs, pMaxIndex, pMaxVal, pKerPrivArgs->
vecInSize,
336 void *restrict pErrCoefs,
337 const int *restrict pMaxIndex,
338 const void *restrict pMaxVal)
345 minerror_exec_cn_float_inputs<float, float>(pIn, pErrCoefs, pMaxIndex, pMaxVal, pKerPrivArgs->
vecInSize,
356 void *restrict pErrCoefs,
357 const int *restrict pMaxIndex,
358 const void *restrict pMaxVal)
365 minerror_exec_cn_float_inputs<double, double>(pIn, pErrCoefs, pMaxIndex, pMaxVal, pKerPrivArgs->
vecInSize,
DSPLIB_STATUS DSPLIB_minerror_exec_cn< int16_t >(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pErrCoefs, const int *restrict pMaxIndex, const void *restrict pMaxVal)
DSPLIB_STATUS DSPLIB_minerror_exec_cn< uint32_t >(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pErrCoefs, const int *restrict pMaxIndex, const void *restrict pMaxVal)
void minerror_exec_cn_integer64_inputs(void *restrict pIn, void *restrict pErrCoefs, const int *restrict pMaxIndex, const void *restrict pMaxVal, uint32_t vecInSize, uint32_t errCoefsSize, int32_t strideIn)
void minerror_exec_cn_integer8or16or32_inputs(void *restrict pIn, void *restrict pErrCoefs, const int *restrict pMaxIndex, const void *restrict pMaxVal, uint32_t vecInSize, uint32_t errCoefsSize, int32_t strideIn)
DSPLIB_STATUS DSPLIB_minerror_exec_cn< double >(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pErrCoefs, const int *restrict pMaxIndex, const void *restrict pMaxVal)
DSPLIB_STATUS DSPLIB_minerror_exec_cn< uint64_t >(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pErrCoefs, const int *restrict pMaxIndex, const void *restrict pMaxVal)
DSPLIB_STATUS DSPLIB_minerror_exec_cn< int64_t >(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pErrCoefs, const int *restrict pMaxIndex, const void *restrict pMaxVal)
void minerror_exec_cn_float_inputs(void *restrict pIn, void *restrict pErrCoefs, const int *restrict pMaxIndex, const void *restrict pMaxVal, uint32_t vecInSize, uint32_t errCoefsSize, int32_t strideIn)
DSPLIB_STATUS DSPLIB_minerror_exec_cn< uint16_t >(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pErrCoefs, const int *restrict pMaxIndex, const void *restrict pMaxVal)
DSPLIB_STATUS DSPLIB_minerror_exec_cn< int8_t >(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pErrCoefs, const int *restrict pMaxIndex, const void *restrict pMaxVal)
DSPLIB_STATUS DSPLIB_minerror_exec_cn< uint8_t >(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pErrCoefs, const int *restrict pMaxIndex, const void *restrict pMaxVal)
DSPLIB_STATUS DSPLIB_minerror_exec_cn< float >(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pErrCoefs, const int *restrict pMaxIndex, const void *restrict pMaxVal)
DSPLIB_STATUS DSPLIB_minerror_exec_cn< int32_t >(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pErrCoefs, const int *restrict pMaxIndex, const void *restrict pMaxVal)
Header file for kernel's internal use. For the kernel's interface, please see DSPLIB_minerror.
#define DSPLIB_DEBUGPRINTFN(N, fmt,...)
DSPLIB_STATUS_NAME
The enumeration of all status codes.
void * DSPLIB_kernelHandle
Handle type for DSPLIB operations.
Structure that is reserved for internal use by the kernel.
uint32_t errCoefsSize
Size of error coefficients vector
uint32_t vecInSize
Size of input data DSPLIB_minerror_init that will be retrieved and used by DSPLIB_minerror_exec