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 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 DEPRECATED(msg) __attribute__((deprecated( msg )))
36 #else
37  #define 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 #if defined(__x86_64__) || defined(_M_X64) || defined(__i386__) || defined(_M_IX86) || defined(_WIN64)
54 #define USE_CPUID
55 #endif
56 
57 #include <stdlib.h>
58 
59 typedef long long intl;
60 typedef unsigned long long uintl;
61 
62 #include <af/version.h>
63 #ifndef AF_API_VERSION
64 #define AF_API_VERSION AF_API_VERSION_CURRENT
65 #endif
66 
67 typedef enum {
72 
73  // 100-199 Errors in environment
74 
79 
84 
89 
90  // 200-299 Errors in input parameters
91 
96 
100  AF_ERR_ARG = 202,
101 
105  AF_ERR_SIZE = 203,
106 
110  AF_ERR_TYPE = 204,
111 
116 
121 
122 
123 #if AF_API_VERSION >= 33
124  AF_ERR_DEVICE = 208,
128 #endif
129 
130  // 300-399 Errors for missing software features
131 
136 
141 
142 #if AF_API_VERSION >= 32
143  AF_ERR_NONFREE = 303,
147 #endif
148 
149  // 400-499 Errors for missing hardware features
150 
155 
161 
162  // 500-599 Errors specific to heterogenous API
163 
164 #if AF_API_VERSION >= 32
165  AF_ERR_LOAD_LIB = 501,
169 #endif
170 
171 #if AF_API_VERSION >= 32
172  AF_ERR_LOAD_SYM = 502,
176 #endif
177 
178 #if AF_API_VERSION >= 32
183 #endif
184 
185  // 900-999 Errors from upstream libraries and runtimes
186 
192 
197 } af_err;
198 
199 typedef enum {
200  f32,
201  c32,
202  f64,
203  c64,
204  b8 ,
205  s32,
206  u32,
207  u8 ,
208  s64,
209  u64,
210 #if AF_API_VERSION >= 32
211  s16,
212 #endif
213 #if AF_API_VERSION >= 32
214  u16,
215 #endif
216 } af_dtype;
217 
218 typedef enum {
221 } af_source;
222 
223 #define AF_MAX_DIMS 4
224 
225 // A handle for an internal array object
226 typedef void * af_array;
227 
228 typedef enum {
235 
236 typedef enum {
241 
247 
248 typedef enum {
253 
259 
260 typedef enum {
261 
266 
271 } af_conv_mode;
272 
273 typedef enum {
278 
279 typedef enum {
280  AF_SAD = 0,
289 } af_match_type;
290 
291 #if AF_API_VERSION >= 31
292 typedef enum {
293  AF_YCC_601 = 601,
294  AF_YCC_709 = 709,
295  AF_YCC_2020 = 2020
296 } af_ycc_std;
297 #endif
298 
299 typedef enum {
300  AF_GRAY = 0,
303 #if AF_API_VERSION >= 31
305 #endif
306 } af_cspace_t;
307 
308 typedef enum {
316  AF_MAT_SYM = 512,
317  AF_MAT_POSDEF = 1024,
318  AF_MAT_ORTHOG = 2048,
321 } af_mat_prop;
322 
323 typedef enum {
332 
334 } af_norm_type;
335 
336 typedef enum {
344 } af_colormap;
345 
346 #if AF_API_VERSION >= 31
347 typedef enum {
352  AF_FIF_PNG = 13,
353  AF_FIF_PPM = 14,
355  AF_FIF_TIFF = 18,
356  AF_FIF_PSD = 20,
357  AF_FIF_HDR = 26,
358  AF_FIF_EXR = 29,
359  AF_FIF_JP2 = 31,
362 #endif
363 
364 #if AF_API_VERSION >= 32
365 typedef enum {
369 #endif
370 
371 #if AF_API_VERSION >= 32
372 // These enums should be 2^x
373 typedef enum {
378 } af_backend;
379 #endif
380 
381 // Below enum is purely added for example purposes
382 // it doesn't and shoudn't be used anywhere in the
383 // code. No Guarantee's provided if it is used.
384 typedef enum {
385  AF_ID = 0
386 } af_someenum_t;
387 
388 #if AF_API_VERSION >=32
389 typedef enum {
399 #endif
400 
401 #ifdef __cplusplus
402 namespace af
403 {
404  typedef af_dtype dtype;
405  typedef af_source source;
411  typedef af_someenum_t SomeEnum; // Purpose of Addition: How to add Function example
418 #if AF_API_VERSION >= 31
420 #endif
421 #if AF_API_VERSION >= 31
423 #endif
424 #if AF_API_VERSION >= 32
426 #endif
427 #if AF_API_VERSION >= 32
429 #endif
430 }
431 
432 #endif
The system or device ran out of memory.
Definition: defines.h:78
af_source source
Definition: defines.h:405
af_ycc_std
Definition: defines.h:292
Matrix is symmetric.
Definition: defines.h:316
returns the max singular value). Currently NOT SUPPORTED
Definition: defines.h:330
Match based on Sum of Squared Differences (SSD)
Definition: defines.h:283
af_someenum_t SomeEnum
Definition: defines.h:411
af_backend
Definition: defines.h:373
af_colormap ColorMap
Definition: defines.h:416
Cubic Interpolation.
Definition: defines.h:232
Matrix is orthogonal.
Definition: defines.h:318
Linear Interpolation.
Definition: defines.h:230
Definition: algorithm.h:14
Definition: defines.h:385
Device pointer.
Definition: defines.h:219
FreeImage Enum for RAW Camera Image File.
Definition: defines.h:360
FreeImage Enum for JPEG Network Graphics File.
Definition: defines.h:351
CPU a.k.a sequential algorithms.
Definition: defines.h:375
The function returned successfully.
Definition: defines.h:71
af_norm_type
Definition: defines.h:323
af_border_type
Definition: defines.h:236
ITU-R BT.709 standard.
Definition: defines.h:294
The type of the input arrays are not compatible.
Definition: defines.h:115
Output of the convolution is signal_len + filter_len - 1.
Definition: defines.h:270
FreeImage Enum for Bitmap File.
Definition: defines.h:348
Blue hue map.
Definition: defines.h:343
Matrix is upper triangular.
Definition: defines.h:313
3-channel YCbCr
Definition: defines.h:304
Matrix diagonal contains unitary values.
Definition: defines.h:315
Output of the convolution is the same size as input.
Definition: defines.h:265
Mood map.
Definition: defines.h:341
32-bit signed integral values
Definition: defines.h:205
Function does not support GFOR / batch mode.
Definition: defines.h:120
af_ycc_std YCCStd
Definition: defines.h:419
Matrix is positive definite.
Definition: defines.h:317
The option is not supported.
Definition: defines.h:135
FreeImage Enum for Windows Icon File.
Definition: defines.h:349
Default backend order: OpenCL -> CUDA -> CPU.
Definition: defines.h:374
CUDA Compute Backend.
Definition: defines.h:376
Match based on Zero mean SAD.
Definition: defines.h:281
64-bit signed integral values
Definition: defines.h:208
16-bit signed integral values
Definition: defines.h:211
Match based on Zero mean SSD.
Definition: defines.h:284
Grayscale.
Definition: defines.h:300
Match based on Zero mean NCC.
Definition: defines.h:287
16-bit unsigned integral values
Definition: defines.h:214
af_backend Backend
Definition: defines.h:425
Default.
Definition: defines.h:309
af_interp_type
Definition: defines.h:228
Match based on Locally scaled SSD.
Definition: defines.h:285
FreeImage Enum for JPEG File.
Definition: defines.h:350
Data needs to be conjugate tansposed.
Definition: defines.h:311
64-bit complex floating point values
Definition: defines.h:202
Definition: defines.h:390
Definition: defines.h:391
There was an error when loading the symbols.
Definition: defines.h:175
Match based on Normalized Cross Correlation (NCC)
Definition: defines.h:286
treats the input as a vector and returns the p-norm
Definition: defines.h:327
af_image_format imageFormat
Definition: defines.h:422
af_homography_type
Definition: defines.h:365
af_conv_domain
Definition: defines.h:273
FreeImage Enum for Adobe Photoshop File.
Definition: defines.h:356
af_colormap
Definition: defines.h:336
Computes homography using Least Median of Squares.
Definition: defines.h:367
Data needs to be conjugate.
Definition: defines.h:312
return the max of row sums
Definition: defines.h:329
FreeImage Enum for Portable Pixelmap (ASCII) File.
Definition: defines.h:353
There was an error with the runtime environment.
Definition: defines.h:88
Out of bound values are symmetric over the edge.
Definition: defines.h:245
Definition: defines.h:393
Spectrum map.
Definition: defines.h:338
3-channel HSV
Definition: defines.h:302
af_connectivity
Definition: defines.h:248
Computes homography using RANSAC.
Definition: defines.h:366
returns Lpq-norm
Definition: defines.h:331
FreeImage Enum for JPEG-2000 File.
Definition: defines.h:359
af_err
Definition: defines.h:67
Match based on Locally scaled SAD.
Definition: defines.h:282
The type is not suppported by this function.
Definition: defines.h:110
af_source
Definition: defines.h:218
Connectivity includes neighbors, North, East, South and West of current pixel.
Definition: defines.h:252
64-bit unsigned integral values
Definition: defines.h:209
af_someenum_t
Definition: defines.h:384
af_conv_mode
Definition: defines.h:260
ITU-R BT.601 (formerly CCIR 601) standard.
Definition: defines.h:293
Out of bound values are 0.
Definition: defines.h:240
Bilinear Interpolation.
Definition: defines.h:231
This device does not support double.
Definition: defines.h:154
64-bit complex floating point values
Definition: defines.h:203
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:160
There was an error when loading the libraries.
Definition: defines.h:168
OpenCL Compute Backend.
Definition: defines.h:377
This build of ArrayFire does not support this feature.
Definition: defines.h:140
There was a mismatch between the input array and the active backend.
Definition: defines.h:182
af_marker_type
Definition: defines.h:389
FreeImage Enum for Tagged Image File Format File.
Definition: defines.h:355
ArrayFire automatically picks the right convolution algorithm.
Definition: defines.h:274
32-bit complex floating point values
Definition: defines.h:201
af_mat_prop matProp
Definition: defines.h:415
Definition: defines.h:397
af_norm_type normType
Definition: defines.h:417
treats the input as a vector and returns the max of absolute values
Definition: defines.h:325
Matrix is block diagonal.
Definition: defines.h:320
There was an error in the device driver.
Definition: defines.h:83
Connectivity includes 4-connectivity neigbors and also those on Northeast, Northwest, Southeast and Southwest.
Definition: defines.h:257
This build of ArrayFire is not compiled with "nonfree" algorithms.
Definition: defines.h:146
af_conv_domain convDomain
Definition: defines.h:414
The default. Same as AF_NORM_VECTOR_2.
Definition: defines.h:333
8-bit unsigned integral values
Definition: defines.h:207
af_border_type borderType
Definition: defines.h:407
FreeImage Enum for ILM OpenEXR File.
Definition: defines.h:358
Perform convolution in spatial domain.
Definition: defines.h:275
Perform convolution in frequency domain.
Definition: defines.h:276
Match based on Sum of Hamming Distances (SHD)
Definition: defines.h:288
Match based on Sum of Absolute Differences (SAD)
Definition: defines.h:280
Data needs to be transposed.
Definition: defines.h:310
return the max of column sums
Definition: defines.h:328
af_mat_prop trans
Definition: defines.h:412
One of the function arguments is incorrect.
Definition: defines.h:100
Nearest Interpolation.
Definition: defines.h:229
unsigned long long uintl
Definition: defines.h:60
3-channel RGB
Definition: defines.h:301
af_mat_prop
Definition: defines.h:308
The input array is not a valid af_array object.
Definition: defines.h:95
32-bit unsigned integral values
Definition: defines.h:206
FreeImage Enum for High Dynamic Range File.
Definition: defines.h:357
af_cspace_t
Definition: defines.h:299
Default grayscale map.
Definition: defines.h:337
Matrix is lower triangular.
Definition: defines.h:314
FreeImage Enum for Portable Network Graphics File.
Definition: defines.h:352
FreeImage Enum for Portable Pixelmap (Binary) File.
Definition: defines.h:354
void * af_array
Definition: defines.h:226
af_image_format
Definition: defines.h:347
Definition: defines.h:396
af_match_type matchType
Definition: defines.h:409
Matrix is tri diagonal.
Definition: defines.h:319
af_cspace_t CSpace
Definition: defines.h:410
32-bit floating point values
Definition: defines.h:200
treats the input as a vector and returns euclidean norm
Definition: defines.h:326
Heat map.
Definition: defines.h:342
Input does not belong to the current device.
Definition: defines.h:127
Definition: defines.h:392
treats the input as a vector and returns the sum of absolute values
Definition: defines.h:324
8-bit boolean values
Definition: defines.h:204
Floor Indexed.
Definition: defines.h:233
Host pointer.
Definition: defines.h:220
af_marker_type markerType
Definition: defines.h:428
af_dtype
Definition: defines.h:199
af_interp_type interpType
Definition: defines.h:406
af_match_type
Definition: defines.h:279
Red hue map.
Definition: defines.h:340
There was an internal error either in ArrayFire or in a project upstream.
Definition: defines.h:191
Definition: defines.h:395
Definition: defines.h:394
af_conv_mode convMode
Definition: defines.h:413
Unknown Error.
Definition: defines.h:196
af_dtype dtype
Definition: defines.h:404
long long intl
Definition: defines.h:59
Colors.
Definition: defines.h:339
The size is incorrect.
Definition: defines.h:105
af_connectivity connectivity
Definition: defines.h:408
ITU-R BT.2020 standard.
Definition: defines.h:295