My Project
defines.h
Go to the documentation of this file.
1 /*******************************************************
2  * Copyright (c) 2014, ArrayFire
3  * All rights reserved.
4  *
5  * This file is distributed under 3-clause BSD license.
6  * The complete license agreement can be obtained at:
7  * http://arrayfire.com/licenses/BSD-3-Clause
8  ********************************************************/
9 
10 #pragma once
11 
12 #if defined(_WIN32) || defined(_MSC_VER)
13  // http://msdn.microsoft.com/en-us/library/b0084kay(v=VS.80).aspx
14  // http://msdn.microsoft.com/en-us/library/3y1sfaz2%28v=VS.80%29.aspx
15  #ifdef AFDLL // libaf
16  #define AFAPI __declspec(dllexport)
17  #else
18  #define AFAPI __declspec(dllimport)
19  #endif
20 
21  // bool
22  #ifndef __cplusplus
23  #define bool unsigned char
24  #define false 0
25  #define true 1
26  #endif
27  #define __PRETTY_FUNCTION__ __FUNCSIG__
28  #define SIZE_T_FRMT_SPECIFIER "%Iu"
29  #define AF_DEPRECATED(msg) __declspec(deprecated( msg ))
30 #else
31  #define AFAPI __attribute__((visibility("default")))
32  #include <stdbool.h>
33  #define SIZE_T_FRMT_SPECIFIER "%zu"
34 #if __GNUC__ >= 4 && __GNUC_MINOR > 4
35  #define AF_DEPRECATED(msg) __attribute__((deprecated( msg )))
36 #else
37  #define AF_DEPRECATED(msg) __attribute__((deprecated))
38 #endif
39 
40 #endif
41 
42 // Known 64-bit x86 and ARM architectures use long long
43 #if defined(__x86_64__) || defined(_M_X64) || defined(_WIN64) || defined(__aarch64__) || defined(__LP64__) // 64-bit Architectures
44  typedef long long dim_t;
45 // Known 32-bit x86 and ARM architectures use int
46 #elif defined(__i386__) || defined(_M_IX86) || defined(__arm__) || defined(_M_ARM) // 32-bit x86 Architecture
47  typedef int dim_t;
48 // All other platforms use long long
49 #else
50  typedef long long dim_t;
51 #endif
52 
53 #include <stdlib.h>
54 
55 #ifndef AFDLL // prevents the use of these types internally
56 typedef AF_DEPRECATED("intl is deprecated. Use long long instead.") long long intl;
57 typedef AF_DEPRECATED("uintl is deprecated. Use unsigned long long instead.") unsigned long long uintl;
58 #endif
59 
60 #include <af/version.h>
61 #ifndef AF_API_VERSION
62 #define AF_API_VERSION AF_API_VERSION_CURRENT
63 #endif
64 
65 typedef enum {
70 
71  // 100-199 Errors in environment
72 
76  , AF_ERR_NO_MEM = 101
77 
81  , AF_ERR_DRIVER = 102
82 
87 
88  // 200-299 Errors in input parameters
89 
94 
98  , AF_ERR_ARG = 202
99 
103  , AF_ERR_SIZE = 203
104 
108  , AF_ERR_TYPE = 204
109 
114 
118  , AF_ERR_BATCH = 207
119 
120 
121 #if AF_API_VERSION >= 33
122  , AF_ERR_DEVICE = 208
126 #endif
127 
128  // 300-399 Errors for missing software features
129 
134 
139 
140 #if AF_API_VERSION >= 32
141  , AF_ERR_NONFREE = 303
145 #endif
146 
147  // 400-499 Errors for missing hardware features
148 
153 
159 
160  // 500-599 Errors specific to heterogenous API
161 
162 #if AF_API_VERSION >= 32
163  , AF_ERR_LOAD_LIB = 501
167 #endif
168 
169 #if AF_API_VERSION >= 32
170  , AF_ERR_LOAD_SYM = 502
174 #endif
175 
176 #if AF_API_VERSION >= 32
181 #endif
182 
183  // 900-999 Errors from upstream libraries and runtimes
184 
190 
195 } af_err;
196 
197 typedef enum {
198  f32,
199  c32,
200  f64,
201  c64,
202  b8 ,
203  s32,
204  u32,
205  u8 ,
206  s64,
208 #if AF_API_VERSION >= 32
209  , s16
210 #endif
211 #if AF_API_VERSION >= 32
212  , u16
213 #endif
214 } af_dtype;
215 
216 typedef enum {
219 } af_source;
220 
221 #define AF_MAX_DIMS 4
222 
223 // A handle for an internal array object
224 typedef void * af_array;
225 
226 typedef enum {
232 #if AF_API_VERSION >= 34
234 #endif
235 #if AF_API_VERSION >= 34
237 #endif
238 #if AF_API_VERSION >= 34
240 #endif
241 #if AF_API_VERSION >= 34
243 #endif
244 #if AF_API_VERSION >= 34
246 #endif
247 
249 
250 typedef enum {
255 
260 
266 
267 typedef enum {
272 
278 
279 typedef enum {
280 
285 
290 } af_conv_mode;
291 
292 typedef enum {
297 
298 typedef enum {
299  AF_SAD = 0,
308 } af_match_type;
309 
310 #if AF_API_VERSION >= 31
311 typedef enum {
312  AF_YCC_601 = 601,
313  AF_YCC_709 = 709,
314  AF_YCC_2020 = 2020
315 } af_ycc_std;
316 #endif
317 
318 typedef enum {
319  AF_GRAY = 0,
322 #if AF_API_VERSION >= 31
324 #endif
325 } af_cspace_t;
326 
327 typedef enum {
335  AF_MAT_SYM = 512,
336  AF_MAT_POSDEF = 1024,
337  AF_MAT_ORTHOG = 2048,
340 } af_mat_prop;
341 
342 typedef enum {
351 
353 } af_norm_type;
354 
355 #if AF_API_VERSION >= 31
356 typedef enum {
361  AF_FIF_PNG = 13,
362  AF_FIF_PPM = 14,
364  AF_FIF_TIFF = 18,
365  AF_FIF_PSD = 20,
366  AF_FIF_HDR = 26,
367  AF_FIF_EXR = 29,
368  AF_FIF_JP2 = 31,
371 #endif
372 
373 #if AF_API_VERSION >=34
374 typedef enum {
381 #endif
382 
383 #if AF_API_VERSION >= 32
384 typedef enum {
388 #endif
389 
390 #if AF_API_VERSION >= 32
391 // These enums should be 2^x
392 typedef enum {
397 } af_backend;
398 #endif
399 
400 // Below enum is purely added for example purposes
401 // it doesn't and shoudn't be used anywhere in the
402 // code. No Guarantee's provided if it is used.
403 typedef enum {
404  AF_ID = 0
405 } af_someenum_t;
406 
407 #if AF_API_VERSION >=34
408 typedef enum {
413 } af_binary_op;
414 #endif
415 
416 #if AF_API_VERSION >=34
417 typedef enum {
418  AF_RANDOM_ENGINE_PHILOX_4X32_10 = 100, //Philox variant with N = 4, W = 32 and Rounds = 10
419  AF_RANDOM_ENGINE_THREEFRY_2X32_16 = 200, //Threefry variant with N = 2, W = 32 and Rounds = 16
420  AF_RANDOM_ENGINE_MERSENNE_GP11213 = 300, //Mersenne variant with MEXP = 11213
426 #endif
427 
429 // FORGE / Graphics Related Enums
430 // These enums have values corresponsding to Forge enums in forge defines.h
432 typedef enum {
444 } af_colormap;
445 
446 #if AF_API_VERSION >= 32
447 typedef enum {
457 #endif
458 
460 #if AF_API_VERSION >= 35
461 typedef enum {
465 #endif
466 
467 #if AF_API_VERSION >= 34
468 typedef enum {
473 } af_storage;
474 #endif
475 
476 #if AF_API_VERSION >= 36
477 typedef enum {
482 
483 typedef enum {
488 
489 typedef enum {
494 
495 #endif
496 
497 #ifdef __cplusplus
498 namespace af
499 {
500  typedef af_dtype dtype;
501  typedef af_source source;
507  typedef af_someenum_t SomeEnum; // Purpose of Addition: How to add Function example
514 #if AF_API_VERSION >= 31
516 #endif
517 #if AF_API_VERSION >= 31
519 #endif
520 #if AF_API_VERSION >= 32
522 #endif
523 #if AF_API_VERSION >= 32
525 #endif
526 #if AF_API_VERSION >= 34
528 #endif
529 #if AF_API_VERSION >= 34
531 #endif
532 #if AF_API_VERSION >= 34
534 #endif
535 #if AF_API_VERSION >= 34
537 #endif
538 #if AF_API_VERSION >= 35
540 #endif
541 #if AF_API_VERSION >= 36
545 #endif
546 }
547 
548 #endif
af_canny_threshold
Definition: defines.h:461
af_source source
Definition: defines.h:501
af_random_engine_type
Definition: defines.h:417
Determine canny algorithm thresholds using Otsu algorithm.
Definition: defines.h:463
Gradient diffusion equation.
Definition: defines.h:484
af_flux_function
Definition: defines.h:477
af_ycc_std
Definition: defines.h:311
Matrix is symmetric.
Definition: defines.h:335
returns the max singular value). Currently NOT SUPPORTED
Definition: defines.h:349
Match based on Sum of Squared Differences (SSD)
Definition: defines.h:302
af_someenum_t SomeEnum
Definition: defines.h:507
af_backend
Definition: defines.h:392
af_colormap ColorMap
Definition: defines.h:512
Cubic Interpolation.
Definition: defines.h:230
Matrix is orthogonal.
Definition: defines.h:337
Linear Interpolation.
Definition: defines.h:228
Definition: algorithm.h:14
Out of bound values are clamped to the edge.
Definition: defines.h:264
Definition: defines.h:404
Device pointer.
Definition: defines.h:217
FreeImage Enum for RAW Camera Image File.
Definition: defines.h:369
Perceptually uniform shades of black-red-yellow.
Definition: defines.h:440
FreeImage Enum for JPEG Network Graphics File.
Definition: defines.h:360
CPU a.k.a sequential algorithms.
Definition: defines.h:394
af_topk_function topkFunction
Definition: defines.h:544
The function returned successfully.
Definition: defines.h:69
af_norm_type
Definition: defines.h:342
af_border_type
Definition: defines.h:250
ITU-R BT.709 standard.
Definition: defines.h:313
Output of the convolution is signal_len + filter_len - 1.
Definition: defines.h:289
af_canny_threshold cannyThreshold
Definition: defines.h:539
FreeImage Enum for Bitmap File.
Definition: defines.h:357
Blue hue map.
Definition: defines.h:439
Matrix is upper triangular.
Definition: defines.h:332
Bilinear Interpolation with cosine smoothing.
Definition: defines.h:236
3-channel YCbCr
Definition: defines.h:323
#define AF_DEPRECATED(msg)
Definition: defines.h:37
Matrix diagonal contains unitary values.
Definition: defines.h:334
Output of the convolution is the same size as input.
Definition: defines.h:284
Mood map.
Definition: defines.h:437
32-bit signed integral values
Definition: defines.h:203
af_ycc_std YCCStd
Definition: defines.h:515
af_diffusion_eq diffusionEq
Definition: defines.h:543
Matrix is positive definite.
Definition: defines.h:336
FreeImage Enum for Windows Icon File.
Definition: defines.h:358
Default backend order: OpenCL -> CUDA -> CPU.
Definition: defines.h:393
CUDA Compute Backend.
Definition: defines.h:395
Match based on Zero mean SAD.
Definition: defines.h:300
User has to define canny thresholds manually.
Definition: defines.h:462
64-bit signed integral values
Definition: defines.h:206
16-bit signed integral values
Definition: defines.h:209
Match based on Zero mean SSD.
Definition: defines.h:303
Grayscale.
Definition: defines.h:319
Bicubic Interpolation with Catmull-Rom splines.
Definition: defines.h:245
Match based on Zero mean NCC.
Definition: defines.h:306
16-bit unsigned integral values
Definition: defines.h:212
af_backend Backend
Definition: defines.h:521
Default.
Definition: defines.h:328
af_interp_type
Definition: defines.h:226
Match based on Locally scaled SSD.
Definition: defines.h:304
Perceptually uniform shades of blue-red-yellow.
Definition: defines.h:442
af_binary_op binaryOp
Definition: defines.h:533
Bicubic Interpolation.
Definition: defines.h:239
af_random_engine_type randomEngineType
Definition: defines.h:536
FreeImage Enum for JPEG File.
Definition: defines.h:359
Data needs to be conjugate tansposed.
Definition: defines.h:330
64-bit complex floating point values
Definition: defines.h:200
Match based on Normalized Cross Correlation (NCC)
Definition: defines.h:305
treats the input as a vector and returns the p-norm
Definition: defines.h:346
af_storage
Definition: defines.h:468
af_image_format imageFormat
Definition: defines.h:518
af_homography_type
Definition: defines.h:384
af_conv_domain
Definition: defines.h:292
FreeImage Enum for Adobe Photoshop File.
Definition: defines.h:365
af_colormap
Definition: defines.h:432
Computes homography using Least Median of Squares.
Definition: defines.h:386
Data needs to be conjugate.
Definition: defines.h:331
return the max of row sums
Definition: defines.h:348
FreeImage Enum for Portable Pixelmap (ASCII) File.
Definition: defines.h:362
Out of bound values are symmetric over the edge.
Definition: defines.h:259
Storage type is CSC.
Definition: defines.h:471
Spectrum map (390nm-830nm, in sRGB colorspace)
Definition: defines.h:434
3-channel HSV
Definition: defines.h:321
af_connectivity
Definition: defines.h:267
Computes homography using RANSAC.
Definition: defines.h:385
returns Lpq-norm
Definition: defines.h:350
FreeImage Enum for JPEG-2000 File.
Definition: defines.h:368
af_err
Definition: defines.h:65
Match based on Locally scaled SAD.
Definition: defines.h:301
af_source
Definition: defines.h:216
Connectivity includes neighbors, North, East, South and West of current pixel.
Definition: defines.h:271
64-bit unsigned integral values
Definition: defines.h:207
af_someenum_t
Definition: defines.h:403
af_conv_mode
Definition: defines.h:279
Storage type is CSR.
Definition: defines.h:470
af_storage storage
Definition: defines.h:530
ITU-R BT.601 (formerly CCIR 601) standard.
Definition: defines.h:312
Out of bound values are 0.
Definition: defines.h:254
Bilinear Interpolation.
Definition: defines.h:229
Storage type is COO.
Definition: defines.h:472
64-bit complex floating point values
Definition: defines.h:201
long long dim_t
Definition: defines.h:50
OpenCL Compute Backend.
Definition: defines.h:396
af_marker_type
Definition: defines.h:447
af_diffusion_eq
Definition: defines.h:483
Cubic Interpolation with Catmull-Rom splines.
Definition: defines.h:242
FreeImage Enum for Tagged Image File Format File.
Definition: defines.h:364
ArrayFire automatically picks the right convolution algorithm.
Definition: defines.h:293
32-bit complex floating point values
Definition: defines.h:199
af_mat_prop matProp
Definition: defines.h:511
af_norm_type normType
Definition: defines.h:513
treats the input as a vector and returns the max of absolute values
Definition: defines.h:344
Matrix is block diagonal.
Definition: defines.h:339
Connectivity includes 4-connectivity neigbors and also those on Northeast, Northwest,...
Definition: defines.h:276
af_conv_domain convDomain
Definition: defines.h:510
af_topk_function
Definition: defines.h:489
The default. Same as AF_NORM_VECTOR_2.
Definition: defines.h:352
Modified curvature diffusion equation.
Definition: defines.h:485
Top k max values.
Definition: defines.h:491
8-bit unsigned integral values
Definition: defines.h:205
af_border_type borderType
Definition: defines.h:503
FreeImage Enum for ILM OpenEXR File.
Definition: defines.h:367
Perform convolution in spatial domain.
Definition: defines.h:294
af_binary_op
Definition: defines.h:408
Perform convolution in frequency domain.
Definition: defines.h:295
Match based on Sum of Hamming Distances (SHD)
Definition: defines.h:307
Match based on Sum of Absolute Differences (SAD)
Definition: defines.h:299
Data needs to be transposed.
Definition: defines.h:329
return the max of column sums
Definition: defines.h:347
af_mat_prop trans
Definition: defines.h:508
Nearest Interpolation.
Definition: defines.h:227
unsigned long long uintl
Definition: defines.h:57
Perceptually uniform shades of blue-green-yellow.
Definition: defines.h:443
3-channel RGB
Definition: defines.h:320
af_mat_prop
Definition: defines.h:327
Linear Interpolation with cosine smoothing.
Definition: defines.h:233
Exponential flux function.
Definition: defines.h:479
32-bit unsigned integral values
Definition: defines.h:204
FreeImage Enum for High Dynamic Range File.
Definition: defines.h:366
af_cspace_t
Definition: defines.h:318
Default grayscale map.
Definition: defines.h:433
Default option is same as AF_DIFFUSION_GRAD.
Definition: defines.h:486
Matrix is lower triangular.
Definition: defines.h:333
FreeImage Enum for Portable Network Graphics File.
Definition: defines.h:361
FreeImage Enum for Portable Pixelmap (Binary) File.
Definition: defines.h:363
void * af_array
Definition: defines.h:224
Perceptually uniform shades of black-red-white.
Definition: defines.h:441
af_image_format
Definition: defines.h:356
af_match_type matchType
Definition: defines.h:505
af_moment_type
Definition: defines.h:374
Matrix is tri diagonal.
Definition: defines.h:338
Top k min values.
Definition: defines.h:490
af_cspace_t CSpace
Definition: defines.h:506
32-bit floating point values
Definition: defines.h:198
treats the input as a vector and returns euclidean norm
Definition: defines.h:345
Heat map.
Definition: defines.h:438
af_flux_function fluxFunction
Definition: defines.h:542
treats the input as a vector and returns the sum of absolute values
Definition: defines.h:343
8-bit boolean values
Definition: defines.h:202
Default option (max)
Definition: defines.h:492
Floor Indexed.
Definition: defines.h:231
Storage type is dense.
Definition: defines.h:469
Host pointer.
Definition: defines.h:218
Quadratic flux function.
Definition: defines.h:478
af_marker_type markerType
Definition: defines.h:524
af_dtype
Definition: defines.h:197
af_interp_type interpType
Definition: defines.h:502
af_match_type
Definition: defines.h:298
Red hue map.
Definition: defines.h:436
af_moment_type momentType
Definition: defines.h:527
af_conv_mode convMode
Definition: defines.h:509
af_dtype dtype
Definition: defines.h:500
long long intl
Definition: defines.h:56
Colors, aka. Rainbow.
Definition: defines.h:435
Default flux function is exponential.
Definition: defines.h:480
af_connectivity connectivity
Definition: defines.h:504
ITU-R BT.2020 standard.
Definition: defines.h:314