include/rppi_statistical_operations.h Source File

include/rppi_statistical_operations.h Source File#

RPP: include/rppi_statistical_operations.h Source File
rppi_statistical_operations.h
Go to the documentation of this file.
1 /*
2 MIT License
3 
4 Copyright (c) 2019 - 2024 Advanced Micro Devices, Inc.
5 
6 Permission is hereby granted, free of charge, to any person obtaining a copy
7 of this software and associated documentation files (the "Software"), to deal
8 in the Software without restriction, including without limitation the rights
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 copies of the Software, and to permit persons to whom the Software is
11 furnished to do so, subject to the following conditions:
12 
13 The above copyright notice and this permission notice shall be included in all
14 copies or substantial portions of the Software.
15 
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 SOFTWARE.
23 */
24 
25 #ifndef RPPI_STATISTICAL_OPERATIONS_H
26 #define RPPI_STATISTICAL_OPERATIONS_H
27 
28 #include "rppdefs.h"
29 #include "rpp.h"
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
46 /******************** thresholding ********************/
47 
48 // Thresholds the input element-wise, and produces boolean outputs for a batch of images
49 
50 // *param[in] srcPtr Input image batch
51 // *param[in] srcSize Array containing an RppiSize for each image in the batch
52 // *param[in] maxSrcSize A single RppiSize which is the maxWidth and maxHeight for all images in the batch
53 // *param[out] dstPtr Output image batch
54 // *param[in] minThreshold Array containing an Rpp8u minimum threshold for every pixel in each image in the batch (0 <= minThreshold <= 255)
55 // *param[in] maxThreshold Array containing an Rpp8u maximum threshold for every pixel in each image in the batch (0 <= maxThreshold <= 255)
56 // *param[in] nbatchSize Batch size or the number of images in the batch
57 // *param[in] rppHandle OpenCL-handle/HIP-handle for "_gpu" variants and Host-handle for "_host" variants
58 // *returns a RppStatus enumeration.
59 // *retval RPP_SUCCESS : No error, Succesful completion
60 // *retval RPP_ERROR : Error
61 
62 RppStatus rppi_thresholding_u8_pln1_batchPD_host(RppPtr_t srcPtr, RppiSize *srcSize, RppiSize maxSrcSize, RppPtr_t dstPtr, Rpp8u *minThreshold, Rpp8u *maxThreshold, Rpp32u nbatchSize, rppHandle_t rppHandle);
63 RppStatus rppi_thresholding_u8_pln3_batchPD_host(RppPtr_t srcPtr, RppiSize *srcSize, RppiSize maxSrcSize, RppPtr_t dstPtr, Rpp8u *minThreshold, Rpp8u *maxThreshold, Rpp32u nbatchSize, rppHandle_t rppHandle);
64 RppStatus rppi_thresholding_u8_pkd3_batchPD_host(RppPtr_t srcPtr, RppiSize *srcSize, RppiSize maxSrcSize, RppPtr_t dstPtr, Rpp8u *minThreshold, Rpp8u *maxThreshold, Rpp32u nbatchSize, rppHandle_t rppHandle);
65 #ifdef GPU_SUPPORT
66 RppStatus rppi_thresholding_u8_pln1_batchPD_gpu(RppPtr_t srcPtr, RppiSize *srcSize, RppiSize maxSrcSize, RppPtr_t dstPtr, Rpp8u *minThreshold, Rpp8u *maxThreshold, Rpp32u nbatchSize, rppHandle_t rppHandle);
67 RppStatus rppi_thresholding_u8_pln3_batchPD_gpu(RppPtr_t srcPtr, RppiSize *srcSize, RppiSize maxSrcSize, RppPtr_t dstPtr, Rpp8u *minThreshold, Rpp8u *maxThreshold, Rpp32u nbatchSize, rppHandle_t rppHandle);
68 RppStatus rppi_thresholding_u8_pkd3_batchPD_gpu(RppPtr_t srcPtr, RppiSize *srcSize, RppiSize maxSrcSize, RppPtr_t dstPtr, Rpp8u *minThreshold, Rpp8u *maxThreshold, Rpp32u nbatchSize, rppHandle_t rppHandle);
69 #endif // GPU_SUPPORT
70 
71 /******************** min ********************/
72 
73 // Computes minimum of corresponding pixels of two batches of images
74 
75 // *param[in] srcPtr1 Input image1 batch
76 // *param[in] srcPtr2 Input image2 batch
77 // *param[in] srcSize Array containing an RppiSize for each image in the batch
78 // *param[in] maxSrcSize A single RppiSize which is the maxWidth and maxHeight for all images in the batch
79 // *param[out] dstPtr Output image batch
80 // *param[in] nbatchSize Batch size or the number of images in the batch
81 // *param[in] rppHandle OpenCL-handle/HIP-handle for "_gpu" variants and Host-handle for "_host" variants
82 // *returns a RppStatus enumeration.
83 // *retval RPP_SUCCESS : No error, Succesful completion
84 // *retval RPP_ERROR : Error
85 
86 RppStatus rppi_min_u8_pln1_batchPD_host(RppPtr_t srcPtr1, RppPtr_t srcPtr2, RppiSize *srcSize, RppiSize maxSrcSize, RppPtr_t dstPtr, Rpp32u nbatchSize, rppHandle_t rppHandle);
87 RppStatus rppi_min_u8_pln3_batchPD_host(RppPtr_t srcPtr1, RppPtr_t srcPtr2, RppiSize *srcSize, RppiSize maxSrcSize, RppPtr_t dstPtr, Rpp32u nbatchSize, rppHandle_t rppHandle);
88 RppStatus rppi_min_u8_pkd3_batchPD_host(RppPtr_t srcPtr1, RppPtr_t srcPtr2, RppiSize *srcSize, RppiSize maxSrcSize, RppPtr_t dstPtr, Rpp32u nbatchSize, rppHandle_t rppHandle);
89 #ifdef GPU_SUPPORT
90 RppStatus rppi_min_u8_pln1_batchPD_gpu(RppPtr_t srcPtr1, RppPtr_t srcPtr2, RppiSize *srcSize, RppiSize maxSrcSize, RppPtr_t dstPtr, Rpp32u nbatchSize, rppHandle_t rppHandle);
91 RppStatus rppi_min_u8_pln3_batchPD_gpu(RppPtr_t srcPtr1, RppPtr_t srcPtr2, RppiSize *srcSize, RppiSize maxSrcSize, RppPtr_t dstPtr, Rpp32u nbatchSize, rppHandle_t rppHandle);
92 RppStatus rppi_min_u8_pkd3_batchPD_gpu(RppPtr_t srcPtr1, RppPtr_t srcPtr2, RppiSize *srcSize, RppiSize maxSrcSize, RppPtr_t dstPtr, Rpp32u nbatchSize, rppHandle_t rppHandle);
93 #endif // GPU_SUPPORT
94 
95 /******************** max ********************/
96 
97 // Computes maximum of corresponding pixels of two batches of images
98 
99 // *param[in] srcPtr1 Input image1 batch
100 // *param[in] srcPtr2 Input image2 batch
101 // *param[in] srcSize Array containing an RppiSize for each image in the batch
102 // *param[in] maxSrcSize A single RppiSize which is the maxWidth and maxHeight for all images in the batch
103 // *param[out] dstPtr Output image batch
104 // *param[in] nbatchSize Batch size or the number of images in the batch
105 // *param[in] rppHandle OpenCL-handle/HIP-handle for "_gpu" variants and Host-handle for "_host" variants
106 // *returns a RppStatus enumeration.
107 // *retval RPP_SUCCESS : No error, Succesful completion
108 // *retval RPP_ERROR : Error
109 
110 RppStatus rppi_max_u8_pln1_batchPD_host(RppPtr_t srcPtr1, RppPtr_t srcPtr2, RppiSize *srcSize, RppiSize maxSrcSize, RppPtr_t dstPtr, Rpp32u nbatchSize, rppHandle_t rppHandle);
111 RppStatus rppi_max_u8_pln3_batchPD_host(RppPtr_t srcPtr1, RppPtr_t srcPtr2, RppiSize *srcSize, RppiSize maxSrcSize, RppPtr_t dstPtr, Rpp32u nbatchSize, rppHandle_t rppHandle);
112 RppStatus rppi_max_u8_pkd3_batchPD_host(RppPtr_t srcPtr1, RppPtr_t srcPtr2, RppiSize *srcSize, RppiSize maxSrcSize, RppPtr_t dstPtr, Rpp32u nbatchSize, rppHandle_t rppHandle);
113 #ifdef GPU_SUPPORT
114 RppStatus rppi_max_u8_pln1_batchPD_gpu(RppPtr_t srcPtr1, RppPtr_t srcPtr2, RppiSize *srcSize, RppiSize maxSrcSize, RppPtr_t dstPtr, Rpp32u nbatchSize, rppHandle_t rppHandle);
115 RppStatus rppi_max_u8_pln3_batchPD_gpu(RppPtr_t srcPtr1, RppPtr_t srcPtr2, RppiSize *srcSize, RppiSize maxSrcSize, RppPtr_t dstPtr, Rpp32u nbatchSize, rppHandle_t rppHandle);
116 RppStatus rppi_max_u8_pkd3_batchPD_gpu(RppPtr_t srcPtr1, RppPtr_t srcPtr2, RppiSize *srcSize, RppiSize maxSrcSize, RppPtr_t dstPtr, Rpp32u nbatchSize, rppHandle_t rppHandle);
117 #endif // GPU_SUPPORT
118 
119 /******************** min_max_loc ********************/
120 
121 // Computes minimum, maximum pixel values, and their locations in an image
122 
123 // *param[in] srcPtr Input image
124 // *param[in] srcSize An RppiSize containing the width and height of the image
125 // *param[out] min Returning a Rpp8u min computed for the image
126 // *param[out] max Returning a Rpp8u max computed for the image
127 // *param[out] minLoc Returning a Rpp32u index of the min value for the image
128 // *param[out] maxLoc Returning a Rpp32u index of the max value for the image
129 // *param[in] rppHandle OpenCL-handle/HIP-handle for "_gpu" variants and Host-handle for "_host" variants
130 // *returns a RppStatus enumeration.
131 // *retval RPP_SUCCESS : No error, Succesful completion
132 // *retval RPP_ERROR : Error
133 
134 RppStatus rppi_min_max_loc_u8_pln1_host(RppPtr_t srcPtr, RppiSize srcSize, Rpp8u *min, Rpp8u *max, Rpp32u *minLoc, Rpp32u *maxLoc, rppHandle_t rppHandle);
135 RppStatus rppi_min_max_loc_u8_pln3_host(RppPtr_t srcPtr, RppiSize srcSize, Rpp8u *min, Rpp8u *max, Rpp32u *minLoc, Rpp32u *maxLoc, rppHandle_t rppHandle);
136 RppStatus rppi_min_max_loc_u8_pkd3_host(RppPtr_t srcPtr, RppiSize srcSize, Rpp8u *min, Rpp8u *max, Rpp32u *minLoc, Rpp32u *maxLoc, rppHandle_t rppHandle);
137 #ifdef GPU_SUPPORT
138 RppStatus rppi_min_max_loc_u8_pln1_gpu(RppPtr_t srcPtr, RppiSize srcSize, Rpp8u *min, Rpp8u *max, Rpp32u *minLoc, Rpp32u *maxLoc, rppHandle_t rppHandle);
139 RppStatus rppi_min_max_loc_u8_pln3_gpu(RppPtr_t srcPtr, RppiSize srcSize, Rpp8u *min, Rpp8u *max, Rpp32u *minLoc, Rpp32u *maxLoc, rppHandle_t rppHandle);
140 RppStatus rppi_min_max_loc_u8_pkd3_gpu(RppPtr_t srcPtr, RppiSize srcSize, Rpp8u *min, Rpp8u *max, Rpp32u *minLoc, Rpp32u *maxLoc, rppHandle_t rppHandle);
141 #endif // GPU_SUPPORT
142 
143 /******************** integral ********************/
144 
145 // Performs integral-image for a batch of images
146 
147 // *param[in] srcPtr Input image batch
148 // *param[in] srcSize Array containing an RppiSize for each image in the batch
149 // *param[in] maxSrcSize A single RppiSize which is the maxWidth and maxHeight for all images in the batch
150 // *param[out] dstPtr Output image batch
151 // *param[in] nbatchSize Batch size or the number of images in the batch
152 // *param[in] rppHandle OpenCL-handle/HIP-handle for "_gpu" variants and Host-handle for "_host" variants
153 // *returns a RppStatus enumeration.
154 // *retval RPP_SUCCESS : No error, Succesful completion
155 // *retval RPP_ERROR : Error
156 
157 RppStatus rppi_integral_u8_pln1_batchPD_host(RppPtr_t srcPtr, RppiSize *srcSize, RppiSize maxSrcSize, RppPtr_t dstPtr, Rpp32u nbatchSize, rppHandle_t rppHandle);
158 RppStatus rppi_integral_u8_pln3_batchPD_host(RppPtr_t srcPtr, RppiSize *srcSize, RppiSize maxSrcSize, RppPtr_t dstPtr, Rpp32u nbatchSize, rppHandle_t rppHandle);
159 RppStatus rppi_integral_u8_pkd3_batchPD_host(RppPtr_t srcPtr, RppiSize *srcSize, RppiSize maxSrcSize, RppPtr_t dstPtr, Rpp32u nbatchSize, rppHandle_t rppHandle);
160 #ifdef GPU_SUPPORT
161 RppStatus rppi_integral_u8_pln1_batchPD_gpu(RppPtr_t srcPtr, RppiSize *srcSize, RppiSize maxSrcSize, RppPtr_t dstPtr, Rpp32u nbatchSize, rppHandle_t rppHandle);
162 RppStatus rppi_integral_u8_pln3_batchPD_gpu(RppPtr_t srcPtr, RppiSize *srcSize, RppiSize maxSrcSize, RppPtr_t dstPtr, Rpp32u nbatchSize, rppHandle_t rppHandle);
163 RppStatus rppi_integral_u8_pkd3_batchPD_gpu(RppPtr_t srcPtr, RppiSize *srcSize, RppiSize maxSrcSize, RppPtr_t dstPtr, Rpp32u nbatchSize, rppHandle_t rppHandle);
164 #endif // GPU_SUPPORT
165 
166 /******************** histogram_equalization ********************/
167 
168 // Performs histogram equalization of an image for a batch of images
169 
170 // *param[in] srcPtr Input image batch
171 // *param[in] srcSize Array containing an RppiSize for each image in the batch
172 // *param[in] maxSrcSize A single RppiSize which is the maxWidth and maxHeight for all images in the batch
173 // *param[out] dstPtr Output image batch
174 // *param[in] nbatchSize Batch size or the number of images in the batch
175 // *param[in] rppHandle OpenCL-handle/HIP-handle for "_gpu" variants and Host-handle for "_host" variants
176 // *returns a RppStatus enumeration.
177 // *retval RPP_SUCCESS : No error, Succesful completion
178 // *retval RPP_ERROR : Error
179 
180 RppStatus rppi_histogram_equalization_u8_pln1_batchPD_host(RppPtr_t srcPtr, RppiSize *srcSize, RppiSize maxSrcSize, RppPtr_t dstPtr, Rpp32u nbatchSize, rppHandle_t rppHandle);
181 RppStatus rppi_histogram_equalization_u8_pln3_batchPD_host(RppPtr_t srcPtr, RppiSize *srcSize, RppiSize maxSrcSize, RppPtr_t dstPtr, Rpp32u nbatchSize, rppHandle_t rppHandle);
182 RppStatus rppi_histogram_equalization_u8_pkd3_batchPD_host(RppPtr_t srcPtr, RppiSize *srcSize, RppiSize maxSrcSize, RppPtr_t dstPtr, Rpp32u nbatchSize, rppHandle_t rppHandle);
183 #ifdef GPU_SUPPORT
184 RppStatus rppi_histogram_equalization_u8_pln1_batchPD_gpu(RppPtr_t srcPtr, RppiSize *srcSize, RppiSize maxSrcSize, RppPtr_t dstPtr, Rpp32u nbatchSize, rppHandle_t rppHandle);
185 RppStatus rppi_histogram_equalization_u8_pln3_batchPD_gpu(RppPtr_t srcPtr, RppiSize *srcSize, RppiSize maxSrcSize, RppPtr_t dstPtr, Rpp32u nbatchSize, rppHandle_t rppHandle);
186 RppStatus rppi_histogram_equalization_u8_pkd3_batchPD_gpu(RppPtr_t srcPtr, RppiSize *srcSize, RppiSize maxSrcSize, RppPtr_t dstPtr, Rpp32u nbatchSize, rppHandle_t rppHandle);
187 #endif // GPU_SUPPORT
188 
189 /******************** mean_stddev ********************/
190 
191 // Computes the mean and standard deviation of an image
192 
193 // *param[in] srcPtr Input image
194 // *param[in] srcSize An RppiSize containing the width and height of the image
195 // *param[out] mean Returning a Rpp32f mean computed for the image
196 // *param[out] stdDev Returning a Rpp32f stdDev computed for the image
197 // *param[in] rppHandle OpenCL-handle/HIP-handle for "_gpu" variants and Host-handle for "_host" variants
198 // *returns a RppStatus enumeration.
199 // *retval RPP_SUCCESS : No error, Succesful completion
200 // *retval RPP_ERROR : Error
201 
202 RppStatus rppi_mean_stddev_u8_pln1_host(RppPtr_t srcPtr, RppiSize srcSize, Rpp32f *mean, Rpp32f *stddev, rppHandle_t rppHandle);
203 RppStatus rppi_mean_stddev_u8_pln3_host(RppPtr_t srcPtr, RppiSize srcSize, Rpp32f *mean, Rpp32f *stddev, rppHandle_t rppHandle);
204 RppStatus rppi_mean_stddev_u8_pkd3_host(RppPtr_t srcPtr, RppiSize srcSize, Rpp32f *mean, Rpp32f *stddev, rppHandle_t rppHandle);
205 #ifdef GPU_SUPPORT
206 RppStatus rppi_mean_stddev_u8_pln1_gpu(RppPtr_t srcPtr, RppiSize srcSize, Rpp32f *mean, Rpp32f *stddev, rppHandle_t rppHandle);
207 RppStatus rppi_mean_stddev_u8_pln3_gpu(RppPtr_t srcPtr, RppiSize srcSize, Rpp32f *mean, Rpp32f *stddev, rppHandle_t rppHandle);
208 RppStatus rppi_mean_stddev_u8_pkd3_gpu(RppPtr_t srcPtr, RppiSize srcSize, Rpp32f *mean, Rpp32f *stddev, rppHandle_t rppHandle);
209 #endif // GPU_SUPPORT
210 
211 /******************** histogram ********************/
212 
213 // Computes the histogram of an image
214 
215 // *param[in] srcPtr Input image
216 // *param[in] srcSize An RppiSize containing the width and height of the image
217 // *param[out] outputHistogram Array returning the histogram of the image
218 // *param[in] bins Number of bins for the histogram
219 // *param[in] rppHandle OpenCL-handle/HIP-handle for "_gpu" variants and Host-handle for "_host" variants
220 // *returns a RppStatus enumeration.
221 // *retval RPP_SUCCESS : No error, Succesful completion
222 // *retval RPP_ERROR : Error
223 
224 RppStatus rppi_histogram_u8_pln1_host(RppPtr_t srcPtr, RppiSize srcSize, Rpp32u* outputHistogram, Rpp32u bins, rppHandle_t rppHandle);
225 RppStatus rppi_histogram_u8_pln3_host(RppPtr_t srcPtr, RppiSize srcSize, Rpp32u* outputHistogram, Rpp32u bins, rppHandle_t rppHandle);
226 RppStatus rppi_histogram_u8_pkd3_host(RppPtr_t srcPtr, RppiSize srcSize, Rpp32u* outputHistogram, Rpp32u bins, rppHandle_t rppHandle);
227 
231 #ifdef __cplusplus
232 }
233 #endif
234 #endif
unsigned int Rpp32u
32 bit unsigned int
Definition: rppdefs.h:80
unsigned char Rpp8u
8 bit unsigned char
Definition: rppdefs.h:72
void * RppPtr_t
void pointer
Definition: rppdefs.h:92
RppStatus
RPP RppStatus type enums.
Definition: rppdefs.h:100
float Rpp32f
32 bit float
Definition: rppdefs.h:88
RPP top-level header with RPP handle API.
RPP common HOST/GPU typedef, enum and structure definitions.
RPPI Image size(Width/Height dimensions) type struct.
Definition: rppdefs.h:317