FFTLIB User Guide
FFTLIB_debugPrint3DVReg.cpp
Go to the documentation of this file.
1 /******************************************************************************/
5 /* Copyright (C) 2015 Texas Instruments Incorporated - https://www.ti.com/
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  *
14  * Redistributions in binary form must reproduce the above copyright
15  * notice, this list of conditions and the following disclaimer in the
16  * documentation and/or other materials provided with the
17  * distribution.
18  *
19  * Neither the name of Texas Instruments Incorporated nor the names of
20  * its contributors may be used to endorse or promote products derived
21  * from this software without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34  *
35  ******************************************************************************/
36 
37 
38 /*******************************************************************************
39  *
40  * INCLUDES
41  *
42  ******************************************************************************/
43 
44 #include "../FFTLIB_types.h"
45 #include "../FFTLIB_bufParams.h"
46 
47 /******************************************************************************/
48 
49 /******************************************************************************/
56 /******************************************************************************/
57 
58 template <typename dataType>
59 void FFTLIB_debugPrint3DVReg_helper(dataType *matrix, const FFTLIB_bufParams3D_t *params)
60 {
61  uint32_t r,c,t;
62  dataType* xPtr;
63  dataType* yPtr;
64  dataType* zPtr = matrix;
65 
66  // stride_y is stored in bytes, but easier to use in elements
67  uint32_t stride_y_elements = params->stride_y / FFTLIB_sizeof(params->data_type);
68  uint32_t stride_z_elements = params->stride_z / FFTLIB_sizeof(params->data_type);
69 
70  FFTLIB_PRINTF("%s", "{\n");
71  for(t = 0; t < params->dim_z; t++){
72  yPtr = zPtr;
73  for(r = 0; r < params->dim_y; r++){
74  xPtr = yPtr;
75  for(c = 0; c < params->dim_x; c++){
76  FFTLIB_PRINTF("%3d, ", *(xPtr));
77  xPtr++;
78  }
79  FFTLIB_PRINTF("%s", "\n");
80  yPtr += stride_y_elements;
81  }
82  zPtr += stride_z_elements;
83  }
84  FFTLIB_PRINTF("%s", "};\n");
85  return;
86 }
87 
88 
89 template void FFTLIB_debugPrint3DVReg_helper<int8_t> (int8_t *matrix, const FFTLIB_bufParams3D_t *params);
90 template void FFTLIB_debugPrint3DVReg_helper<int16_t> (int16_t *matrix, const FFTLIB_bufParams3D_t *params);
91 template void FFTLIB_debugPrint3DVReg_helper<uint16_t>(uint16_t *matrix, const FFTLIB_bufParams3D_t *params);
92 template void FFTLIB_debugPrint3DVReg_helper<int32_t> (int32_t *matrix, const FFTLIB_bufParams3D_t *params);
93 
94 /******************************************************************************/
95 
96 /******************************************************************************/
103 /******************************************************************************/
104 
105 
106 // want this function to have C-linkage in library...
107 #ifdef __cplusplus
108 extern "C" {
109 #endif /* __cplusplus */
110 
111  void FFTLIB_debugPrint3DVReg(void *matrix, const FFTLIB_bufParams3D_t *params)
112  {
113  switch(params->data_type){
114  case FFTLIB_INT32 :
115  FFTLIB_debugPrint3DVReg_helper<int32_t>((int32_t *)matrix, params);
116  break;
117  case FFTLIB_INT16 :
118  FFTLIB_debugPrint3DVReg_helper<int16_t>((int16_t *)matrix, params);
119  break;
120  case FFTLIB_UINT16 :
121  FFTLIB_debugPrint3DVReg_helper<uint16_t>((uint16_t *)matrix, params);
122  break;
123  case FFTLIB_INT8 :
124  FFTLIB_debugPrint3DVReg_helper<int8_t>((int8_t *)matrix, params);
125  break;
126  default :
127  FFTLIB_PRINTF("\nERROR: Unrecognized data type in %s.\n", __FUNCTION__);
128  }
129 
130  return;
131  }
132 #ifdef __cplusplus
133 }
134 #endif /* __cplusplus */
@ FFTLIB_INT16
@ FFTLIB_INT8
@ FFTLIB_UINT16
@ FFTLIB_INT32
static int32_t FFTLIB_sizeof(uint32_t type)
Inline function returns number of bytes per element given a type of _FFTLIB_data_type_e.
template void FFTLIB_debugPrint3DVReg_helper< int8_t >(int8_t *matrix, const FFTLIB_bufParams3D_t *params)
void FFTLIB_debugPrint3DVReg_helper(dataType *matrix, const FFTLIB_bufParams3D_t *params)
template void FFTLIB_debugPrint3DVReg_helper< int32_t >(int32_t *matrix, const FFTLIB_bufParams3D_t *params)
template void FFTLIB_debugPrint3DVReg_helper< int16_t >(int16_t *matrix, const FFTLIB_bufParams3D_t *params)
void FFTLIB_debugPrint3DVReg(void *matrix, const FFTLIB_bufParams3D_t *params)
template void FFTLIB_debugPrint3DVReg_helper< uint16_t >(uint16_t *matrix, const FFTLIB_bufParams3D_t *params)
#define FFTLIB_PRINTF(fmt,...)
Definition: FFTLIB_types.h:108
A structure for a 3 dimensional buffer descriptor.
int32_t stride_z
Stride in Z dimension in bytes.
uint32_t dim_x
Width of buffer in X dimension in elements.
uint32_t data_type
Values are of type FFTLIB_data_type_e.
uint32_t dim_z
Depth of patch in Z dimension in elements.
uint32_t dim_y
Height of buffer in Y dimension in elements.
int32_t stride_y
Stride in Y dimension in bytes.