Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
nppdefs.h1013 linesDownload Raw Back to include
1 /* Copyright 2009-2023 NVIDIA CORPORATION & AFFILIATES.  All rights reserved.
2  * 
3  * NOTICE TO LICENSEE: 
4  * 
5  * The source code and/or documentation ("Licensed Deliverables") are 
6  * subject to NVIDIA intellectual property rights under U.S. and 
7  * international Copyright laws. 
8  * 
9  * The Licensed Deliverables contained herein are PROPRIETARY and 
10  * CONFIDENTIAL to NVIDIA and are being provided under the terms and 
11  * conditions of a form of NVIDIA software license agreement by and 
12  * between NVIDIA and Licensee ("License Agreement") or electronically 
13  * accepted by Licensee.  Notwithstanding any terms or conditions to 
14  * the contrary in the License Agreement, reproduction or disclosure 
15  * of the Licensed Deliverables to any third party without the express 
16  * written consent of NVIDIA is prohibited. 
17  * 
18  * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE 
19  * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE 
20  * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE.  THEY ARE 
21  * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. 
22  * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED 
23  * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, 
24  * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. 
25  * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE 
26  * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY 
27  * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY 
28  * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 
29  * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS 
30  * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
31  * OF THESE LICENSED DELIVERABLES. 
32  * 
33  * U.S. Government End Users.  These Licensed Deliverables are a 
34  * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT 
35  * 1995), consisting of "commercial computer software" and "commercial 
36  * computer software documentation" as such terms are used in 48 
37  * C.F.R. 12.212 (SEPT 1995) and are provided to the U.S. Government 
38  * only as a commercial end item.  Consistent with 48 C.F.R.12.212 and 
39  * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all 
40  * U.S. Government End Users acquire the Licensed Deliverables with 
41  * only those rights set forth herein. 
42  * 
43  * Any use of the Licensed Deliverables in individual and commercial 
44  * software must include, in the user documentation and internal 
45  * comments to the code, the above Disclaimer and U.S. Government End 
46  * Users Notice. 
47  */ 
48#ifndef NV_NPPIDEFS_H
49#define NV_NPPIDEFS_H
50
51#pragma once
52
53#include <stdlib.h>
54#include <cuda_runtime.h>
55//#if !defined cudaStream_t
56//typedef size_t cudaStream_t;
57//#endif
58
59/**
60 * \file nppdefs.h
61 * Typedefinitions and macros for NPP library.
62 */
63 
64#ifdef __cplusplus
65#ifdef NPP_PLUS
66using namespace nppPlusV;
67#else
68extern "C" {
69#endif
70#endif
71
72/** 
73  * Workarounds for cuda_fp16.h C incompatibility 
74  * Npp16f 
75  */
76 
77typedef struct      /**< Npp16f Cuda fp16 structure. */
78{
79   short fp16;      /**< Original Cuda fp16 data size and format. */
80}
81Npp16f;
82
83/** 
84  * Npp16f_2 
85  */
86
87typedef struct      /**< Npp16f_2 Cuda double fp16 structure. */
88{
89   short fp16_0;    /**< Original Cuda fp16 data size and format. */
90   short fp16_1;    /**< Original Cuda fp16 data size and format. */
91}
92Npp16f_2;           
93
94/**
95 * NPP_HALF_TO_NPP16F definition
96 */
97#define NPP_HALF_TO_NPP16F(pHalf) (* reinterpret_cast<Npp16f *>((void *)(pHalf)))
98
99/** If this is a 32-bit Windows compile, don't align to 16-byte at all
100  * and use a "union-trick" to create 8-byte alignment.
101  */
102#if defined(_WIN32) && !defined(_WIN64)
103
104/** On 32-bit Windows platforms, do not force 8-byte alignment.
105  * This is a consequence of a limitation of that platform. 
106  * 8-byte data alignment
107  */ 
108    #define NPP_ALIGN_8
109/** On 32-bit Windows platforms, do not force 16-byte alignment.
110  * This is a consequence of a limitation of that platform. 
111  * 16-byte data alignment
112  */  
113    #define NPP_ALIGN_16
114
115#else /* _WIN32 && !_WIN64 */
116
117    #define NPP_ALIGN_8     __align__(8)    
118    /**< 8-byte data alignment */    
119    #define NPP_ALIGN_16    __align__(16)
120   /**< 16-byte data alignment */
121
122#endif /* !__CUDACC__ && _WIN32 && !_WIN64 */
123
124
125/** \defgroup typedefs_npp NPP Type Definitions and Constants
126 * Definitions of types, structures, enumerations and constants available in the library.
127 * @{
128 */
129
130/** 
131 * Filtering methods.
132 */
133typedef enum 
134{
135    NPPI_INTER_UNDEFINED         = 0,        /**<  Undefined filtering interpolation mode. */
136    NPPI_INTER_NN                = 1,        /**<  Nearest neighbor filtering. */
137    NPPI_INTER_LINEAR            = 2,        /**<  Linear interpolation. */
138    NPPI_INTER_CUBIC             = 4,        /**<  Cubic interpolation. */
139    NPPI_INTER_CUBIC2P_BSPLINE,              /**<  Two-parameter cubic filter (B=1, C=0) */
140    NPPI_INTER_CUBIC2P_CATMULLROM,           /**<  Two-parameter cubic filter (B=0, C=1/2) */
141    NPPI_INTER_CUBIC2P_B05C03,               /**<  Two-parameter cubic filter (B=1/2, C=3/10) */
142    NPPI_INTER_SUPER             = 8,        /**<  Super sampling. */
143    NPPI_INTER_LANCZOS           = 16,       /**<  Lanczos filtering. */
144    NPPI_INTER_LANCZOS3_ADVANCED = 17,       /**<  Generic Lanczos filtering with order 3. */
145    NPPI_SMOOTH_EDGE             = (int)0x8000000 /**<  Smooth edge filtering. */
146} NppiInterpolationMode; 
147
148/** 
149 * Bayer Grid Position Registration.
150 */
151typedef enum 
152{
153    NPPI_BAYER_BGGR         = 0,        /**<  Default registration position BGGR. */
154    NPPI_BAYER_RGGB         = 1,        /**<  Registration position RGGB. */
155    NPPI_BAYER_GBRG         = 2,        /**<  Registration position GBRG. */
156    NPPI_BAYER_GRBG         = 3         /**<  Registration position GRBG. */
157} NppiBayerGridPosition; 
158
159/**
160 * Fixed filter-kernel sizes.
161 */
162typedef enum
163{
164    NPP_MASK_SIZE_1_X_3,            /**< 1 X 3 filter mask size. */
165    NPP_MASK_SIZE_1_X_5,            /**< 1 X 5 filter mask size. */
166    NPP_MASK_SIZE_3_X_1 = 100,      /**< 3 X 1 filter mask size, leaving space for more 1 X N type enum values. */ 
167    NPP_MASK_SIZE_5_X_1,            /**< 5 X 1 filter mask size. */
168    NPP_MASK_SIZE_3_X_3 = 200,      /**< 3 X 3 filter mask size, leaving space for more N X 1 type enum values. */
169    NPP_MASK_SIZE_5_X_5,            /**< 5 X 5 filter mask size. */
170    NPP_MASK_SIZE_7_X_7 = 400,      /**< 7 X 7 filter mask size. */
171    NPP_MASK_SIZE_9_X_9 = 500,      /**< 9 X 9 filter mask size. */
172    NPP_MASK_SIZE_11_X_11 = 600,    /**< 11 X 11 filter mask size. */
173    NPP_MASK_SIZE_13_X_13 = 700,    /**< 13 X 13 filter mask size. */
174    NPP_MASK_SIZE_15_X_15 = 800     /**< 15 X 15 filter mask size. */
175} NppiMaskSize;
176
177/** 
178 * Differential Filter types
179 */
180 
181typedef enum
182{
183    NPP_FILTER_SOBEL,   /**<  Differential kernel filter type sobel. */
184    NPP_FILTER_SCHARR,  /**<  Differential kernel filter type scharr. */
185} NppiDifferentialKernel;
186
187/**
188 * Error Status Codes
189 *
190 * Almost all NPP function return error-status information using
191 * these return codes.
192 * Negative return codes indicate errors, positive return codes indicate
193 * warnings, a return code of 0 indicates success.
194 */
195typedef enum /**< NppStatus NPP return value */
196{
197    /* negative return-codes indicate errors */
198    NPP_NOT_SUPPORTED_MODE_ERROR            = -9999,    /**< Not supported mode error.*/
199    
200    NPP_INVALID_HOST_POINTER_ERROR          = -1032,    /**< Invalid host memory pointer error.*/
201    NPP_INVALID_DEVICE_POINTER_ERROR        = -1031,    /**< Invalid device memory pointer error.*/
202    NPP_LUT_PALETTE_BITSIZE_ERROR           = -1030,    /**< Color look up table bitsize error.*/
203    NPP_ZC_MODE_NOT_SUPPORTED_ERROR         = -1028,    /**< ZeroCrossing mode not supported error. */
204    NPP_NOT_SUFFICIENT_COMPUTE_CAPABILITY   = -1027,    /**< Not sufficient Cuda compute capability error. */
205    NPP_TEXTURE_BIND_ERROR                  = -1024,    /**< Texture bind error. */
206    NPP_WRONG_INTERSECTION_ROI_ERROR        = -1020,    /**< Wrong intersection region of interest error. */
207    NPP_HAAR_CLASSIFIER_PIXEL_MATCH_ERROR   = -1006,    /**< Haar classifier pixel match error. */
208    NPP_MEMFREE_ERROR                       = -1005,    /**< Memory free request error. */
209    NPP_MEMSET_ERROR                        = -1004,    /**< Memory set request error. */
210    NPP_MEMCPY_ERROR                        = -1003,    /**< Memory copy request error. */
211    NPP_ALIGNMENT_ERROR                     = -1002,    /**< Memory alignment error. */
212    NPP_CUDA_KERNEL_EXECUTION_ERROR         = -1000,    /**< Cuda kernel execution error, most commonly Cuda kernel launch error. */
213
214    NPP_ROUND_MODE_NOT_SUPPORTED_ERROR      = -213,     /**< Unsupported round mode. */
215    
216    NPP_QUALITY_INDEX_ERROR                 = -210,     /**< Image pixels are constant for quality index. */
217
218    NPP_RESIZE_NO_OPERATION_ERROR           = -201,     /**< One of the output image dimensions is less than 1 pixel. */
219
220    NPP_OVERFLOW_ERROR                      = -109,     /**< Number overflows the upper or lower limit of the data type. */
221    NPP_NOT_EVEN_STEP_ERROR                 = -108,     /**< Step value is not pixel multiple. */
222    NPP_HISTOGRAM_NUMBER_OF_LEVELS_ERROR    = -107,     /**< Number of levels for histogram is less than 2. */
223    NPP_LUT_NUMBER_OF_LEVELS_ERROR          = -106,     /**< Number of levels for LUT is less than 2. */
224
225    NPP_CORRUPTED_DATA_ERROR                = -61,      /**< Processed data is corrupted, */
226    NPP_CHANNEL_ORDER_ERROR                 = -60,      /**< Wrong order of the destination channels, */
227    NPP_ZERO_MASK_VALUE_ERROR               = -59,      /**< All values of the mask are zero, */
228    NPP_QUADRANGLE_ERROR                    = -58,      /**< The quadrangle is nonconvex or degenerates into triangle, line or point. */
229    NPP_RECTANGLE_ERROR                     = -57,      /**< Size of the rectangle region is less than or equal to 1. */
230    NPP_COEFFICIENT_ERROR                   = -56,      /**< Unallowable values of the transformation coefficients.   */
231
232    NPP_NUMBER_OF_CHANNELS_ERROR            = -53,      /**< Bad or unsupported number of channels. */
233    NPP_COI_ERROR                           = -52,      /**< Channel of interest is not 1, 2, or 3. */
234    NPP_DIVISOR_ERROR                       = -51,      /**< Divisor is equal to zero */
235
236    NPP_CHANNEL_ERROR                       = -47,      /**< Illegal channel index. */
237    NPP_STRIDE_ERROR                        = -37,      /**< Stride is less than the row length. */
238    
239    NPP_ANCHOR_ERROR                        = -34,      /**< Anchor point is outside mask. */
240    NPP_MASK_SIZE_ERROR                     = -33,      /**< Lower bound is larger than upper bound. */
241
242    NPP_RESIZE_FACTOR_ERROR                 = -23,
243    NPP_INTERPOLATION_ERROR                 = -22,
244    NPP_MIRROR_FLIP_ERROR                   = -21,
245    NPP_MOMENT_00_ZERO_ERROR                = -20,
246    NPP_THRESHOLD_NEGATIVE_LEVEL_ERROR      = -19,
247    NPP_THRESHOLD_ERROR                     = -18,
248    NPP_CONTEXT_MATCH_ERROR                 = -17,
249    NPP_FFT_FLAG_ERROR                      = -16,
250    NPP_FFT_ORDER_ERROR                     = -15,
251    NPP_STEP_ERROR                          = -14,       /**<  Step is less or equal zero. */
252    NPP_SCALE_RANGE_ERROR                   = -13,
253    NPP_DATA_TYPE_ERROR                     = -12,
254    NPP_OUT_OFF_RANGE_ERROR                 = -11,
255    NPP_DIVIDE_BY_ZERO_ERROR                = -10,
256    NPP_MEMORY_ALLOCATION_ERR               = -9,
257    NPP_NULL_POINTER_ERROR                  = -8,
258    NPP_RANGE_ERROR                         = -7,
259    NPP_SIZE_ERROR                          = -6,
260    NPP_BAD_ARGUMENT_ERROR                  = -5,
261    NPP_NO_MEMORY_ERROR                     = -4,
262    NPP_NOT_IMPLEMENTED_ERROR               = -3,
263    NPP_ERROR                               = -2,
264    NPP_ERROR_RESERVED                      = -1,
265    
266    /* success */
267    NPP_NO_ERROR                            = 0,        /**<  Error free operation */
268    NPP_SUCCESS = NPP_NO_ERROR,                         /**<  Successful operation (same as NPP_NO_ERROR) */
269
270    /* positive return-codes indicate warnings */
271    NPP_NO_OPERATION_WARNING                = 1,        /**<  Indicates that no operation was performed */
272    NPP_DIVIDE_BY_ZERO_WARNING              = 6,        /**<  Divisor is zero however does not terminate the execution */
273    NPP_AFFINE_QUAD_INCORRECT_WARNING       = 28,       /**<  Indicates that the quadrangle passed to one of affine warping functions doesn't have necessary properties. First 3 vertices are used, the fourth vertex discarded. */
274    NPP_WRONG_INTERSECTION_ROI_WARNING      = 29,       /**<  The given ROI has no interestion with either the source or destination ROI. Thus no operation was performed. */
275    NPP_WRONG_INTERSECTION_QUAD_WARNING     = 30,       /**<  The given quadrangle has no intersection with either the source or destination ROI. Thus no operation was performed. */
276    NPP_DOUBLE_SIZE_WARNING                 = 35,       /**<  Image size isn't multiple of two. Indicates that in case of 422/411/420 sampling the ROI width/height was modified for proper processing. */
277    
278    NPP_MISALIGNED_DST_ROI_WARNING          = 10000,    /**<  Speed reduction due to uncoalesced memory accesses warning. */
279   
280} NppStatus;
281
282
283/**
284 * NPPLibraryVersion
285 * This struct contains the NPP Library Version information.
286 */
287typedef struct 
288{
289    int    major;   /**<  Major version number */
290    int    minor;   /**<  Minor version number */
291    int    build;   /**<  Build number. This reflects the nightly build this release was made from. */
292} NppLibraryVersion;  
293
294
295/** @} typedefs_npp. */ 
296
297/** 
298 * \defgroup npp_basic_types Basic NPP Data Types
299 * Definitions of basic types available in the library.
300 * @{
301 */
302
303typedef unsigned char       Npp8u;     /**<  8-bit unsigned chars */
304typedef signed char         Npp8s;     /**<  8-bit signed chars */
305typedef unsigned short      Npp16u;    /**<  16-bit unsigned integers */
306typedef short               Npp16s;    /**<  16-bit signed integers */
307typedef unsigned int        Npp32u;    /**<  32-bit unsigned integers */
308typedef int                 Npp32s;    /**<  32-bit signed integers */
309typedef unsigned long long  Npp64u;    /**<  64-bit unsigned integers */
310typedef long long           Npp64s;    /**<  64-bit signed integers */
311typedef float               Npp32f;    /**<  32-bit (IEEE) floating-point numbers */
312typedef double              Npp64f;    /**<  64-bit floating-point numbers */
313
314
315/**
316 * Complex Number
317 * This struct represents an unsigned char complex number.
318 */
319typedef struct
320{
321    Npp8u  re;     /**<  Real part */
322    Npp8u  im;     /**<  Imaginary part */
323} Npp8uc;
324
325/**
326 * Complex Number
327 * This struct represents an unsigned short complex number.
328 */
329typedef struct
330{
331    Npp16u  re;     /**<  Real part */
332    Npp16u  im;     /**<  Imaginary part */
333} Npp16uc;
334
335/**
336 * Complex Number
337 * This struct represents a short complex number.
338 */
339typedef struct
340{
341    Npp16s  re;     /**<  Real part */
342    Npp16s  im;     /**<  Imaginary part */
343} Npp16sc;
344
345/**
346 * Complex Number
347 * This struct represents an unsigned int complex number.
348 */
349typedef struct
350{
351    Npp32u  re;     /**<  Real part */
352    Npp32u  im;     /**<  Imaginary part */
353} Npp32uc;
354
355/**
356 * Complex Number
357 * This struct represents a signed int complex number.
358 */
359typedef struct
360{
361    Npp32s  re;     /**<  Real part */
362    Npp32s  im;     /**<  Imaginary part */
363} Npp32sc;
364
365/**
366 * Complex Number
367 * This struct represents a single floating-point complex number.
368 */
369typedef struct
370{
371    Npp32f  re;     /**<  Real part */
372    Npp32f  im;     /**<  Imaginary part */
373} Npp32fc;
374
375/**
376 * Complex Number
377 * This struct represents a long long complex number.
378 */
379typedef struct
380{
381    Npp64s  re;     /**<  Real part */
382    Npp64s  im;     /**<  Imaginary part */
383} Npp64sc;
384
385/**
386 * Complex Number
387 * This struct represents a double floating-point complex number.
388 */
389typedef struct
390{
391    Npp64f  re;     /**<  Real part */
392    Npp64f  im;     /**<  Imaginary part */
393} Npp64fc;
394
395
396/** 
397 * Data types for nppiPlus functions
398 */
399typedef enum
400{
401    NPP_8U,     /**<  8-bit unsigned integer data type */
402    NPP_8S,     /**<  8-bit signed integer data type */
403    NPP_16U,    /**< 16-bit unsigned integer data type */
404    NPP_16S,    /**< 16-bit signed integer data type */
405    NPP_32U,    /**< 32-bit unsigned integer data type */
406    NPP_32S,    /**< 32-bit signed integer data type */
407    NPP_64U,    /**< 64-bit unsigned integer data type */
408    NPP_64S,    /**< 64-bit signed integer data type */
409    NPP_16F,    /**< 16-bit original Cuda floating point data type */
410    NPP_32F,    /**< 32-bit floating point data type */
411    NPP_64F     /**< 64-bit double precision floating point data type */
412} NppDataType;
413
414/** 
415 * Image channel counts for nppiPlus functions
416 */
417typedef enum
418{
419    NPP_CH_1,   /**<  Single channel per pixel data */
420    NPP_CH_2,   /**<  Two channel per pixel data */
421    NPP_CH_3,   /**<  Three channel per pixel data */
422    NPP_CH_4,   /**<  Four channel per pixel data */
423    NPP_CH_A4,  /**<  Four channel per pixel data with alpha */
424    NPP_CH_P2,  /**<  Two channel single channel per plane pixel data */
425    NPP_CH_P3,  /**<  Three channel single channel per plane pixel data */
426    NPP_CH_P4   /**<  Four channel single channel per plane pixel data */
427} NppiChannels;
428
429/** @} npp_basic_types. */ 
430
431#define NPP_MIN_8U      ( 0 )                        
432/**<  Minimum 8-bit unsigned integer */
433#define NPP_MAX_8U      ( 255 )
434/**<  Maximum 8-bit unsigned integer */
435#define NPP_MIN_16U     ( 0 )
436/**<  Minimum 16-bit unsigned integer */
437#define NPP_MAX_16U     ( 65535 )
438/**<  Maximum 16-bit unsigned integer */
439#define NPP_MIN_32U     ( 0 )
440/**<  Minimum 32-bit unsigned integer */
441#define NPP_MAX_32U     ( 4294967295U )
442/**<  Maximum 32-bit unsigned integer */
443#define NPP_MIN_64U     ( 0 )
444/**<  Minimum 64-bit unsigned integer */
445#define NPP_MAX_64U     ( 18446744073709551615ULL )  
446/**<  Maximum 64-bit unsigned integer */
447
448#define NPP_MIN_8S      (-127 - 1 )                  
449/**<  Minimum 8-bit signed integer */
450#define NPP_MAX_8S      ( 127 )                      
451/**<  Maximum 8-bit signed integer */
452#define NPP_MIN_16S     (-32767 - 1 )
453/**<  Minimum 16-bit signed integer */
454#define NPP_MAX_16S     ( 32767 )
455/**<  Maximum 16-bit signed integer */
456#define NPP_MIN_32S     (-2147483647 - 1 )           
457/**<  Minimum 32-bit signed integer */
458#define NPP_MAX_32S     ( 2147483647 )
459/**<  Maximum 32-bit signed integer */
460#define NPP_MAX_64S     ( 9223372036854775807LL )    
461/**<  Minimum 64-bit signed integer */
462#define NPP_MIN_64S     (-9223372036854775807LL - 1)
463/**<  Minimum 64-bit signed integer */
464
465#define NPP_MINABS_32F  ( 1.175494351e-38f )         
466/**<  Smallest positive 32-bit floating point value */
467#define NPP_MAXABS_32F  ( 3.402823466e+38f )         
468/**<  Largest  positive 32-bit floating point value */
469#define NPP_MINABS_64F  ( 2.2250738585072014e-308 )  
470/**<  Smallest positive 64-bit floating point value */
471#define NPP_MAXABS_64F  ( 1.7976931348623158e+308 )  
472/**<  Largest  positive 64-bit floating point value */
473
474
475/** 
476 * 2D Point
477 */
478typedef struct 
479{
480    int x;      /**<  x-coordinate. */
481    int y;      /**<  y-coordinate. */
482} NppiPoint;
483
484/** 
485 * 2D Npp32f Point
486 */
487typedef struct 
488{
489    Npp32f x;      /**<  x-coordinate. */
490    Npp32f y;      /**<  y-coordinate. */
491} NppiPoint32f;
492
493/** 
494 * 2D Npp64f Point
495 */
496typedef struct 
497{
498    Npp64f x;      /**<  x-coordinate. */
499    Npp64f y;      /**<  y-coordinate. */
500} NppiPoint64f;
501
502/** 
503 * 2D Polar Point
504 */
505typedef struct {
506    Npp32f rho;     /**<  Polar rho value. */
507    Npp32f theta;   /**<  Polar theta value. */
508} NppPointPolar;
509
510/**
511 * 2D Size
512 * This struct typically represents the size of a a rectangular region in
513 * two space.
514 */
515typedef struct 
516{
517    int width;  /**<  Rectangle width. */
518    int height; /**<  Rectangle height. */
519} NppiSize;
520
521/**
522 * 2D Rectangle
523 * This struct contains position and size information of a rectangle in 
524 * two space.
525 * The rectangle's position is usually signified by the coordinate of its
526 * upper-left corner.
527 */
528typedef struct
529{
530    int x;          /**<  x-coordinate of upper left corner (lowest memory address). */
531    int y;          /**<  y-coordinate of upper left corner (lowest memory address). */
532    int width;      /**<  Rectangle width. */
533    int height;     /**<  Rectangle height. */
534} NppiRect;
535
536/**
537 * nppiMirror direction controls
538 */
539typedef enum 
540{
541    NPP_HORIZONTAL_AXIS,    /**<  Flip around horizontal axis in mirror function. */
542    NPP_VERTICAL_AXIS,      /**<  Flip around vertical axis in mirror function. */
543    NPP_BOTH_AXIS           /**<  Flip around both axes in mirror function. */
544} NppiAxis;
545
546/**
547 * Pixel comparison control values
548 */
549typedef enum 
550{
551    NPP_CMP_LESS,           /**<  Threshold test for less than. */
552    NPP_CMP_LESS_EQ,        /**<  Threshold test for less than or equal. */
553    NPP_CMP_EQ,             /**<  Threshold test for equal. */
554    NPP_CMP_GREATER_EQ,     /**<  Threshold test for greater than or equal. */
555    NPP_CMP_GREATER         /**<  Threshold test for greater than. */
556} NppCmpOp;
557
558/**
559 * Rounding Modes
560 *
561 * The enumerated rounding modes are used by a large number of NPP primitives
562 * to allow the user to specify the method by which fractional values are converted
563 * to integer values. Also see \ref rounding_modes.
564 *
565 * For NPP release 5.5 new names for the three rounding modes are introduced that are
566 * based on the naming conventions for rounding modes set forth in the IEEE-754
567 * floating-point standard. Developers are encouraged to use the new, longer names
568 * to be future proof as the legacy names will be deprecated in subsequent NPP releases.
569 *
570 */
571typedef enum 
572{
573    /** 
574     * Round to the nearest even integer.
575     * All fractional numbers are rounded to their nearest integer. The ambiguous
576     * cases (i.e. \<integer\>.5) are rounded to the closest even integer.
577     * E.g.
578     * - roundNear(0.5) = 0
579     * - roundNear(0.6) = 1
580     * - roundNear(1.5) = 2
581     * - roundNear(-1.5) = -2
582     */
583    NPP_RND_NEAR,
584    NPP_ROUND_NEAREST_TIES_TO_EVEN = NPP_RND_NEAR, ///< Alias name for NPP_RND_NEAR.
585    /** 
586     * Round according to financial rule.
587     * All fractional numbers are rounded to their nearest integer. The ambiguous
588     * cases (i.e. \<integer\>.5) are rounded away from zero.
589     * E.g.
590     * - roundFinancial(0.4)  = 0
591     * - roundFinancial(0.5)  = 1
592     * - roundFinancial(-1.5) = -2
593     */
594    NPP_RND_FINANCIAL,
595    NPP_ROUND_NEAREST_TIES_AWAY_FROM_ZERO = NPP_RND_FINANCIAL, ///< Alias name for NPP_RND_FINANCIAL. 
596    /**
597     * Round towards zero (truncation). 
598     * All fractional numbers of the form \<integer\>.\<decimals\> are truncated to
599     * \<integer\>.
600     * - roundZero(1.5) = 1
601     * - roundZero(1.9) = 1
602     * - roundZero(-2.5) = -2
603     */
604    NPP_RND_ZERO,
605    NPP_ROUND_TOWARD_ZERO = NPP_RND_ZERO, ///< Alias name for NPP_RND_ZERO. 
606    
607    /**
608     * Other rounding modes supported by IEEE-754 (2008) floating-point standard:
609     *
610     * - NPP_ROUND_TOWARD_INFINITY // ceiling
611     * - NPP_ROUND_TOWARD_NEGATIVE_INFINITY // floor
612     *
613     */
614} NppRoundMode;
615
616/**
617 * Supported image border modes
618 */
619typedef enum  
620{
621    NPP_BORDER_UNDEFINED        = 0,                    /**<  Image border type undefined. */
622    NPP_BORDER_NONE             = NPP_BORDER_UNDEFINED, /**<  Image border type none. */
623    NPP_BORDER_CONSTANT         = 1,                    /**<  Image border type constant value. */
624    NPP_BORDER_REPLICATE        = 2,                    /**<  Image border type replicate border pixels. */
625    NPP_BORDER_WRAP             = 3,                    /**<  Image border type wrap border pixels. */
626    NPP_BORDER_MIRROR           = 4                     /**<  Image border type mirror border pixels. */
627} NppiBorderType;
628
629
630/**
631 * Hints
632 */
633typedef enum {
634    NPP_ALG_HINT_NONE,      /**<  Hint none, currently these are all ignored. */
635    NPP_ALG_HINT_FAST,      /**<  Hint fast, currently these are all ignored. */
636    NPP_ALG_HINT_ACCURATE   /**<  Hint accurate, currently these are all ignored. */
637} NppHintAlgorithm;
638
639/** 
640 * Alpha composition mode controls. 
641 */
642
643typedef enum {
644    NPPI_OP_ALPHA_OVER,         /**< Alpha composition over operation. */
645    NPPI_OP_ALPHA_IN,           /**< Alpha composition in operation. */
646    NPPI_OP_ALPHA_OUT,          /**< Alpha composition out operation. */
647    NPPI_OP_ALPHA_ATOP,         /**< Alpha composition atop operation. */
648    NPPI_OP_ALPHA_XOR,          /**< Alpha composition xor operation. */
649    NPPI_OP_ALPHA_PLUS,         /**< Alpha composition plus operation. */
650    NPPI_OP_ALPHA_OVER_PREMUL,  /**< Alpha composition over premultiply operation. */
651    NPPI_OP_ALPHA_IN_PREMUL,    /**< Alpha composition in premultiply operation. */
652    NPPI_OP_ALPHA_OUT_PREMUL,   /**< Alpha composition out premultiply operation. */
653    NPPI_OP_ALPHA_ATOP_PREMUL,  /**< Alpha composition atop premultiply operation. */
654    NPPI_OP_ALPHA_XOR_PREMUL,   /**< Alpha composition xor premultiply operation. */
655    NPPI_OP_ALPHA_PLUS_PREMUL,  /**< Alpha composition plus premultiply operation. */
656    NPPI_OP_ALPHA_PREMUL        /**< Alpha composition premultiply operation. */
657} NppiAlphaOp;
658
659
660/** 
661 * The NppiHOGConfig structure defines the configuration parameters for the HOG descriptor: 
662 */
663 
664typedef struct 
665{
666    int      cellSize;             /**<  square cell size (pixels). */
667    int      histogramBlockSize;   /**<  square histogram block size (pixels). */
668    int      nHistogramBins;       /**<  required number of histogram bins. */
669    NppiSize detectionWindowSize;  /**<  detection window size (pixels). */
670} NppiHOGConfig;
671
672/**
673 * HOG Cell controls
674 */
675#define NPP_HOG_MAX_CELL_SIZE                          (16) 
676/**< max horizontal/vertical pixel size of cell.   */
677#define NPP_HOG_MAX_BLOCK_SIZE                         (64) 
678/**< max horizontal/vertical pixel size of block.  */
679#define NPP_HOG_MAX_BINS_PER_CELL                      (16) 
680/**< max number of histogram bins. */
681#define NPP_HOG_MAX_CELLS_PER_DESCRIPTOR              (256) 
682/**< max number of cells in a descriptor window.   */
683#define NPP_HOG_MAX_OVERLAPPING_BLOCKS_PER_DESCRIPTOR (256) 
684/**< max number of overlapping blocks in a descriptor window.   */
685#define NPP_HOG_MAX_DESCRIPTOR_LOCATIONS_PER_CALL     (128) 
686/**< max number of descriptor window locations per function call.   */
687
688/**
689 * Data structure for HaarClassifier_32f.
690 */
691
692typedef struct
693{
694    int      numClassifiers;    /**<  number of classifiers. */
695    Npp32s * classifiers;       /**<  packed classifier data 40 bytes each. */
696    size_t   classifierStep;    /**<  packed classifier byte step. */
697    NppiSize classifierSize;    /**<  packed classifier size. */
698    Npp32s * counterDevice;     /**<  counter device. */
699} NppiHaarClassifier_32f;
700
701/** 
702  * Data structure for Haar buffer.
703  */
704  
705typedef struct
706{
707    int      haarBufferSize;    /**<  size of the buffer */
708    Npp32s * haarBuffer;        /**<  buffer */
709    
710} NppiHaarBuffer;
711
712/**
713 * Signal sign operations
714 */
715typedef enum {
716    nppZCR,    /**<  sign change */
717    nppZCXor,  /**<  sign change XOR */
718    nppZCC     /**<  sign change count_0 */
719} NppsZCType;
720
721/**
722 * HuffMan Table controls
723 */
724typedef enum {
725    nppiDCTable,    /**<  DC Table */
726    nppiACTable,    /**<  AC Table */
727} NppiHuffmanTableType;
728
729/**
730 * Norm controls
731 */
732typedef enum {
733    nppiNormInf = 0, /**<  maximum */ 
734    nppiNormL1 = 1,  /**<  sum */
735    nppiNormL2 = 2   /**<  square root of sum of squares */
736} NppiNorm;
737
738/**
739 * Data structure of connected pixel region information.
740 */
741
742typedef struct
743{
744	NppiRect oBoundingBox; 		 /**<  x, y, width, height == left, top, right, and bottom pixel coordinates */
745	Npp32u nConnectedPixelCount; /**< total number of pixels in connected region */
746	Npp32u aSeedPixelValue[3];	 /**< original pixel value of seed pixel, 1 or 3 channel */
747} NppiConnectedRegion;
748
749/**
750 * General image descriptor. Defines the basic parameters of an image,
751 * including data pointer, step, and image size.
752 * This can be used by both source and destination images.
753 */
754typedef struct
755{
756    void *     pData;  /**< device memory pointer to the image */
757    int        nStep;  /**< step size */
758    NppiSize  oSize;   /**< width and height of the image */
759} NppiImageDescriptor;
760
761
762/**
763 * struct NppiBufferDescriptor
764 */
765typedef struct
766{
767    void *     pData;        /**< per image device memory pointer to the corresponding buffer */
768    int        nBufferSize;  /**< allocated buffer size */
769} NppiBufferDescriptor;
770
771
772/**
773 * Provides details of uniquely labeled pixel regions of interest returned 
774 * by CompressedLabelMarkersUF function. 
775 */
776typedef struct
777{
778    Npp32u nMarkerLabelPixelCount;           /**< total number of pixels in this connected pixel region */
779    Npp32u nContourPixelCount;               /**< total number of pixels in this connected pixel region contour */
780    Npp32u nContourPixelsFound;              /**< total number of pixels in this connected pixel region contour found during geometry search */
781    NppiPoint oContourFirstPixelLocation;    /**< image geometric x and y location of the first pixel in the contour */
782    NppiRect oMarkerLabelBoundingBox;        /**< bounding box of this connected pixel region expressed as leftmostX, topmostY, rightmostX, and bottommostY */
783} NppiCompressedMarkerLabelsInfo;
784
785
786/**
787 * Provides details of contour pixel grid map location and association 
788 */
789
790typedef struct
791{
792    Npp32u nMarkerLabelID;                   /**< this connected pixel region contour ID */
793    Npp32u nContourPixelCount;               /**< total number of pixels in this connected pixel region contour */
794    Npp32u nContourStartingPixelOffset;      /**< base offset of starting pixel in the overall contour pixel list */
795    Npp32u nSegmentNum;                      /**< relative block segment number within this particular contour ID */
796} NppiContourBlockSegment;
797
798
799/**
800 * Provides contour (boundary) geometry info of uniquely labeled pixel regions returned 
801 * by nppiCompressedMarkerLabelsUFInfo function in host memory in counterclockwise order relative to contour interiors. 
802 */
803typedef struct
804{
805    NppiPoint oContourOrderedGeometryLocation;                 /**< image geometry X and Y location in requested output order */
806    NppiPoint oContourPrevPixelLocation;                       /**< image geometry X and Y location of previous contour pixel */
807    NppiPoint oContourCenterPixelLocation;                     /**< image geometry X and Y location of center contour pixel */
808    NppiPoint oContourNextPixelLocation;                       /**< image geometry X and Y location of next contour pixel */
809    Npp32s nOrderIndex;                                        /**< contour pixel counterclockwise order index in geometry list */
810    Npp32s nReverseOrderIndex;                                 /**< contour pixel clockwise order index in geometry list */
811    Npp32u nFirstIndex;                                        /**< index of first ordered contour pixel in this subgroup */
812    Npp32u nLastIndex;                                         /**< index of last ordered contour pixel in this subgroup */
813    Npp32u nNextContourPixelIndex;                             /**< index of next ordered contour pixel in NppiContourPixelGeometryInfo list */
814    Npp32u nPrevContourPixelIndex;                             /**< index of previous ordered contour pixel in NppiContourPixelGeometryInfo list */
815    Npp8u nPixelAlreadyUsed;                                   /**< this test pixel is has already been used */
816    Npp8u nAlreadyLinked;                                      /**< this test pixel is already linked to center pixel */
817    Npp8u nAlreadyOutput;                                      /**< this pixel has already been output in geometry list */
818    Npp8u nContourInteriorDirection;                           /**< direction of contour region interior */
819} NppiContourPixelGeometryInfo;
820
821/**
822 * Provides contour (boundary) direction info of uniquely labeled pixel regions returned 
823 * by CompressedLabelMarkersUF function. 
824 */
825
826#define NPP_CONTOUR_DIRECTION_SOUTH_EAST    1       
827/**< Contour direction south east */
828#define NPP_CONTOUR_DIRECTION_SOUTH         2       
829/**< Contour direction south */
830#define NPP_CONTOUR_DIRECTION_SOUTH_WEST    4       
831/**< Contour direction south west */
832#define NPP_CONTOUR_DIRECTION_WEST          8       
833/**< Contour direction west */
834#define NPP_CONTOUR_DIRECTION_EAST         16       
835/**< Contour direction east */
836#define NPP_CONTOUR_DIRECTION_NORTH_EAST   32       
837/**< Contour direction north east */
838#define NPP_CONTOUR_DIRECTION_NORTH        64       
839/**< Contour direction north */
840#define NPP_CONTOUR_DIRECTION_NORTH_WEST  128       
841/**< Contour direction north west */
842
843/**
844 * Provides contour (boundary) diagonal direction info of uniquely labeled pixel regions returned 
845 * by CompressedLabelMarkersUF function. 
846 */
847#define NPP_CONTOUR_DIRECTION_ANY_NORTH  NPP_CONTOUR_DIRECTION_NORTH_EAST | NPP_CONTOUR_DIRECTION_NORTH | NPP_CONTOUR_DIRECTION_NORTH_WEST  
848/**< Contour direction any north */
849#define NPP_CONTOUR_DIRECTION_ANY_WEST   NPP_CONTOUR_DIRECTION_NORTH_WEST | NPP_CONTOUR_DIRECTION_WEST | NPP_CONTOUR_DIRECTION_SOUTH_WEST   
850/**< Contour direction any west */
851#define NPP_CONTOUR_DIRECTION_ANY_SOUTH  NPP_CONTOUR_DIRECTION_SOUTH_EAST | NPP_CONTOUR_DIRECTION_SOUTH | NPP_CONTOUR_DIRECTION_SOUTH_WEST  
852/**< Contour direction any south */
853#define NPP_CONTOUR_DIRECTION_ANY_EAST   NPP_CONTOUR_DIRECTION_NORTH_EAST | NPP_CONTOUR_DIRECTION_EAST | NPP_CONTOUR_DIRECTION_SOUTH_EAST   
854/**< Contour direction any east */
855
856/** 
857 * Data structure for contour pixel direction information.
858 */
859typedef struct
860{
861    Npp32u  nMarkerLabelID;                         /**< MarkerLabelID of contour interior connected region */
862    Npp8u nContourDirectionCenterPixel;             /**< provides current center contour pixel input and output direction info */
863    Npp8u nContourInteriorDirectionCenterPixel;     /**< provides current center contour pixel region interior direction info */
864    Npp8u nConnected;                               /**< direction to directly connected contour pixels, 0 if not connected */
865    Npp8u nGeometryInfoIsValid;                     /**< direction to directly connected contour pixels, 0 if not connected */
866    NppiContourPixelGeometryInfo oContourPixelGeometryInfo; /**< Pixel geometry info structure */
867    NppiPoint nEast1;                               /**< Pixel coordinate values in each direction */
868    NppiPoint nNorthEast1;                          /**< Pixel coordinate values in each direction */
869    NppiPoint nNorth1;                              /**< Pixel coordinate values in each direction */
870    NppiPoint nNorthWest1;                          /**< Pixel coordinate values in each direction */
871    NppiPoint nWest1;                               /**< Pixel coordinate values in each direction */
872    NppiPoint nSouthWest1;                          /**< Pixel coordinate values in each direction */
873    NppiPoint nSouth1;                              /**< Pixel coordinate values in each direction */
874    NppiPoint nSouthEast1;                          /**< Pixel coordinate values in each direction */
875    Npp8u nTest1EastConnected;                      /**< East connected flag */
876    Npp8u nTest1NorthEastConnected;                 /**< North east connected flag */
877    Npp8u nTest1NorthConnected;                     /**< North connected flag */
878    Npp8u nTest1NorthWestConnected;                 /**< North west connected flag */
879    Npp8u nTest1WestConnected;                      /**< West connected flag */
880    Npp8u nTest1SouthWestConnected;                 /**< South west connected flag */
881    Npp8u nTest1SouthConnected;                     /**< South connected flag */
882    Npp8u nTest1SouthEastConnected;                 /**< South east connected flag */
883} NppiContourPixelDirectionInfo;
884
885/** 
886 * Data structure for contour total counts.
887 */
888typedef struct
889{
890    Npp32u nTotalImagePixelContourCount;    /**< total number of contour pixels in image */
891    Npp32u nLongestImageContourPixelCount;  /**< longest per contour pixel count in image */
892} NppiContourTotalsInfo;
893
894
895/**
896 * Provides control of the type of segment boundaries, if any, added 
897 * to the image generated by the watershed segmentation function. 
898 */
899
900typedef enum 
901{
902    NPP_WATERSHED_SEGMENT_BOUNDARIES_NONE,      /**< Image watershed segment boundary type none. */
903    NPP_WATERSHED_SEGMENT_BOUNDARIES_BLACK,     /**< Image watershed segment boundary type black. */
904    NPP_WATERSHED_SEGMENT_BOUNDARIES_WHITE,     /**< Image watershed segment boundary type white. */
905    NPP_WATERSHED_SEGMENT_BOUNDARIES_CONTRAST,  /**< Image watershed segment boundary type contrasting intensiity. */
906    NPP_WATERSHED_SEGMENT_BOUNDARIES_ONLY       /**< Image watershed segment boundary type render boundaries only. */
907} NppiWatershedSegmentBoundaryType;
908
909    
910/** 
911 * \section application_managed_stream_context Application Managed Stream Context
912 * NPP stream context structure must be filled in by application. 
913 * Application should not initialize or alter reserved fields. 
914 * 
915 */
916typedef struct
917{
918    cudaStream_t hStream;                   /**<  From current Cuda stream ID. */
919    int nCudaDeviceId;                      /**<  From cudaGetDevice(). */
920    int nMultiProcessorCount;               /**<  From cudaGetDeviceProperties(). */
921    int nMaxThreadsPerMultiProcessor;       /**<  From cudaGetDeviceProperties(). */
922    int nMaxThreadsPerBlock;                /**<  From cudaGetDeviceProperties(). */
923    size_t nSharedMemPerBlock;              /**<  From cudaGetDeviceProperties(). */
924    int nCudaDevAttrComputeCapabilityMajor; /**<  From cudaGetDeviceAttribute(). */
925    int nCudaDevAttrComputeCapabilityMinor; /**<  From cudaGetDeviceAttribute(). */
926    unsigned int nStreamFlags;              /**<  From cudaStreamGetFlags(). */
927    int nReserved0;                         /**<  reserved, do not alter. */                         
928} NppStreamContext;
929
930/** 
931 * NPP Batch Geometry Structure Definitions. 
932 */
933typedef struct
934{
935    const void * pSrc;  /**< source image device memory pointer. */
936    int nSrcStep;       /**< source image byte count per row. */
937    void * pDst;        /**< destination image device memory pointer. */
938    int nDstStep;       /**< device image byte count per row. */
939} NppiResizeBatchCXR;
940
941/**
942 * Data structure for variable ROI image batch resizing.
943 * 
944 */
945typedef struct
946{
947    NppiRect oSrcRectROI;   /**< per source image rectangle parameters. */    
948    NppiRect oDstRectROI;   /**< per destination image rectangle parameters. */
949} NppiResizeBatchROI_Advanced; 
950 
951/**
952 * Data structure for batched nppiMirrorBatch.
953 */
954typedef struct
955{
956    const void * pSrc;  /**< source image device memory pointer, ignored for in-place versions. */
957    int nSrcStep;       /**< source image byte count per row. */
958    void * pDst;        /**< destination image device memory pointer. */
959    int nDstStep;       /**< device image byte count per row. */
960} NppiMirrorBatchCXR;
961
962/**
963 * Data structure for batched nppiWarpAffineBatch.
964 */
965typedef struct
966{
967    const void * pSrc;  /**< source image device memory pointer. */
968    int nSrcStep;       /**< source image byte count per row. */
969    void * pDst;        /**< destination image device memory pointer. */
970    int nDstStep;       /**< device image byte count per row. */
971    Npp64f * pCoeffs;   /**< device memory pointer to the tranformation matrix with double precision floating-point coefficient values to be used for this image. */
972    Npp64f aTransformedCoeffs[2][3]; /**< FOR INTERNAL USE, DO NOT INITIALIZE.  */
973} NppiWarpAffineBatchCXR;
974
975/**
976 * Data structure for batched nppiWarpPerspectiveBatch.
977 */
978typedef struct
979{
980    const void * pSrc;  /**< source image device memory pointer. */
981    int nSrcStep;       /**< source image byte count per row. */
982    void * pDst;        /**< destination image device memory pointer. */
983    int nDstStep;       /**< device image byte count per row. */
984    Npp64f * pCoeffs;   /**< device memory pointer to the tranformation matrix with double precision floating-point coefficient values to be used for this image. */
985    Npp64f aTransformedCoeffs[3][3]; /**< FOR INTERNAL USE, DO NOT INITIALIZE.  */
986} NppiWarpPerspectiveBatchCXR;
987
988
989/**
990 * Data structure for batched nppiColorTwistBatch.
991 */
992typedef struct
993{
994    const void * pSrc;  /**< source image device memory pointer. */
995    int nSrcStep;       /**< source image byte count per row. */
996    void * pDst;        /**< destination image device memory pointer. */
997    int nDstStep;       /**< device image byte count per row. */
998    Npp32f * pTwist;    /**< device memory pointer to the color twist matrix with floating-point coefficient values to be used for this image. */
999} NppiColorTwistBatchCXR;
1000
1001
1002
1003#ifdef __cplusplus
1004#ifndef NPP_PLUS
1005} /* extern "C" */
1006#endif
1007#endif
1008
1009/*@}*/
1010 
1011#endif /* NV_NPPIDEFS_H */
1012
1013 
codekingpro/portable-devtools · Team Ai