defines.h (2018-11-19 17:22:56 +0530, (build dc38ef13))
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 typedef long long intl;
56 typedef unsigned long long uintl;
57 
58 #include <af/version.h>
59 #ifndef AF_API_VERSION
60 #define AF_API_VERSION AF_API_VERSION_CURRENT
61 #endif
62 
63 typedef enum {
68 
69  // 100-199 Errors in environment
70 
75 
80 
85 
86  // 200-299 Errors in input parameters
87 
92 
96  AF_ERR_ARG = 202,
97 
101  AF_ERR_SIZE = 203,
102 
106  AF_ERR_TYPE = 204,
107 
112 
117 
118 
119 #if AF_API_VERSION >= 33
120  AF_ERR_DEVICE = 208,
124 #endif
125 
126  // 300-399 Errors for missing software features
127 
132 
137 
138 #if AF_API_VERSION >= 32
139  AF_ERR_NONFREE = 303,
143 #endif
144 
145  // 400-499 Errors for missing hardware features
146 
151 
157 
158  // 500-599 Errors specific to heterogenous API
159 
160 #if AF_API_VERSION >= 32
161  AF_ERR_LOAD_LIB = 501,
165 #endif
166 
167 #if AF_API_VERSION >= 32
168  AF_ERR_LOAD_SYM = 502,
172 #endif
173 
174 #if AF_API_VERSION >= 32
179 #endif
180 
181  // 900-999 Errors from upstream libraries and runtimes
182 
188 
193 } af_err;
194 
195 typedef enum {
196  f32,
197  c32,
198  f64,
199  c64,
200  b8 ,
201  s32,
202  u32,
203  u8 ,
204  s64,
205  u64,
206 #if AF_API_VERSION >= 32
207  s16,
208 #endif
209 #if AF_API_VERSION >= 32
210  u16,
211 #endif
212 } af_dtype;
213 
214 typedef enum {
217 } af_source;
218 
219 #define AF_MAX_DIMS 4
220 
221 // A handle for an internal array object
222 typedef void * af_array;
223 
224 typedef enum {
230 #if AF_API_VERSION >= 34
232 #endif
233 #if AF_API_VERSION >= 34
235 #endif
236 #if AF_API_VERSION >= 34
238 #endif
239 #if AF_API_VERSION >= 34
241 #endif
242 #if AF_API_VERSION >= 34
244 #endif
245 
247 
248 typedef enum {
253 
258 
264 
265 typedef enum {
270 
276 
277 typedef enum {
278 
283 
288 } af_conv_mode;
289 
290 typedef enum {
295 
296 typedef enum {
297  AF_SAD = 0,
306 } af_match_type;
307 
308 #if AF_API_VERSION >= 31
309 typedef enum {
310  AF_YCC_601 = 601,
311  AF_YCC_709 = 709,
312  AF_YCC_2020 = 2020
313 } af_ycc_std;
314 #endif
315 
316 typedef enum {
317  AF_GRAY = 0,
320 #if AF_API_VERSION >= 31
322 #endif
323 } af_cspace_t;
324 
325 typedef enum {
333  AF_MAT_SYM = 512,
334  AF_MAT_POSDEF = 1024,
335  AF_MAT_ORTHOG = 2048,
338 } af_mat_prop;
339 
340 typedef enum {
349 
351 } af_norm_type;
352 
353 #if AF_API_VERSION >= 31
354 typedef enum {
359  AF_FIF_PNG = 13,
360  AF_FIF_PPM = 14,
362  AF_FIF_TIFF = 18,
363  AF_FIF_PSD = 20,
364  AF_FIF_HDR = 26,
365  AF_FIF_EXR = 29,
366  AF_FIF_JP2 = 31,
369 #endif
370 
371 #if AF_API_VERSION >=34
372 typedef enum {
379 #endif
380 
381 #if AF_API_VERSION >= 32
382 typedef enum {
386 #endif
387 
388 #if AF_API_VERSION >= 32
389 // These enums should be 2^x
390 typedef enum {
395 } af_backend;
396 #endif
397 
398 // Below enum is purely added for example purposes
399 // it doesn't and shoudn't be used anywhere in the
400 // code. No Guarantee's provided if it is used.
401 typedef enum {
402  AF_ID = 0
403 } af_someenum_t;
404 
405 #if AF_API_VERSION >=34
406 typedef enum {
411 } af_binary_op;
412 #endif
413 
414 #if AF_API_VERSION >=34
415 typedef enum {
416  AF_RANDOM_ENGINE_PHILOX_4X32_10 = 100, //Philox variant with N = 4, W = 32 and Rounds = 10
417  AF_RANDOM_ENGINE_THREEFRY_2X32_16 = 200, //Threefry variant with N = 2, W = 32 and Rounds = 16
418  AF_RANDOM_ENGINE_MERSENNE_GP11213 = 300, //Mersenne variant with MEXP = 11213
424 #endif
425 
427 // FORGE / Graphics Related Enums
428 // These enums have values corresponsding to Forge enums in forge defines.h
430 typedef enum {
442 } af_colormap;
443 
444 #if AF_API_VERSION >= 32
445 typedef enum {
455 #endif
456 
458 #if AF_API_VERSION >= 35
459 typedef enum {
463 #endif
464 
465 #if AF_API_VERSION >= 34
466 typedef enum {
471 } af_storage;
472 #endif
473 
474 #if AF_API_VERSION >= 36
475 typedef enum {
480 
481 typedef enum {
486 
487 typedef enum {
492 #endif
493 
494 #ifdef __cplusplus
495 namespace af
496 {
497  typedef af_dtype dtype;
498  typedef af_source source;
504  typedef af_someenum_t SomeEnum; // Purpose of Addition: How to add Function example
511 #if AF_API_VERSION >= 31
513 #endif
514 #if AF_API_VERSION >= 31
516 #endif
517 #if AF_API_VERSION >= 32
519 #endif
520 #if AF_API_VERSION >= 32
522 #endif
523 #if AF_API_VERSION >= 34
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 >= 35
537 #endif
538 #if AF_API_VERSION >= 36
542 #endif
543 }
544 
545 #endif
af_canny_threshold
Definition: defines.h:459
The system or device ran out of memory.
Definition: defines.h:74
af_source source
Definition: defines.h:498
af_random_engine_type
Definition: defines.h:415
Determine canny algorithm thresholds using Otsu algorithm.
Definition: defines.h:461
Gradient diffusion equation.
Definition: defines.h:482
af_flux_function
Definition: defines.h:475
af_ycc_std
Definition: defines.h:309
Matrix is symmetric.
Definition: defines.h:333
returns the max singular value). Currently NOT SUPPORTED
Definition: defines.h:347
Match based on Sum of Squared Differences (SSD)
Definition: defines.h:300
af_someenum_t SomeEnum
Definition: defines.h:504
af_backend
Definition: defines.h:390
af_colormap ColorMap
Definition: defines.h:509
Cubic Interpolation.
Definition: defines.h:228
Matrix is orthogonal.
Definition: defines.h:335
Linear Interpolation.
Definition: defines.h:226
Definition: algorithm.h:14
Out of bound values are clamped to the edge.
Definition: defines.h:262
Definition: defines.h:402
Device pointer.
Definition: defines.h:215
FreeImage Enum for RAW Camera Image File.
Definition: defines.h:367
Perceptually uniform shades of black-red-yellow.
Definition: defines.h:438
FreeImage Enum for JPEG Network Graphics File.
Definition: defines.h:358
CPU a.k.a sequential algorithms.
Definition: defines.h:392
af_topk_function topkFunction
Definition: defines.h:541
The function returned successfully.
Definition: defines.h:67
af_norm_type
Definition: defines.h:340
af_border_type
Definition: defines.h:248
ITU-R BT.709 standard.
Definition: defines.h:311
The type of the input arrays are not compatible.
Definition: defines.h:111
Output of the convolution is signal_len + filter_len - 1.
Definition: defines.h:287
af_canny_threshold cannyThreshold
Definition: defines.h:536
FreeImage Enum for Bitmap File.
Definition: defines.h:355
Blue hue map.
Definition: defines.h:437
Matrix is upper triangular.
Definition: defines.h:330
Bilinear Interpolation with cosine smoothing.
Definition: defines.h:234
3-channel YCbCr
Definition: defines.h:321
Matrix diagonal contains unitary values.
Definition: defines.h:332
Output of the convolution is the same size as input.
Definition: defines.h:282
Mood map.
Definition: defines.h:435
32-bit signed integral values
Definition: defines.h:201
Function does not support GFOR / batch mode.
Definition: defines.h:116
af_ycc_std YCCStd
Definition: defines.h:512
af_diffusion_eq diffusionEq
Definition: defines.h:540
Matrix is positive definite.
Definition: defines.h:334
The option is not supported.
Definition: defines.h:131
FreeImage Enum for Windows Icon File.
Definition: defines.h:356
Default backend order: OpenCL -> CUDA -> CPU.
Definition: defines.h:391
CUDA Compute Backend.
Definition: defines.h:393
Match based on Zero mean SAD.
Definition: defines.h:298
User has to define canny thresholds manually.
Definition: defines.h:460
64-bit signed integral values
Definition: defines.h:204
16-bit signed integral values
Definition: defines.h:207
Match based on Zero mean SSD.
Definition: defines.h:301
Grayscale.
Definition: defines.h:317
Bicubic Interpolation with Catmull-Rom splines.
Definition: defines.h:243
Match based on Zero mean NCC.
Definition: defines.h:304
16-bit unsigned integral values
Definition: defines.h:210
af_backend Backend
Definition: defines.h:518
Default.
Definition: defines.h:326
af_interp_type
Definition: defines.h:224
Match based on Locally scaled SSD.
Definition: defines.h:302
Perceptually uniform shades of blue-red-yellow.
Definition: defines.h:440
af_binary_op binaryOp
Definition: defines.h:530
Bicubic Interpolation.
Definition: defines.h:237
af_random_engine_type randomEngineType
Definition: defines.h:533
FreeImage Enum for JPEG File.
Definition: defines.h:357
Data needs to be conjugate tansposed.
Definition: defines.h:328
64-bit complex floating point values
Definition: defines.h:198
There was an error when loading the symbols.
Definition: defines.h:171
Match based on Normalized Cross Correlation (NCC)
Definition: defines.h:303
treats the input as a vector and returns the p-norm
Definition: defines.h:344
af_storage
Definition: defines.h:466
af_image_format imageFormat
Definition: defines.h:515
af_homography_type
Definition: defines.h:382
af_conv_domain
Definition: defines.h:290
FreeImage Enum for Adobe Photoshop File.
Definition: defines.h:363
af_colormap
Definition: defines.h:430
Computes homography using Least Median of Squares.
Definition: defines.h:384
Data needs to be conjugate.
Definition: defines.h:329
return the max of row sums
Definition: defines.h:346
FreeImage Enum for Portable Pixelmap (ASCII) File.
Definition: defines.h:360
There was an error with the runtime environment.
Definition: defines.h:84
Out of bound values are symmetric over the edge.
Definition: defines.h:257
Storage type is CSC.
Definition: defines.h:469
Spectrum map (390nm-830nm, in sRGB colorspace)
Definition: defines.h:432
3-channel HSV
Definition: defines.h:319
af_connectivity
Definition: defines.h:265
Computes homography using RANSAC.
Definition: defines.h:383
returns Lpq-norm
Definition: defines.h:348
FreeImage Enum for JPEG-2000 File.
Definition: defines.h:366
af_err
Definition: defines.h:63
Match based on Locally scaled SAD.
Definition: defines.h:299
The type is not suppported by this function.
Definition: defines.h:106
af_source
Definition: defines.h:214
Connectivity includes neighbors, North, East, South and West of current pixel.
Definition: defines.h:269
64-bit unsigned integral values
Definition: defines.h:205
af_someenum_t
Definition: defines.h:401
af_conv_mode
Definition: defines.h:277
Storage type is CSR.
Definition: defines.h:468
af_storage storage
Definition: defines.h:527
ITU-R BT.601 (formerly CCIR 601) standard.
Definition: defines.h:310
Out of bound values are 0.
Definition: defines.h:252
Bilinear Interpolation.
Definition: defines.h:227
This device does not support double.
Definition: defines.h:150
Storage type is COO.
Definition: defines.h:470
64-bit complex floating point values
Definition: defines.h:199
long long dim_t
Definition: defines.h:50
This build of ArrayFire was not built with graphics or this device does not support graphics...
Definition: defines.h:156
There was an error when loading the libraries.
Definition: defines.h:164
OpenCL Compute Backend.
Definition: defines.h:394
This build of ArrayFire does not support this feature.
Definition: defines.h:136
There was a mismatch between the input array and the active backend.
Definition: defines.h:178
af_marker_type
Definition: defines.h:445
af_diffusion_eq
Definition: defines.h:481
Cubic Interpolation with Catmull-Rom splines.
Definition: defines.h:240
FreeImage Enum for Tagged Image File Format File.
Definition: defines.h:362
ArrayFire automatically picks the right convolution algorithm.
Definition: defines.h:291
32-bit complex floating point values
Definition: defines.h:197
af_mat_prop matProp
Definition: defines.h:508
af_norm_type normType
Definition: defines.h:510
treats the input as a vector and returns the max of absolute values
Definition: defines.h:342
Matrix is block diagonal.
Definition: defines.h:337
There was an error in the device driver.
Definition: defines.h:79
Connectivity includes 4-connectivity neigbors and also those on Northeast, Northwest, Southeast and Southwest.
Definition: defines.h:274
This build of ArrayFire is not compiled with "nonfree" algorithms.
Definition: defines.h:142
af_conv_domain convDomain
Definition: defines.h:507
af_topk_function
Definition: defines.h:487
The default. Same as AF_NORM_VECTOR_2.
Definition: defines.h:350
Modified curvature diffusion equation.
Definition: defines.h:483
Top k max values.
Definition: defines.h:489
8-bit unsigned integral values
Definition: defines.h:203
af_border_type borderType
Definition: defines.h:500
FreeImage Enum for ILM OpenEXR File.
Definition: defines.h:365
Perform convolution in spatial domain.
Definition: defines.h:292
af_binary_op
Definition: defines.h:406
Perform convolution in frequency domain.
Definition: defines.h:293
Match based on Sum of Hamming Distances (SHD)
Definition: defines.h:305
Match based on Sum of Absolute Differences (SAD)
Definition: defines.h:297
Data needs to be transposed.
Definition: defines.h:327
return the max of column sums
Definition: defines.h:345
af_mat_prop trans
Definition: defines.h:505
One of the function arguments is incorrect.
Definition: defines.h:96
Nearest Interpolation.
Definition: defines.h:225
unsigned long long uintl
Definition: defines.h:56
Perceptually uniform shades of blue-green-yellow.
Definition: defines.h:441
3-channel RGB
Definition: defines.h:318
af_mat_prop
Definition: defines.h:325
Linear Interpolation with cosine smoothing.
Definition: defines.h:231
Exponential flux function.
Definition: defines.h:477
The input array is not a valid af_array object.
Definition: defines.h:91
32-bit unsigned integral values
Definition: defines.h:202
FreeImage Enum for High Dynamic Range File.
Definition: defines.h:364
af_cspace_t
Definition: defines.h:316
Default grayscale map.
Definition: defines.h:431
Default option is same as AF_DIFFUSION_GRAD.
Definition: defines.h:484
Matrix is lower triangular.
Definition: defines.h:331
FreeImage Enum for Portable Network Graphics File.
Definition: defines.h:359
FreeImage Enum for Portable Pixelmap (Binary) File.
Definition: defines.h:361
void * af_array
Definition: defines.h:222
Perceptually uniform shades of black-red-white.
Definition: defines.h:439
af_image_format
Definition: defines.h:354
af_match_type matchType
Definition: defines.h:502
af_moment_type
Definition: defines.h:372
Matrix is tri diagonal.
Definition: defines.h:336
Top k min values.
Definition: defines.h:488
af_cspace_t CSpace
Definition: defines.h:503
32-bit floating point values
Definition: defines.h:196
treats the input as a vector and returns euclidean norm
Definition: defines.h:343
Heat map.
Definition: defines.h:436
Input does not belong to the current device.
Definition: defines.h:123
af_flux_function fluxFunction
Definition: defines.h:539
treats the input as a vector and returns the sum of absolute values
Definition: defines.h:341
8-bit boolean values
Definition: defines.h:200
Default option (max)
Definition: defines.h:490
Floor Indexed.
Definition: defines.h:229
Storage type is dense.
Definition: defines.h:467
Host pointer.
Definition: defines.h:216
Quadratic flux function.
Definition: defines.h:476
af_marker_type markerType
Definition: defines.h:521
af_dtype
Definition: defines.h:195
af_interp_type interpType
Definition: defines.h:499
af_match_type
Definition: defines.h:296
Red hue map.
Definition: defines.h:434
There was an internal error either in ArrayFire or in a project upstream.
Definition: defines.h:187
af_moment_type momentType
Definition: defines.h:524
af_conv_mode convMode
Definition: defines.h:506
Unknown Error.
Definition: defines.h:192
af_dtype dtype
Definition: defines.h:497
long long intl
Definition: defines.h:55
Colors, aka. Rainbow.
Definition: defines.h:433
The size is incorrect.
Definition: defines.h:101
Default flux function is exponential.
Definition: defines.h:478
af_connectivity connectivity
Definition: defines.h:501
ITU-R BT.2020 standard.
Definition: defines.h:312