VXLIB User Guide
VXLIB_convolve_priv.h
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 #ifndef VXLIB_CONVOLVE_IXX_IXX_OXX_PRIV_H_
35 #define VXLIB_CONVOLVE_IXX_IXX_OXX_PRIV_H_
36 
37 #include "../common/VXLIB_utility.h"
38 #include "VXLIB_bufParams.h"
39 #include "VXLIB_convolve.h"
40 #include "VXLIB_types.h"
41 #include <cstdint>
42 
55 #define VXLIB_CONVOLVE_IXX_IXX_OXX_PBLOCK_SIZE (3 * VXLIB_SE_PARAM_SIZE + 2 * VXLIB_SA_PARAM_SIZE)
56 
62 #define VXLIB_CONVOLVE_I8U_C16S_O8U \
63  ((dTypeIn == VXLIB_UINT8) && (dTypeFilter == VXLIB_INT16) && (dTypeOut == VXLIB_UINT8))
64 
65 #define VXLIB_CONVOLVE_I8U_C16S_O16S \
66  ((dTypeIn == VXLIB_UINT8) && (dTypeFilter == VXLIB_INT16) && (dTypeOut == VXLIB_INT16))
67 
73 #define VXLIB_CONVOLVE_TYPENAME_I8U_C16S_O8U uint8_t, int16_t, uint8_t
74 #define VXLIB_CONVOLVE_TYPENAME_I8U_C16S_O16S uint8_t, int16_t, int16_t
75 
81 #define VXLIB_CONVOLVE_DTYPE_I8U_C16S_O8U VXLIB_UINT8, VXLIB_INT16, VXLIB_UINT8
82 #define VXLIB_CONVOLVE_DTYPE_I8U_C16S_O16S VXLIB_UINT8, VXLIB_INT16, VXLIB_INT16
83 
89 #define VXLIB_CONVOLVE_I8U_C16S_O8U_TEMPLATE(dTypeOut) \
90  (std::is_same<dTypeOut, uint8_t>::value)
91 #define VXLIB_CONVOLVE_I8U_C16S_O16S_TEMPLATE(dTypeOut) \
92  (std::is_same<dTypeOut, int16_t>::value)
93 
101  void *restrict pIn,
102  void *restrict pFilter,
103  void *restrict pOut);
104 
136 template <uint32_t dTypeIn, uint32_t dTypeFilter, uint32_t dTypeOut>
138  const VXLIB_bufParams2D_t *bufParamsIn,
139  const VXLIB_bufParams2D_t *bufParamsFilter,
140  const VXLIB_bufParams2D_t *bufParamsOut,
141  const VXLIB_convolve_InitArgs *pKerInitArgs);
142 
163 template <typename dTypeIn, typename dTypeFilter, typename dTypeOut>
165 VXLIB_convolve_exec_ci(VXLIB_kernelHandle handle, void *restrict pIn, void *restrict pFilter, void *restrict pOut);
166 
183 template <typename dTypeIn, typename dTypeFilter, typename dTypeOut>
184 extern VXLIB_STATUS
185 VXLIB_convolve_exec_cn(VXLIB_kernelHandle handle, void *restrict pIn, void *restrict pFilter, void *restrict pOut);
186 
191 typedef struct {
194 
199 
201  size_t width;
203  size_t height;
204 
207 
210 
212  size_t numBlocks;
213 
217 
218 #endif /* VXLIB_CONVOLVE_IXX_IXX_OXX_PRIV_H_ */
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....
VXLIB_STATUS(* pFxnVXLIB_convolve_exec)(VXLIB_kernelHandle handle, void *restrict pIn, void *restrict pFilter, void *restrict pOut)
This is a function pointer type that conforms to the declaration of VXLIB_convolve_exec_ci and VXLIB_...
VXLIB_STATUS VXLIB_convolve_init_ci(VXLIB_kernelHandle handle, const VXLIB_bufParams2D_t *bufParamsIn, const VXLIB_bufParams2D_t *bufParamsFilter, const VXLIB_bufParams2D_t *bufParamsOut, const VXLIB_convolve_InitArgs *pKerInitArgs)
This function is the initialization function for the C7x implementation of the kernel....
#define VXLIB_CONVOLVE_IXX_IXX_OXX_PBLOCK_SIZE
Macro to define the size of bufPblock array of VXLIB_convolve_PrivArgs structure.
VXLIB_STATUS VXLIB_convolve_exec_ci(VXLIB_kernelHandle handle, void *restrict pIn, void *restrict pFilter, void *restrict pOut)
This function is the main execution function for the C7x implementation of the kernel....
void * VXLIB_kernelHandle
Handle type for VXLIB operations.
Definition: VXLIB_types.h:247
VXLIB_STATUS_NAME VXLIB_STATUS
Return value for VXLIB functions.
Definition: VXLIB_types.h:245
VXLIB_STATUS_NAME
The enumeration of all status codes.
Definition: VXLIB_types.h:220
A structure for a 2 dimensional buffer descriptor.
Structure containing the parameters to initialize the kernel.
Structure that is reserved for internal use by the kernel.
VXLIB_convolve_InitArgs pKerInitArgs
Initargs of the kernel.
pFxnVXLIB_convolve_exec execute
Function pointer to point to the right execution variant between VXLIB_convolve_exec_cn and VXLIB_con...
size_t width
Width of image
size_t strideInElements
Stride of input in elements.
size_t numBlocks
Number of blocks to be processed after simidfication.
size_t strideOutElements
Stride of output in elements.
size_t height
Height of image