DSPLIB User Guide
DSPLIB_matTrans_cn.cpp
Go to the documentation of this file.
1 /*******************************************************************************
2 **+--------------------------------------------------------------------------+**
3 **| **** |**
4 **| **** |**
5 **| ******o*** |**
6 **| ********_///_**** |**
7 **| ***** /_//_/ **** |**
8 **| ** ** (__/ **** |**
9 **| ********* |**
10 **| **** |**
11 **| *** |**
12 **| |**
13 **| Copyright (c) 2016 Texas Instruments Incorporated |**
14 **| ALL RIGHTS RESERVED |**
15 **| |**
16 **| Permission to use, copy, modify, or distribute this software, |**
17 **| whether in part or in whole, for any purpose is forbidden without |**
18 **| a signed licensing agreement and NDA from Texas Instruments |**
19 **| Incorporated (TI). |**
20 **| |**
21 **| TI makes no representation or warranties with respect to the |**
22 **| performance of this computer program, and specifically disclaims |**
23 **| any responsibility for any damages, special or consequential, |**
24 **| connected with the use of this program. |**
25 **| |**
26 **+--------------------------------------------------------------------------+**
27 *******************************************************************************/
28 
29 #include "DSPLIB_matTrans_priv.h"
30 
32  DSPLIB_bufParams2D_t *bufParamsIn,
33  DSPLIB_bufParams2D_t *bufParamsOut,
34  const DSPLIB_matTransInitArgs *pKerInitArgs)
35 {
37  return status;
38 }
39 
40 template <typename dataType>
41 DSPLIB_STATUS DSPLIB_matTrans_exec_cn(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pOut)
42 {
43  DSPLIB_DEBUGPRINTFN(0, "%s\n", "Entering function");
44 
46 
47  DSPLIB_matTrans_PrivArgs *pKerPrivArgs = (DSPLIB_matTrans_PrivArgs *) handle;
48  uint32_t heightIn = pKerPrivArgs->heightIn;
49  uint32_t widthIn = pKerPrivArgs->widthIn;
50  int32_t strideIn = pKerPrivArgs->strideIn;
51  int32_t strideOut = pKerPrivArgs->strideOut;
52  int32_t dataSize = sizeof(dataType);
53 
54  /* Typecast void pointers to respective data type */
55  dataType *pInLocal = (dataType *) pIn;
56  dataType *pOutLocal = (dataType *) pOut;
57 
58  DSPLIB_DEBUGPRINTFN(0, "pInLocal: %p pOutLocal: %p widthIn: %d heightIn: %d\n", pInLocal, pOutLocal, widthIn,
59  heightIn);
60 
61  uint32_t i, j;
62  /* ------------------------------------------------------------------- */
63  /* Write each column of 'pInLocal' to a row of 'pOutLocal'. */
64  /* ------------------------------------------------------------------- */
65  for (i = 0; i < widthIn; i++) {
66  for (j = 0; j < heightIn; j++) {
67  pOutLocal[(i * strideOut / dataSize) + j] = pInLocal[i + ((strideIn / dataSize) * j)];
68  }
69  }
70 
71  DSPLIB_DEBUGPRINTFN(0, "Exiting function with return status: %d\n", status);
72 
73  return (status);
74 }
75 
76 // explicit instantiation for the different data type versions
77 template DSPLIB_STATUS
78 DSPLIB_matTrans_exec_cn<float>(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pOut);
79 
80 template DSPLIB_STATUS
81 DSPLIB_matTrans_exec_cn<double>(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pOut);
82 template DSPLIB_STATUS
83 DSPLIB_matTrans_exec_cn<int8_t>(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pOut);
84 template DSPLIB_STATUS
85 DSPLIB_matTrans_exec_cn<uint8_t>(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pOut);
86 template DSPLIB_STATUS
87 DSPLIB_matTrans_exec_cn<int16_t>(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pOut);
88 template DSPLIB_STATUS
89 DSPLIB_matTrans_exec_cn<uint16_t>(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pOut);
90 template DSPLIB_STATUS
91 DSPLIB_matTrans_exec_cn<int32_t>(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pOut);
92 template DSPLIB_STATUS
93 DSPLIB_matTrans_exec_cn<uint32_t>(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pOut);
94 
95 template DSPLIB_STATUS
96 DSPLIB_matTrans_exec_cn<uint64_t>(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pOut);
97 template DSPLIB_STATUS
98 DSPLIB_matTrans_exec_cn<int64_t>(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pOut);
template DSPLIB_STATUS DSPLIB_matTrans_exec_cn< uint64_t >(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pOut)
DSPLIB_STATUS DSPLIB_matTrans_init_cn(DSPLIB_kernelHandle handle, DSPLIB_bufParams2D_t *bufParamsIn, DSPLIB_bufParams2D_t *bufParamsOut, const DSPLIB_matTransInitArgs *pKerInitArgs)
This function is the initialization function for the natural C implementation of the kernel....
template DSPLIB_STATUS DSPLIB_matTrans_exec_cn< int32_t >(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pOut)
DSPLIB_STATUS DSPLIB_matTrans_exec_cn(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pOut)
This function is the main execution function for the natural C implementation of the kernel....
template DSPLIB_STATUS DSPLIB_matTrans_exec_cn< uint32_t >(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pOut)
template DSPLIB_STATUS DSPLIB_matTrans_exec_cn< int16_t >(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pOut)
template DSPLIB_STATUS DSPLIB_matTrans_exec_cn< uint8_t >(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pOut)
template DSPLIB_STATUS DSPLIB_matTrans_exec_cn< int64_t >(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pOut)
template DSPLIB_STATUS DSPLIB_matTrans_exec_cn< uint16_t >(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pOut)
template DSPLIB_STATUS DSPLIB_matTrans_exec_cn< double >(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pOut)
template DSPLIB_STATUS DSPLIB_matTrans_exec_cn< float >(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pOut)
template DSPLIB_STATUS DSPLIB_matTrans_exec_cn< int8_t >(DSPLIB_kernelHandle handle, void *restrict pIn, void *restrict pOut)
Header file for kernel's internal use. For the kernel's interface, please see DSPLIB_mat_trans.
#define DSPLIB_DEBUGPRINTFN(N, fmt,...)
Definition: DSPLIB_types.h:83
DSPLIB_STATUS_NAME
The enumeration of all status codes.
Definition: DSPLIB_types.h:151
void * DSPLIB_kernelHandle
Handle type for DSPLIB operations.
Definition: DSPLIB_types.h:172
@ DSPLIB_SUCCESS
Definition: DSPLIB_types.h:152
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.
int32_t strideOut
Stride between rows of output data matrix
uint32_t heightIn
Height of input data matrix
int32_t strideIn
Stride between rows of input data matrix
uint32_t widthIn
Size of input buffer for different batches DSPLIB_matTrans_init that will be retrieved and used by DS...