VXLIB User Guide
VXLIB_median_ci.cpp
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright (C) 2023 Texas Instruments Incorporated - https://www.ti.com/
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  *
11  * Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the
14  * distribution.
15  *
16  * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  *
32  ******************************************************************************/
33 
34 /**********************************************************************************************************************/
35 /* */
36 /* INCLUDES */
37 /* */
38 /**********************************************************************************************************************/
39 
40 #include "VXLIB_median_priv.h"
41 
42 /**********************************************************************************************************************/
43 /* */
44 /* VXLIB_median_3X3_init_ci */
45 /* */
46 /**********************************************************************************************************************/
47 
48 template <typename dType>
50  const VXLIB_bufParams2D_t * bufParamsIn,
51  const VXLIB_bufParams2D_t * bufParamsMask,
52  const VXLIB_bufParams2D_t * bufParamsOut,
53  const VXLIB_bufParams2D_t * bufParamsScratch,
54  const VXLIB_median_InitArgs *pKerInitArgs)
55 {
56  VXLIB_DEBUGPRINTFN(0, "%s\n", "Entering Function");
57  VXLIB_STATUS status = VXLIB_SUCCESS; // assign status to success by default
58  // typecast handle (void) to struct pointer type associated to kernel
59  VXLIB_median_PrivArgs *pKerPrivArgs = (VXLIB_median_PrivArgs *) handle;
60  uint8_t * pBlock = pKerPrivArgs->bufPblock;
61  // bool kernelType = pKerPrivArgs->pKerInitArgs.kernelType;
62 
63  typedef typename c7x::make_full_vector<dType>::type vec;
64 
65  // obtain image parameters and overflow policy
66  size_t width = pKerPrivArgs->width;
67  size_t widthOut = pKerPrivArgs->widthOut;
68  size_t heightOut = pKerPrivArgs->heightOut;
69  size_t strideInElements = pKerPrivArgs->strideInElements;
70  size_t strideOutElements = pKerPrivArgs->strideOutElements;
71  uint32_t eleCount = c7x::element_count_of<vec>::value;
72  uint32_t numBlocks = (widthOut + eleCount - 1) / eleCount;
73  __SE_ELETYPE SE_ELETYPE = c7x::se_eletype<vec>::value;
74  __SE_VECLEN SE_VECLEN = c7x::se_veclen<vec>::value;
75  __SA_VECLEN SA_VECLEN = c7x::sa_veclen<vec>::value;
76 
77  // structs to hold SE and SA parameters
78  __SE_TEMPLATE_v1 se0Params = __gen_SE_TEMPLATE_v1();
79  __SE_TEMPLATE_v1 se1Params = __gen_SE_TEMPLATE_v1();
80  __SA_TEMPLATE_v1 sa0Params = __gen_SA_TEMPLATE_v1();
81 
82  se0Params.ICNT0 = eleCount;
83  se0Params.ICNT1 = 3;
84  se0Params.DIM1 = strideInElements;
85  se0Params.ICNT2 = heightOut;
86  se0Params.DIM2 = strideInElements;
87  se0Params.ICNT3 = numBlocks;
88  se0Params.DIM3 = eleCount;
89  se0Params.ICNT4 = 1;
90  se0Params.DIM4 = 0;
91  se0Params.DIMFMT = __SE_DIMFMT_5D;
92  se0Params.ELETYPE = SE_ELETYPE;
93  se0Params.VECLEN = SE_VECLEN;
94  se0Params.DECDIM1 = __SE_DECDIM_DIM3;
95  se0Params.DECDIM1_WIDTH = width;
96 
97  *(__SE_TEMPLATE_v1 *) ((uint8_t *) pBlock + SE0_PARAM_OFFSET) = se0Params;
98 
99  se1Params.ICNT0 = eleCount;
100  se1Params.ICNT1 = 2;
101  se1Params.DIM1 = 1;
102  se1Params.ICNT2 = 3;
103  se1Params.DIM2 = strideInElements;
104  se1Params.ICNT3 = heightOut;
105  se1Params.DIM3 = strideInElements;
106  se1Params.ICNT4 = numBlocks;
107  se1Params.DIM4 = eleCount;
108  se1Params.DIMFMT = __SE_DIMFMT_5D;
109  se1Params.ELETYPE = SE_ELETYPE;
110  se1Params.VECLEN = SE_VECLEN;
111  se1Params.DECDIM1 = __SE_DECDIM_DIM4;
112  se1Params.DECDIM1SD = __SE_DECDIMSD_DIM1;
113  se1Params.DECDIM1_WIDTH = width - 1;
114 
115  *(__SE_TEMPLATE_v1 *) ((uint8_t *) pBlock + SE1_PARAM_OFFSET) = se1Params;
116 
117  sa0Params.ICNT0 = eleCount;
118  sa0Params.ICNT1 = heightOut;
119  sa0Params.DIM1 = strideOutElements;
120  sa0Params.ICNT2 = numBlocks;
121  sa0Params.DIM2 = eleCount;
122  sa0Params.DIMFMT = __SA_DIMFMT_3D;
123  sa0Params.VECLEN = SA_VECLEN;
124  sa0Params.DECDIM1 = __SA_DECDIM_DIM2;
125  sa0Params.DECDIM1_WIDTH = widthOut;
126 
127  *(__SA_TEMPLATE_v1 *) ((uint8_t *) pBlock + SA0_PARAM_OFFSET) = sa0Params;
128 
129  return status;
130 }
131 
133  const VXLIB_bufParams2D_t * bufParamsIn,
134  const VXLIB_bufParams2D_t * bufParamsMask,
135  const VXLIB_bufParams2D_t * bufParamsOut,
136  const VXLIB_bufParams2D_t * bufParamsScratch,
137  const VXLIB_median_InitArgs *pKerInitArgs);
138 
140  const VXLIB_bufParams2D_t * bufParamsIn,
141  const VXLIB_bufParams2D_t * bufParamsMask,
142  const VXLIB_bufParams2D_t * bufParamsOut,
143  const VXLIB_bufParams2D_t * bufParamsScratch,
144  const VXLIB_median_InitArgs *pKerInitArgs);
146  const VXLIB_bufParams2D_t * bufParamsIn,
147  const VXLIB_bufParams2D_t * bufParamsMask,
148  const VXLIB_bufParams2D_t * bufParamsOut,
149  const VXLIB_bufParams2D_t * bufParamsScratch,
150  const VXLIB_median_InitArgs *pKerInitArgs);
152  const VXLIB_bufParams2D_t * bufParamsIn,
153  const VXLIB_bufParams2D_t * bufParamsMask,
154  const VXLIB_bufParams2D_t * bufParamsOut,
155  const VXLIB_bufParams2D_t * bufParamsScratch,
156  const VXLIB_median_InitArgs *pKerInitArgs);
157 // template VXLIB_STATUS VXLIB_median_3X3_init_ci<VXLIB_MEDIAN_TYPENAME_64S>(VXLIB_kernelHandle handle,
158 // const VXLIB_bufParams2D_t *bufParamsIn,
159 // const VXLIB_bufParams2D_t *bufParamsMask,
160 // const VXLIB_bufParams2D_t *bufParamsOut,
161 // const VXLIB_bufParams2D_t
162 // *bufParamsScratch, const
163 // VXLIB_median_InitArgs *pKerInitArgs);
164 
165 /**********************************************************************************************************************/
166 /* */
167 /* VXLIB_median_3X3_exec_ci */
168 /* */
169 /**********************************************************************************************************************/
170 
171 template <typename dType>
173  void *restrict pIn,
174  void *restrict pMask,
175  void *restrict pOut,
176  void *restrict pScratch)
177 {
178  VXLIB_DEBUGPRINTFN(0, "%s\n", "Entering Function");
179 
180  VXLIB_STATUS status = VXLIB_SUCCESS;
181  VXLIB_median_PrivArgs *pKerPrivArgs = (VXLIB_median_PrivArgs *) handle;
182 
183  dType *pInLocal = (dType *) pIn;
184  dType *pOutLocal = (dType *) pOut;
185 
186  typedef typename c7x::make_full_vector<dType>::type vec;
187 
188  uint8_t *pBlock = pKerPrivArgs->bufPblock;
189 
190  __SE_TEMPLATE_v1 se0Params = *(__SE_TEMPLATE_v1 *) ((uint8_t *) pBlock + SE0_PARAM_OFFSET);
191  __SE0_OPEN(pInLocal, se0Params);
192 
193  __SE_TEMPLATE_v1 se1Params = *(__SE_TEMPLATE_v1 *) ((uint8_t *) pBlock + SE1_PARAM_OFFSET);
194  __SE1_OPEN(pInLocal + 1, se1Params);
195 
196  __SA_TEMPLATE_v1 sa0Params = *(__SA_TEMPLATE_v1 *) ((uint8_t *) pBlock + SA0_PARAM_OFFSET);
197  __SA0_OPEN(sa0Params);
198 
199  int32_t outCols = pKerPrivArgs->widthOut;
200  int32_t outRows = pKerPrivArgs->heightOut;
201  uint32_t eleCount = c7x::element_count_of<vec>::value;
202  int32_t numBlocks = (outCols + eleCount - 1) / eleCount;
203  int32_t i, j;
204 
205 #pragma MUST_ITERATE(1, , )
206  for (i = 0; i < numBlocks; i++) {
207 #pragma MUST_ITERATE(1, , )
208  for (j = 0; j < outRows; j++) {
209  /*------------------------------------------------------*/
210  /* From a 3x3 input of (a to i) first find the min, med */
211  /* and max cols as shown below. */
212  /* */
213  /* row 0 - a b c min med max */
214  /* row 1 - d e f => min med max */
215  /* row 2 - g h i min med max */
216  /* */
217  /*------------------------------------------------------*/
218 
219  /* Find the MIN and MAX of Row 0 Col 0-1 */
220  vec row0_col0 = c7x::strm_eng<0, vec>::get_adv();
221  vec row0_col1 = c7x::strm_eng<1, vec>::get_adv();
222  vec row0_col2 = c7x::strm_eng<1, vec>::get_adv();
223 
224  vec row0_01_min = MIN_VAL(row0_col0, row0_col1);
225  vec row0_01_max = MAX_VAL(row0_col0, row0_col1);
226 
227  /* Find the MIN and MAX of Row 0 Col 0-1-2 */
228  vec row0_012_min = MIN_VAL(row0_01_min, row0_col2);
229  vec row0_012_max = MAX_VAL(row0_01_max, row0_col2);
230 
231  /* Find the MED of Row 0 Col 0-1-2 */
232  vec row0_012_med = MAX_VAL(MIN_VAL(row0_01_max, row0_col2), row0_01_min);
233 
234  /* Find the MIN and MAX of Row 1 and Col 0-1 */
235  vec row1_col0 = c7x::strm_eng<0, vec>::get_adv();
236  vec row1_col1 = c7x::strm_eng<1, vec>::get_adv();
237  vec row1_col2 = c7x::strm_eng<1, vec>::get_adv();
238 
239  vec row1_01_min = MIN_VAL(row1_col0, row1_col1);
240  vec row1_01_max = MAX_VAL(row1_col0, row1_col1);
241 
242  /* Find the MIN and MAX of Row 1 and Col 0-1-2 */
243  vec row1_012_min = MIN_VAL(row1_01_min, row1_col2);
244  vec row1_012_max = MAX_VAL(row1_01_max, row1_col2);
245 
246  /* Find the MED of Row 1 Col 0-1-2 */
247  vec row1_012_med = MAX_VAL(MIN_VAL(row1_01_max, row1_col2), row1_01_min);
248 
249  /* Find the MIN and MAX of Row 2 and Col 0-1 */
250  vec row2_col0 = c7x::strm_eng<0, vec>::get_adv();
251  vec row2_col1 = c7x::strm_eng<1, vec>::get_adv();
252  vec row2_col2 = c7x::strm_eng<1, vec>::get_adv();
253 
254  vec row2_01_min = MIN_VAL(row2_col0, row2_col1);
255  vec row2_01_max = MAX_VAL(row2_col0, row2_col1);
256 
257  /* Find the MIN and MAX of Row 2 and Col 0-1-2 */
258  vec row2_012_min = MIN_VAL(row2_01_min, row2_col2);
259  vec row2_012_max = MAX_VAL(row2_01_max, row2_col2);
260 
261  /* Find the MED of Row 2 Col 0-1-2 */
262  vec row2_012_med = MAX_VAL(MIN_VAL(row2_01_max, row2_col2), row2_01_min);
263 
264  /*------------------------------------------------------*/
265  /* Now find the max of min column, min of max column */
266  /* and median of median colum as below */
267  /* */
268  /* col 0 col 1 col 2 */
269  /* row 0 - min med MAX */
270  /* row 1 - min MED max */
271  /* row 2 - MIN med max */
272  /* */
273  /*------------------------------------------------------*/
274 
275  /* Find the MAX of MIN in col 0 */
276  vec col0_012_max = MAX_VAL(MAX_VAL(row0_012_min, row1_012_min), row2_012_min);
277 
278  /* Find the MIN of MAX in col 2 */
279  vec col2_012_min = MIN_VAL(MIN_VAL(row0_012_max, row1_012_max), row2_012_max);
280 
281  /* Find the MED of MED in col 1 */
282  vec col1_012_med =
283  MAX_VAL(MIN_VAL(MAX_VAL(row0_012_med, row1_012_med), row2_012_med), MIN_VAL(row0_012_med, row1_012_med));
284 
285  /* Find the final MED of the diagonal */
286  vec median =
287  MAX_VAL(MIN_VAL(MAX_VAL(col0_012_max, col1_012_med), col2_012_min), MIN_VAL(col0_012_max, col1_012_med));
288 
289  /* Write out the final median */
290  __vpred vpStore = c7x::strm_agen<0, vec>::get_vpred();
291  vec * vStore = c7x::strm_agen<0, vec>::get_adv(pOutLocal);
292  __vstore_pred(vpStore, vStore, median);
293  }
294  }
295 
296  // Close streams
297  __SE0_CLOSE();
298  __SE1_CLOSE();
299 
300  // Close agen
301  __SA0_CLOSE();
302 
303  VXLIB_DEBUGPRINTFN(0, "%s\n", "Exiting Function");
304  return status;
305 }
306 
308  void *restrict pIn,
309  void *restrict pMask,
310  void *restrict pOut,
311  void *restrict pScratch);
313  void *restrict pIn,
314  void *restrict pMask,
315  void *restrict pOut,
316  void *restrict pScratch);
318  void *restrict pIn,
319  void *restrict pMask,
320  void *restrict pOut,
321  void *restrict pScratch);
323  void *restrict pIn,
324  void *restrict pMask,
325  void *restrict pOut,
326  void *restrict pScratch);
327 // template VXLIB_STATUS VXLIB_median_3X3_exec_ci<VXLIB_MEDIAN_TYPENAME_64S>(VXLIB_kernelHandle handle,
328 // void *restrict pIn,
329 // void *restrict pMask,
330 // void *restrict pOut,
331 // void *restrict pScratch);
332 
333 /**********************************************************************************************************************/
334 /* */
335 /* Performance estimation function */
336 /* */
337 /**********************************************************************************************************************/
338 
340  const VXLIB_bufParams2D_t *bufParamsIn,
341  const VXLIB_bufParams2D_t *bufParamsMask,
342  const VXLIB_bufParams2D_t *bufParamsOut,
343  const VXLIB_bufParams2D_t *bufParamsScratch,
344  const VXLIB_median_InitArgs *pKerInitArgs,
345  size_t *archCycles,
346  size_t *estCycles)
347 {
348 
349  // typecast handle (void) to struct pointer type associated to kernel
350  VXLIB_median_PrivArgs *pKerPrivArgs = (VXLIB_median_PrivArgs *) handle;
351 
352  uint32_t eleCount = 0;
353  if (bufParamsIn->data_type == VXLIB_UINT8) {
354  typedef typename c7x::make_full_vector<uint8_t>::type vec;
355  eleCount = c7x::element_count_of<vec>::value;
356  }
357  if (bufParamsIn->data_type == VXLIB_INT8) {
358  typedef typename c7x::make_full_vector<int8_t>::type vec;
359  eleCount = c7x::element_count_of<vec>::value;
360  }
361  if (bufParamsIn->data_type == VXLIB_UINT16) {
362  typedef typename c7x::make_full_vector<uint16_t>::type vec;
363  eleCount = c7x::element_count_of<vec>::value;
364  }
365  if (bufParamsIn->data_type == VXLIB_INT16) {
366  typedef typename c7x::make_full_vector<int16_t>::type vec;
367  eleCount = c7x::element_count_of<vec>::value;
368  }
369 
370  size_t overheadCnt = 55; // profiled code before entering compute loop
371 
372  /* -------------------- ESTIMATE FOR 3X3 -------------------- */
373  if (pKerInitArgs->kernelType == 0) {
374  uint32_t numBlocks = (pKerPrivArgs->heightOut) * VXLIB_ceilingDiv(pKerPrivArgs->widthOut, eleCount);
375  *archCycles = 7 + numBlocks * 8;
376  }
377  /* -------------------- ESTIMATE FOR MXN -------------------- */
378  else {
379  uint32_t M = pKerPrivArgs->M;
380  uint32_t N = pKerPrivArgs->N;
381  uint32_t width = pKerPrivArgs->width;
382  uint32_t widthOut = pKerPrivArgs->widthOut;
383  uint32_t heightOut = pKerPrivArgs->heightOut;
384  uint32_t unrollFactor = 0;
385  if (width <= eleCount) {
386  unrollFactor = 1;
387  }
388  else if (width <= 3 * eleCount) {
389  unrollFactor = 2;
390  }
391  else if (width <= 6 * eleCount) {
392  unrollFactor = 4;
393  }
394  else {
395  unrollFactor = 8;
396  }
397 
398  /* Truecnt loop */
399  size_t trueCntLoopCnt = M * N;
400  size_t trueCntCycles = 8 + trueCntLoopCnt * 2;
401 
402  /* Scratch buffer fill loop */
403  size_t scratchLoop = M * N * VXLIB_ceilingDiv(width, eleCount);
404  size_t scratchFillCycles = 4 + scratchLoop * 2;
405 
406  /* Sort loop */
407  size_t loop1Count = VXLIB_ceilingDiv((M * N), 2);
408  size_t loop1Exclusive = 0; // obtained from ASM.
409 
410  size_t widthBlocks = VXLIB_ceilingDiv(width, eleCount);
411  size_t loop2Count = VXLIB_ceilingDiv(widthBlocks, unrollFactor);
412  size_t loop2Exclusive = 0;
413 
414  size_t loop3Count = ((trueCntLoopCnt - 2 > 0) ? ((trueCntLoopCnt - 2) / 2) : 1);
415 
416  size_t loop3Cycles = 0;
417  if (unrollFactor == 1) {
418  loop3Cycles = 2 + loop3Count * 2;
419  loop2Exclusive = 13; // from ASM
420  loop1Exclusive = 23; // from ASM
421  }
422  else if (unrollFactor == 2) {
423  loop3Cycles = 2 + loop3Count * 4;
424  loop2Exclusive = 13; // from ASM
425  loop1Exclusive = 25; // from ASM
426  }
427  else if (unrollFactor == 4) {
428  loop3Cycles = 3 + loop3Count * 8;
429  loop2Exclusive = 14; // from ASM
430  loop1Exclusive = 25; // from ASM
431  }
432  else {
433  loop3Cycles = 4 + loop3Count * 16;
434  loop2Exclusive = 17; // from ASM
435  loop1Exclusive = 25; // from ASM
436  }
437 
438  size_t loop2Cycles = loop2Count * (loop2Exclusive + loop3Cycles);
439  size_t sortCycles = loop1Count * (loop1Exclusive + loop2Cycles);
440 
441  /* Store median values loop */
442  size_t storeLoopCnt = VXLIB_ceilingDiv(widthOut, eleCount);
443  size_t storeCycles = 6 + storeLoopCnt * 1;
444 
445  size_t outerLoopExclusive = 25; // from ASM
446 
447  *archCycles = trueCntCycles + heightOut * (outerLoopExclusive + scratchFillCycles + sortCycles + storeCycles);
448  }
449 
450  *estCycles = overheadCnt + *archCycles;
451 }
452 
453 /* ======================================================================== */
454 /* End of file: VXLIB_median_ci.cpp */
455 /* ======================================================================== */
#define SE0_PARAM_OFFSET
#define SA0_PARAM_OFFSET
#define SE1_PARAM_OFFSET
VXLIB_STATUS VXLIB_median_3X3_init_ci(VXLIB_kernelHandle handle, const VXLIB_bufParams2D_t *bufParamsIn, const VXLIB_bufParams2D_t *bufParamsMask, const VXLIB_bufParams2D_t *bufParamsOut, const VXLIB_bufParams2D_t *bufParamsScratch, const VXLIB_median_InitArgs *pKerInitArgs)
This function is the initialization function for the C7x implementation of the kernel....
template VXLIB_STATUS VXLIB_median_3X3_exec_ci< VXLIB_MEDIAN_TYPENAME_8U >(VXLIB_kernelHandle handle, void *restrict pIn, void *restrict pMask, void *restrict pOut, void *restrict pScratch)
template VXLIB_STATUS VXLIB_median_3X3_exec_ci< VXLIB_MEDIAN_TYPENAME_16S >(VXLIB_kernelHandle handle, void *restrict pIn, void *restrict pMask, void *restrict pOut, void *restrict pScratch)
template VXLIB_STATUS VXLIB_median_3X3_init_ci< VXLIB_MEDIAN_TYPENAME_16U >(VXLIB_kernelHandle handle, const VXLIB_bufParams2D_t *bufParamsIn, const VXLIB_bufParams2D_t *bufParamsMask, const VXLIB_bufParams2D_t *bufParamsOut, const VXLIB_bufParams2D_t *bufParamsScratch, const VXLIB_median_InitArgs *pKerInitArgs)
VXLIB_STATUS VXLIB_median_3X3_exec_ci(VXLIB_kernelHandle handle, void *restrict pIn, void *restrict pMask, void *restrict pOut, void *restrict pScratch)
This function is the main execution function for the C7x implementation of the kernel....
template VXLIB_STATUS VXLIB_median_3X3_init_ci< VXLIB_MEDIAN_TYPENAME_16S >(VXLIB_kernelHandle handle, const VXLIB_bufParams2D_t *bufParamsIn, const VXLIB_bufParams2D_t *bufParamsMask, const VXLIB_bufParams2D_t *bufParamsOut, const VXLIB_bufParams2D_t *bufParamsScratch, const VXLIB_median_InitArgs *pKerInitArgs)
template VXLIB_STATUS VXLIB_median_3X3_init_ci< VXLIB_MEDIAN_TYPENAME_8S >(VXLIB_kernelHandle handle, const VXLIB_bufParams2D_t *bufParamsIn, const VXLIB_bufParams2D_t *bufParamsMask, const VXLIB_bufParams2D_t *bufParamsOut, const VXLIB_bufParams2D_t *bufParamsScratch, const VXLIB_median_InitArgs *pKerInitArgs)
template VXLIB_STATUS VXLIB_median_3X3_init_ci< VXLIB_MEDIAN_TYPENAME_8U >(VXLIB_kernelHandle handle, const VXLIB_bufParams2D_t *bufParamsIn, const VXLIB_bufParams2D_t *bufParamsMask, const VXLIB_bufParams2D_t *bufParamsOut, const VXLIB_bufParams2D_t *bufParamsScratch, const VXLIB_median_InitArgs *pKerInitArgs)
template VXLIB_STATUS VXLIB_median_3X3_exec_ci< VXLIB_MEDIAN_TYPENAME_16U >(VXLIB_kernelHandle handle, void *restrict pIn, void *restrict pMask, void *restrict pOut, void *restrict pScratch)
template VXLIB_STATUS VXLIB_median_3X3_exec_ci< VXLIB_MEDIAN_TYPENAME_8S >(VXLIB_kernelHandle handle, void *restrict pIn, void *restrict pMask, void *restrict pOut, void *restrict pScratch)
Header file for kernel's internal use. For the kernel's interface, please see VXLIB_median.
#define MIN_VAL(a, b)
#define MAX_VAL(a, b)
void * VXLIB_kernelHandle
Handle type for VXLIB operations.
Definition: VXLIB_types.h:247
VXLIB_STATUS_NAME
The enumeration of all status codes.
Definition: VXLIB_types.h:220
@ VXLIB_SUCCESS
Definition: VXLIB_types.h:221
#define VXLIB_DEBUGPRINTFN(N, fmt,...)
Definition: VXLIB_types.h:94
@ VXLIB_UINT16
@ VXLIB_INT16
@ VXLIB_INT8
@ VXLIB_UINT8
void VXLIB_median_perfEst(VXLIB_kernelHandle handle, const VXLIB_bufParams2D_t *bufParamsIn, const VXLIB_bufParams2D_t *bufParamsMask, const VXLIB_bufParams2D_t *bufParamsOut, const VXLIB_bufParams2D_t *bufParamsScratch, const VXLIB_median_InitArgs *pKerInitArgs, size_t *archCycles, size_t *estCycles)
This function estimates the archCycles and estCycles.
A structure for a 2 dimensional buffer descriptor.
uint32_t data_type
Values are of type VXLIB_data_type_e.
Structure containing the parameters to initialize the kernel.
Definition: VXLIB_median.h:77
bool kernelType
To select between 3 X 3 OR M X N kernel size 0 for 3 X 3 1 for M X N.
Definition: VXLIB_median.h:84
Structure that is reserved for internal use by the kernel.
size_t N
Width of image
size_t strideInElements
Stride of INPUT in elements.
size_t M
Height of image
size_t width
Width of image
size_t widthOut
Width of image
uint8_t bufPblock[VXLIB_MEDIAN_IXX_IXX_OXX_PBLOCK_SIZE]
Array to hold SE/SA params.
size_t strideOutElements
Stride of output in elements.
size_t heightOut
Height of image