text:
# Macro functions as generic Julia functions

function VENDOR(e)
    return (UInt32(e) & VENDOR_MASK) >> 20
end

function TYPE(e)
    return (UInt32(e) & TYPE_MASK) >> 8
end

function ENUM_TYPE(e)
    return (UInt32(e) & ENUM_TYPE_MASK) >> 12
end

function LIBRARY(e)
    return (UInt32(e) & LIBRARY_MASK) >> 12
end

function DF_IMAGE(a, b, c, d)
    return UInt32(a) | (UInt32(b) << 8) | (UInt32(c) << 16) | (UInt32(d) << 24)
end

function ATTRIBUTE_BASE(vendor, object)
    return (UInt32(vendor) << 20) | (UInt32(object) << 8)
end

function KERNEL_BASE(vendor, lib)
    return (UInt32(vendor) << 20) | (UInt32(lib) << 12)
end

function ENUM_BASE(vendor, id)
    return (UInt32(vendor) << 20) | (UInt32(id) << 12)
end

function VERSION_MAJOR(x)
    return (UInt32(x) & 0xFF) << 8
end

function VERSION_MINOR(x)
    return (UInt32(x) & 0xFF) << 0
end

@cenum vx_vendor_id_e::Int32 begin
    ID_KHRONOS = 0
    ID_TI = 1
    ID_QUALCOMM = 2
    ID_NVIDIA = 3
    ID_ARM = 4
    ID_BDTI = 5
    ID_RENESAS = 6
    ID_VIVANTE = 7
    ID_XILINX = 8
    ID_AXIS = 9
    ID_MOVIDIUS = 10
    ID_SAMSUNG = 11
    ID_FREESCALE = 12
    ID_AMD = 13
    ID_BROADCOM = 14
    ID_INTEL = 15
    ID_MARVELL = 16
    ID_MEDIATEK = 17
    ID_ST = 18
    ID_CEVA = 19
    ID_ITSEEZ = 20
    ID_IMAGINATION = 21
    ID_NXP = 22
    ID_VIDEANTIS = 23
    ID_SYNOPSYS = 24
    ID_CADENCE = 25
    ID_HUAWEI = 26
    ID_SOCIONEXT = 27
    ID_USER = 4094
    ID_MAX = 4095
    ID_DEFAULT = 4095
end

@cenum vx_bool_e::Int32 begin
    vx_false_e = 0
    vx_true_e = 1
end

@cenum vx_type_e::Int32 begin
    TYPE_INVALID = 0
    TYPE_CHAR = 1
    TYPE_INT8 = 2
    TYPE_UINT8 = 3
    TYPE_INT16 = 4
    TYPE_UINT16 = 5
    TYPE_INT32 = 6
    TYPE_UINT32 = 7
    TYPE_INT64 = 8
    TYPE_UINT64 = 9
    TYPE_FLOAT32 = 10
    TYPE_FLOAT64 = 11
    TYPE_ENUM = 12
    TYPE_SIZE = 13
    TYPE_DF_IMAGE = 14
    TYPE_BOOL = 16
    TYPE_RECTANGLE = 32
    TYPE_KEYPOINT = 33
    TYPE_COORDINATES2D = 34
    TYPE_COORDINATES3D = 35
    TYPE_COORDINATES2DF = 36
    TYPE_HOG_PARAMS = 40
    TYPE_HOUGH_LINES_PARAMS = 41
    TYPE_LINE_2D = 42
    TYPE_TENSOR_MATRIX_MULTIPLY_PARAMS = 43
    TYPE_USER_STRUCT_START = 256
    TYPE_VENDOR_STRUCT_START = 1024
    TYPE_KHRONOS_OBJECT_START = 2048
    TYPE_VENDOR_OBJECT_START = 3072
    TYPE_KHRONOS_STRUCT_MAX = 255
    TYPE_USER_STRUCT_END = 1023
    TYPE_VENDOR_STRUCT_END = 2047
    TYPE_KHRONOS_OBJECT_END = 3071
    TYPE_VENDOR_OBJECT_END = 4095
    TYPE_REFERENCE = 2048
    TYPE_CONTEXT = 2049
    TYPE_GRAPH = 2050
    TYPE_NODE = 2051
    TYPE_KERNEL = 2052
    TYPE_PARAMETER = 2053
    TYPE_DELAY = 2054
    TYPE_LUT = 2055
    TYPE_DISTRIBUTION = 2056
    TYPE_PYRAMID = 2057
    TYPE_THRESHOLD = 2058
    TYPE_MATRIX = 2059
    TYPE_CONVOLUTION = 2060
    TYPE_SCALAR = 2061
    TYPE_ARRAY = 2062
    TYPE_IMAGE = 2063
    TYPE_REMAP = 2064
    TYPE_ERROR = 2065
    TYPE_META_FORMAT = 2066
    TYPE_OBJECT_ARRAY = 2067
    TYPE_TENSOR = 2069
end

@cenum vx_status_e::Int32 begin
    STATUS_MIN = -25
    ERROR_REFERENCE_NONZERO = -24
    ERROR_MULTIPLE_WRITERS = -23
    ERROR_GRAPH_ABANDONED = -22
    ERROR_GRAPH_SCHEDULED = -21
    ERROR_INVALID_SCOPE = -20
    ERROR_INVALID_NODE = -19
    ERROR_INVALID_GRAPH = -18
    ERROR_INVALID_TYPE = -17
    ERROR_INVALID_VALUE = -16
    ERROR_INVALID_DIMENSION = -15
    ERROR_INVALID_FORMAT = -14
    ERROR_INVALID_LINK = -13
    ERROR_INVALID_REFERENCE = -12
    ERROR_INVALID_MODULE = -11
    ERROR_INVALID_PARAMETERS = -10
    ERROR_OPTIMIZED_AWAY = -9
    ERROR_NO_MEMORY = -8
    ERROR_NO_RESOURCES = -7
    ERROR_NOT_COMPATIBLE = -6
    ERROR_NOT_ALLOCATED = -5
    ERROR_NOT_SUFFICIENT = -4
    ERROR_NOT_SUPPORTED = -3
    ERROR_NOT_IMPLEMENTED = -2
    FAILURE = -1
    SUCCESS = 0
end

@cenum vx_enum_e::Int32 begin
    ENUM_DIRECTION = 0
    ENUM_ACTION = 1
    ENUM_HINT = 2
    ENUM_DIRECTIVE = 3
    ENUM_INTERPOLATION = 4
    ENUM_OVERFLOW = 5
    ENUM_COLOR_SPACE = 6
    ENUM_COLOR_RANGE = 7
    ENUM_PARAMETER_STATE = 8
    ENUM_CHANNEL = 9
    ENUM_CONVERT_POLICY = 10
    ENUM_THRESHOLD_TYPE = 11
    ENUM_BORDER = 12
    ENUM_COMPARISON = 13
    ENUM_MEMORY_TYPE = 14
    ENUM_TERM_CRITERIA = 15
    ENUM_NORM_TYPE = 16
    ENUM_ACCESSOR = 17
    ENUM_ROUND_POLICY = 18
    ENUM_TARGET = 19
    ENUM_BORDER_POLICY = 20
    ENUM_GRAPH_STATE = 21
    ENUM_NONLINEAR = 22
    ENUM_PATTERN = 23
    ENUM_LBP_FORMAT = 24
    ENUM_COMP_METRIC = 25
    ENUM_SCALAR_OPERATION = 32
end

@cenum vx_action_e::Int32 begin
    ACTION_CONTINUE = ENUM_BASE(ID_KHRONOS, ENUM_ACTION) + 0x0
    ACTION_ABANDON = ENUM_BASE(ID_KHRONOS, ENUM_ACTION) + 0x1
end

@cenum vx_direction_e::Int32 begin
    INPUT = ENUM_BASE(ID_KHRONOS, ENUM_DIRECTION) + 0x0
    OUTPUT = ENUM_BASE(ID_KHRONOS, ENUM_DIRECTION) + 0x1
    BIDIRECTIONAL = ENUM_BASE(ID_KHRONOS, ENUM_DIRECTION) + 0x2
end

@cenum vx_hint_e::Int32 begin
    HINT_PERFORMANCE_DEFAULT = ENUM_BASE(ID_KHRONOS, ENUM_HINT) + 0x1
    HINT_PERFORMANCE_LOW_POWER = ENUM_BASE(ID_KHRONOS, ENUM_HINT) + 0x2
    HINT_PERFORMANCE_HIGH_SPEED = ENUM_BASE(ID_KHRONOS, ENUM_HINT) + 0x3
end

@cenum vx_directive_e::Int32 begin
    DIRECTIVE_DISABLE_LOGGING = ENUM_BASE(ID_KHRONOS, ENUM_DIRECTIVE) + 0x0
    DIRECTIVE_ENABLE_LOGGING = ENUM_BASE(ID_KHRONOS, ENUM_DIRECTIVE) + 0x1
    DIRECTIVE_DISABLE_PERFORMANCE = ENUM_BASE(ID_KHRONOS, ENUM_DIRECTIVE) + 0x2
    DIRECTIVE_ENABLE_PERFORMANCE = ENUM_BASE(ID_KHRONOS, ENUM_DIRECTIVE) + 0x3
end

@cenum vx_graph_state_e::Int32 begin
    GRAPH_STATE_UNVERIFIED = ENUM_BASE(ID_KHRONOS, ENUM_GRAPH_STATE) + 0x0
    GRAPH_STATE_VERIFIED = ENUM_BASE(ID_KHRONOS, ENUM_GRAPH_STATE) + 0x1
    GRAPH_STATE_RUNNING = ENUM_BASE(ID_KHRONOS, ENUM_GRAPH_STATE) + 0x2
    GRAPH_STATE_ABANDONED = ENUM_BASE(ID_KHRONOS, ENUM_GRAPH_STATE) + 0x3
    GRAPH_STATE_COMPLETED = ENUM_BASE(ID_KHRONOS, ENUM_GRAPH_STATE) + 0x4
end

@cenum vx_graph_attribute_e::Int32 begin
    GRAPH_NUMNODES = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_GRAPH) + 0x0
    GRAPH_PERFORMANCE = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_GRAPH) + 0x1
    GRAPH_NUMPARAMETERS = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_GRAPH) + 0x2
    GRAPH_STATE = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_GRAPH) + 0x3
end

@cenum vx_convert_policy_e::Int32 begin
    CONVERT_POLICY_WRAP = ENUM_BASE(ID_KHRONOS, ENUM_CONVERT_POLICY) + 0x0
    CONVERT_POLICY_SATURATE = ENUM_BASE(ID_KHRONOS, ENUM_CONVERT_POLICY) + 0x1
end

@cenum vx_df_image_e::Int32 begin
    DF_IMAGE_VIRT = 1414678870
    DF_IMAGE_RGB = 843204434
    DF_IMAGE_RGBX = 1094862674
    DF_IMAGE_NV12 = 842094158
    DF_IMAGE_NV21 = 825382478
    DF_IMAGE_UYVY = 1498831189
    DF_IMAGE_YUYV = 1448695129
    DF_IMAGE_IYUV = 1448433993
    DF_IMAGE_YUV4 = 878073177
    DF_IMAGE_U8 = 942682197
    DF_IMAGE_U16 = 909193301
    DF_IMAGE_S16 = 909193299
    DF_IMAGE_U32 = 842215509
    DF_IMAGE_S32 = 842215507
end

@cenum vx_target_e::Int32 begin
    TARGET_ANY = ENUM_BASE(ID_KHRONOS, ENUM_TARGET) + 0x0000
    TARGET_STRING = ENUM_BASE(ID_KHRONOS, ENUM_TARGET) + 0x0001
    TARGET_VENDOR_BEGIN = ENUM_BASE(ID_KHRONOS, ENUM_TARGET) + 0x1000
end

@cenum vx_reference_attribute_e::Int32 begin
    REFERENCE_COUNT = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_REFERENCE) + 0x0
    REFERENCE_TYPE = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_REFERENCE) + 0x1
    REFERENCE_NAME = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_REFERENCE) + 0x2
end

@cenum vx_context_attribute_e::Int32 begin
    CONTEXT_VENDOR_ID = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_CONTEXT) + 0x0
    CONTEXT_VERSION = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_CONTEXT) + 0x1
    CONTEXT_UNIQUE_KERNELS = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_CONTEXT) + 0x2
    CONTEXT_MODULES = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_CONTEXT) + 0x3
    CONTEXT_REFERENCES = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_CONTEXT) + 0x4
    CONTEXT_IMPLEMENTATION = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_CONTEXT) + 0x5
    CONTEXT_EXTENSIONS_SIZE = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_CONTEXT) + 0x6
    CONTEXT_EXTENSIONS = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_CONTEXT) + 0x7
    CONTEXT_CONVOLUTION_MAX_DIMENSION = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_CONTEXT) + 0x8
    CONTEXT_OPTICAL_FLOW_MAX_WINDOW_DIMENSION = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_CONTEXT) + 0x9
    CONTEXT_IMMEDIATE_BORDER = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_CONTEXT) + 0xA
    CONTEXT_UNIQUE_KERNEL_TABLE = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_CONTEXT) + 0xB
    CONTEXT_IMMEDIATE_BORDER_POLICY = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_CONTEXT) + 0xC
    CONTEXT_NONLINEAR_MAX_DIMENSION = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_CONTEXT) + 0xD
    CONTEXT_MAX_TENSOR_DIMS = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_CONTEXT) + 0xE
end

@cenum vx_kernel_attribute_e::Int32 begin
    KERNEL_PARAMETERS = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_KERNEL) + 0x0
    KERNEL_NAME = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_KERNEL) + 0x1
    KERNEL_ENUM = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_KERNEL) + 0x2
    KERNEL_LOCAL_DATA_SIZE = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_KERNEL) + 0x3
end

@cenum vx_node_attribute_e::Int32 begin
    NODE_STATUS = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_NODE) + 0x0
    NODE_PERFORMANCE = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_NODE) + 0x1
    NODE_BORDER = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_NODE) + 0x2
    NODE_LOCAL_DATA_SIZE = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_NODE) + 0x3
    NODE_LOCAL_DATA_PTR = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_NODE) + 0x4
    NODE_PARAMETERS = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_NODE) + 0x5
    NODE_IS_REPLICATED = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_NODE) + 0x6
    NODE_REPLICATE_FLAGS = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_NODE) + 0x7
    NODE_VALID_RECT_RESET = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_NODE) + 0x8
end

@cenum vx_parameter_attribute_e::Int32 begin
    PARAMETER_INDEX = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_PARAMETER) + 0x0
    PARAMETER_DIRECTION = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_PARAMETER) + 0x1
    PARAMETER_TYPE = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_PARAMETER) + 0x2
    PARAMETER_STATE = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_PARAMETER) + 0x3
    PARAMETER_REF = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_PARAMETER) + 0x4
end

@cenum vx_image_attribute_e::Int32 begin
    IMAGE_WIDTH = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_IMAGE) + 0x0
    IMAGE_HEIGHT = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_IMAGE) + 0x1
    IMAGE_FORMAT = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_IMAGE) + 0x2
    IMAGE_PLANES = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_IMAGE) + 0x3
    IMAGE_SPACE = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_IMAGE) + 0x4
    IMAGE_RANGE = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_IMAGE) + 0x5
    IMAGE_MEMORY_TYPE = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_IMAGE) + 0x7
    IMAGE_IS_UNIFORM = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_IMAGE) + 0x8
    IMAGE_UNIFORM_VALUE = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_IMAGE) + 0x9
end

@cenum vx_scalar_attribute_e::Int32 begin
    SCALAR_TYPE = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_SCALAR) + 0x0
end

@cenum vx_scalar_operation_e::Int32 begin
    SCALAR_OP_AND = ENUM_BASE(ID_KHRONOS, ENUM_SCALAR_OPERATION) + 0x0
    SCALAR_OP_OR = ENUM_BASE(ID_KHRONOS, ENUM_SCALAR_OPERATION) + 0x1
    SCALAR_OP_XOR = ENUM_BASE(ID_KHRONOS, ENUM_SCALAR_OPERATION) + 0x2
    SCALAR_OP_NAND = ENUM_BASE(ID_KHRONOS, ENUM_SCALAR_OPERATION) + 0x3
    SCALAR_OP_EQUAL = ENUM_BASE(ID_KHRONOS, ENUM_SCALAR_OPERATION) + 0x4
    SCALAR_OP_NOTEQUAL = ENUM_BASE(ID_KHRONOS, ENUM_SCALAR_OPERATION) + 0x5
    SCALAR_OP_LESS = ENUM_BASE(ID_KHRONOS, ENUM_SCALAR_OPERATION) + 0x6
    SCALAR_OP_LESSEQ = ENUM_BASE(ID_KHRONOS, ENUM_SCALAR_OPERATION) + 0x7
    SCALAR_OP_GREATER = ENUM_BASE(ID_KHRONOS, ENUM_SCALAR_OPERATION) + 0x8
    SCALAR_OP_GREATEREQ = ENUM_BASE(ID_KHRONOS, ENUM_SCALAR_OPERATION) + 0x9
    SCALAR_OP_ADD = ENUM_BASE(ID_KHRONOS, ENUM_SCALAR_OPERATION) + 0xA
    SCALAR_OP_SUBTRACT = ENUM_BASE(ID_KHRONOS, ENUM_SCALAR_OPERATION) + 0xB
    SCALAR_OP_MULTIPLY = ENUM_BASE(ID_KHRONOS, ENUM_SCALAR_OPERATION) + 0xC
    SCALAR_OP_DIVIDE = ENUM_BASE(ID_KHRONOS, ENUM_SCALAR_OPERATION) + 0xD
    SCALAR_OP_MODULUS = ENUM_BASE(ID_KHRONOS, ENUM_SCALAR_OPERATION) + 0xE
    SCALAR_OP_MIN = ENUM_BASE(ID_KHRONOS, ENUM_SCALAR_OPERATION) + 0xF
    SCALAR_OP_MAX = ENUM_BASE(ID_KHRONOS, ENUM_SCALAR_OPERATION) + 0x10
end

@cenum vx_lut_attribute_e::Int32 begin
    LUT_TYPE = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_LUT) + 0x0
    LUT_COUNT = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_LUT) + 0x1
    LUT_SIZE = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_LUT) + 0x2
    LUT_OFFSET = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_LUT) + 0x3
end

@cenum vx_distribution_attribute_e::Int32 begin
    DISTRIBUTION_DIMENSIONS = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_DISTRIBUTION) + 0x0
    DISTRIBUTION_OFFSET = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_DISTRIBUTION) + 0x1
    DISTRIBUTION_RANGE = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_DISTRIBUTION) + 0x2
    DISTRIBUTION_BINS = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_DISTRIBUTION) + 0x3
    DISTRIBUTION_WINDOW = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_DISTRIBUTION) + 0x4
    DISTRIBUTION_SIZE = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_DISTRIBUTION) + 0x5
end

@cenum vx_threshold_type_e::Int32 begin
    THRESHOLD_TYPE_BINARY = ENUM_BASE(ID_KHRONOS, ENUM_THRESHOLD_TYPE) + 0x0
    THRESHOLD_TYPE_RANGE = ENUM_BASE(ID_KHRONOS, ENUM_THRESHOLD_TYPE) + 0x1
end

@cenum vx_threshold_attribute_e::Int32 begin
    THRESHOLD_TYPE = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_THRESHOLD) + 0x0
    THRESHOLD_INPUT_FORMAT = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_THRESHOLD) + 0x7
    THRESHOLD_OUTPUT_FORMAT = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_THRESHOLD) + 0x8
end

@cenum vx_matrix_attribute_e::Int32 begin
    MATRIX_TYPE = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_MATRIX) + 0x0
    MATRIX_ROWS = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_MATRIX) + 0x1
    MATRIX_COLUMNS = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_MATRIX) + 0x2
    MATRIX_SIZE = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_MATRIX) + 0x3
    MATRIX_ORIGIN = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_MATRIX) + 0x4
    MATRIX_PATTERN = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_MATRIX) + 0x5
end

@cenum vx_convolution_attribute_e::Int32 begin
    CONVOLUTION_ROWS = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_CONVOLUTION) + 0x0
    CONVOLUTION_COLUMNS = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_CONVOLUTION) + 0x1
    CONVOLUTION_SCALE = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_CONVOLUTION) + 0x2
    CONVOLUTION_SIZE = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_CONVOLUTION) + 0x3
end

@cenum vx_pyramid_attribute_e::Int32 begin
    PYRAMID_LEVELS = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_PYRAMID) + 0x0
    PYRAMID_SCALE = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_PYRAMID) + 0x1
    PYRAMID_WIDTH = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_PYRAMID) + 0x2
    PYRAMID_HEIGHT = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_PYRAMID) + 0x3
    PYRAMID_FORMAT = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_PYRAMID) + 0x4
end

@cenum vx_remap_attribute_e::Int32 begin
    REMAP_SOURCE_WIDTH = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_REMAP) + 0x0
    REMAP_SOURCE_HEIGHT = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_REMAP) + 0x1
    REMAP_DESTINATION_WIDTH = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_REMAP) + 0x2
    REMAP_DESTINATION_HEIGHT = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_REMAP) + 0x3
end

@cenum vx_array_attribute_e::Int32 begin
    ARRAY_ITEMTYPE = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_ARRAY) + 0x0
    ARRAY_NUMITEMS = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_ARRAY) + 0x1
    ARRAY_CAPACITY = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_ARRAY) + 0x2
    ARRAY_ITEMSIZE = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_ARRAY) + 0x3
end

@cenum vx_object_array_attribute_e::Int32 begin
    OBJECT_ARRAY_ITEMTYPE = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_OBJECT_ARRAY) + 0x0
    OBJECT_ARRAY_NUMITEMS = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_OBJECT_ARRAY) + 0x1
end

@cenum vx_tensor_attribute_e::Int32 begin
    TENSOR_NUMBER_OF_DIMS = ATTRIBUTE_BASE( ID_KHRONOS, TYPE_TENSOR ) + 0x0
    TENSOR_DIMS = ATTRIBUTE_BASE( ID_KHRONOS, TYPE_TENSOR ) + 0x1
    TENSOR_DATA_TYPE = ATTRIBUTE_BASE( ID_KHRONOS, TYPE_TENSOR ) + 0x2
    TENSOR_FIXED_POINT_POSITION = ATTRIBUTE_BASE( ID_KHRONOS, TYPE_TENSOR ) + 0x3
end

@cenum vx_meta_valid_rect_attribute_e::Int32 begin
    VALID_RECT_CALLBACK = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_META_FORMAT) + 0x1
end

@cenum vx_channel_e::Int32 begin
    CHANNEL_0 = ENUM_BASE(ID_KHRONOS, ENUM_CHANNEL) + 0x0
    CHANNEL_1 = ENUM_BASE(ID_KHRONOS, ENUM_CHANNEL) + 0x1
    CHANNEL_2 = ENUM_BASE(ID_KHRONOS, ENUM_CHANNEL) + 0x2
    CHANNEL_3 = ENUM_BASE(ID_KHRONOS, ENUM_CHANNEL) + 0x3
    CHANNEL_R = ENUM_BASE(ID_KHRONOS, ENUM_CHANNEL) + 0x10
    CHANNEL_G = ENUM_BASE(ID_KHRONOS, ENUM_CHANNEL) + 0x11
    CHANNEL_B = ENUM_BASE(ID_KHRONOS, ENUM_CHANNEL) + 0x12
    CHANNEL_A = ENUM_BASE(ID_KHRONOS, ENUM_CHANNEL) + 0x13
    CHANNEL_Y = ENUM_BASE(ID_KHRONOS, ENUM_CHANNEL) + 0x14
    CHANNEL_U = ENUM_BASE(ID_KHRONOS, ENUM_CHANNEL) + 0x15
    CHANNEL_V = ENUM_BASE(ID_KHRONOS, ENUM_CHANNEL) + 0x16
end

@cenum vx_memory_type_e::Int32 begin
    MEMORY_TYPE_NONE = ENUM_BASE(ID_KHRONOS, ENUM_MEMORY_TYPE) + 0x0
    MEMORY_TYPE_HOST = ENUM_BASE(ID_KHRONOS, ENUM_MEMORY_TYPE) + 0x1
end

@cenum vx_interpolation_type_e::Int32 begin
    INTERPOLATION_NEAREST_NEIGHBOR = ENUM_BASE(ID_KHRONOS, ENUM_INTERPOLATION) + 0x0
    INTERPOLATION_BILINEAR = ENUM_BASE(ID_KHRONOS, ENUM_INTERPOLATION) + 0x1
    INTERPOLATION_AREA = ENUM_BASE(ID_KHRONOS, ENUM_INTERPOLATION) + 0x2
end

@cenum vx_non_linear_filter_e::Int32 begin
    NONLINEAR_FILTER_MEDIAN = ENUM_BASE(ID_KHRONOS, ENUM_NONLINEAR) + 0x0
    NONLINEAR_FILTER_MIN = ENUM_BASE(ID_KHRONOS, ENUM_NONLINEAR) + 0x1
    NONLINEAR_FILTER_MAX = ENUM_BASE(ID_KHRONOS, ENUM_NONLINEAR) + 0x2
end

@cenum vx_pattern_e::Int32 begin
    PATTERN_BOX = ENUM_BASE(ID_KHRONOS, ENUM_PATTERN) + 0x0
    PATTERN_CROSS = ENUM_BASE(ID_KHRONOS, ENUM_PATTERN) + 0x1
    PATTERN_DISK = ENUM_BASE(ID_KHRONOS, ENUM_PATTERN) + 0x2
    PATTERN_OTHER = ENUM_BASE(ID_KHRONOS, ENUM_PATTERN) + 0x3
end

@cenum vx_color_space_e::Int32 begin
    COLOR_SPACE_NONE = ENUM_BASE(ID_KHRONOS, ENUM_COLOR_SPACE) + 0x0
    COLOR_SPACE_BT601_525 = ENUM_BASE(ID_KHRONOS, ENUM_COLOR_SPACE) + 0x1
    COLOR_SPACE_BT601_625 = ENUM_BASE(ID_KHRONOS, ENUM_COLOR_SPACE) + 0x2
    COLOR_SPACE_BT709 = ENUM_BASE(ID_KHRONOS, ENUM_COLOR_SPACE) + 0x3
    COLOR_SPACE_DEFAULT = ENUM_BASE(ID_KHRONOS, ENUM_COLOR_SPACE) + 0x3
end

@cenum vx_channel_range_e::Int32 begin
    CHANNEL_RANGE_FULL = ENUM_BASE(ID_KHRONOS, ENUM_COLOR_RANGE) + 0x0
    CHANNEL_RANGE_RESTRICTED = ENUM_BASE(ID_KHRONOS, ENUM_COLOR_RANGE) + 0x1
end

@cenum vx_parameter_state_e::Int32 begin
    PARAMETER_STATE_REQUIRED = ENUM_BASE(ID_KHRONOS, ENUM_PARAMETER_STATE) + 0x0
    PARAMETER_STATE_OPTIONAL = ENUM_BASE(ID_KHRONOS, ENUM_PARAMETER_STATE) + 0x1
end

@cenum vx_border_e::Int32 begin
    BORDER_UNDEFINED = ENUM_BASE(ID_KHRONOS, ENUM_BORDER) + 0x0
    BORDER_CONSTANT = ENUM_BASE(ID_KHRONOS, ENUM_BORDER) + 0x1
    BORDER_REPLICATE = ENUM_BASE(ID_KHRONOS, ENUM_BORDER) + 0x2
end

@cenum vx_border_policy_e::Int32 begin
    BORDER_POLICY_DEFAULT_TO_UNDEFINED = ENUM_BASE(ID_KHRONOS, ENUM_BORDER_POLICY) + 0x0
    BORDER_POLICY_RETURN_ERROR = ENUM_BASE(ID_KHRONOS, ENUM_BORDER_POLICY) + 0x1
end

@cenum vx_termination_criteria_e::Int32 begin
    TERM_CRITERIA_ITERATIONS = ENUM_BASE(ID_KHRONOS, ENUM_TERM_CRITERIA) + 0x0
    TERM_CRITERIA_EPSILON = ENUM_BASE(ID_KHRONOS, ENUM_TERM_CRITERIA) + 0x1
    TERM_CRITERIA_BOTH = ENUM_BASE(ID_KHRONOS, ENUM_TERM_CRITERIA) + 0x2
end

@cenum vx_norm_type_e::Int32 begin
    NORM_L1 = ENUM_BASE(ID_KHRONOS, ENUM_NORM_TYPE) + 0x0
    NORM_L2 = ENUM_BASE(ID_KHRONOS, ENUM_NORM_TYPE) + 0x1
end

@cenum vx_delay_attribute_e::Int32 begin
    DELAY_TYPE = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_DELAY) + 0x0
    DELAY_SLOTS = ATTRIBUTE_BASE(ID_KHRONOS, TYPE_DELAY) + 0x1
end

@cenum vx_accessor_e::Int32 begin
    READ_ONLY = ENUM_BASE(ID_KHRONOS, ENUM_ACCESSOR) + 0x1
    WRITE_ONLY = ENUM_BASE(ID_KHRONOS, ENUM_ACCESSOR) + 0x2
    READ_AND_WRITE = ENUM_BASE(ID_KHRONOS, ENUM_ACCESSOR) + 0x3
end

@cenum vx_round_policy_e::Int32 begin
    ROUND_POLICY_TO_ZERO = ENUM_BASE(ID_KHRONOS, ENUM_ROUND_POLICY) + 0x1
    ROUND_POLICY_TO_NEAREST_EVEN = ENUM_BASE(ID_KHRONOS, ENUM_ROUND_POLICY) + 0x2
end

@cenum vx_lbp_format_e::Int32 begin
    _LBP = ENUM_BASE( ID_KHRONOS, ENUM_LBP_FORMAT ) + 0x0
    MLBP = ENUM_BASE( ID_KHRONOS, ENUM_LBP_FORMAT ) + 0x1
    ULBP = ENUM_BASE( ID_KHRONOS, ENUM_LBP_FORMAT ) + 0x2
end

@cenum vx_comp_metric_e::Int32 begin
    COMPARE_HAMMING = ENUM_BASE( ID_KHRONOS, ENUM_COMP_METRIC ) + 0x0
    COMPARE_L1 = ENUM_BASE( ID_KHRONOS, ENUM_COMP_METRIC ) + 0x1
    COMPARE_L2 = ENUM_BASE( ID_KHRONOS, ENUM_COMP_METRIC ) + 0x2
    COMPARE_CCORR = ENUM_BASE( ID_KHRONOS, ENUM_COMP_METRIC ) + 0x3
    COMPARE_L2_NORM = ENUM_BASE( ID_KHRONOS, ENUM_COMP_METRIC ) + 0x4
    COMPARE_CCORR_NORM = ENUM_BASE( ID_KHRONOS, ENUM_COMP_METRIC ) + 0x5
end

@cenum vx_map_flag_e::Int32 begin
    NOGAP_X = 1
end

@cenum vx_library_e::Int32 begin
    LIBRARY_KHR_BASE = 0x0
end

@cenum vx_kernel_e::Int32 begin
    KERNEL_COLOR_CONVERT = KERNEL_BASE(ID_KHRONOS, LIBRARY_KHR_BASE) + 0x1
    KERNEL_CHANNEL_EXTRACT = KERNEL_BASE(ID_KHRONOS, LIBRARY_KHR_BASE) + 0x2
    KERNEL_CHANNEL_COMBINE = KERNEL_BASE(ID_KHRONOS, LIBRARY_KHR_BASE) + 0x3
    KERNEL_SOBEL_3x3 = KERNEL_BASE(ID_KHRONOS, LIBRARY_KHR_BASE) + 0x4
    KERNEL_MAGNITUDE = KERNEL_BASE(ID_KHRONOS, LIBRARY_KHR_BASE) + 0x5
    KERNEL_PHASE = KERNEL_BASE(ID_KHRONOS, LIBRARY_KHR_BASE) + 0x6
    KERNEL_SCALE_IMAGE = KERNEL_BASE(ID_KHRONOS, LIBRARY_KHR_BASE) + 0x7
    KERNEL_TABLE_LOOKUP = KERNEL_BASE(ID_KHRONOS, LIBRARY_KHR_BASE) + 0x8
    KERNEL_HISTOGRAM = KERNEL_BASE(ID_KHRONOS, LIBRARY_KHR_BASE) + 0x9
    KERNEL_EQUALIZE_HISTOGRAM = KERNEL_BASE(ID_KHRONOS, LIBRARY_KHR_BASE) + 0xA
    KERNEL_ABSDIFF = KERNEL_BASE(ID_KHRONOS, LIBRARY_KHR_BASE) + 0xB
    KERNEL_MEAN_STDDEV = KERNEL_BASE(ID_KHRONOS, LIBRARY_KHR_BASE) + 0xC
    KERNEL_THRESHOLD = KERNEL_BASE(ID_KHRONOS, LIBRARY_KHR_BASE) + 0xD
    KERNEL_INTEGRAL_IMAGE = KERNEL_BASE(ID_KHRONOS, LIBRARY_KHR_BASE) + 0xE
    KERNEL_DILATE_3x3 = KERNEL_BASE(ID_KHRONOS, LIBRARY_KHR_BASE) + 0xF
    KERNEL_ERODE_3x3 = KERNEL_BASE(ID_KHRONOS, LIBRARY_KHR_BASE) + 0x10
    KERNEL_MEDIAN_3x3 = KERNEL_BASE(ID_KHRONOS, LIBRARY_KHR_BASE) + 0x11
    KERNEL_BOX_3x3 = KERNEL_BASE(ID_KHRONOS, LIBRARY_KHR_BASE) + 0x12
    KERNEL_GAUSSIAN_3x3 = KERNEL_BASE(ID_KHRONOS, LIBRARY_KHR_BASE) + 0x13
    KERNEL_CUSTOM_CONVOLUTION = KERNEL_BASE(ID_KHRONOS, LIBRARY_KHR_BASE) + 0x14
    KERNEL_GAUSSIAN_PYRAMID = KERNEL_BASE(ID_KHRONOS, LIBRARY_KHR_BASE) + 0x15
    KERNEL_ACCUMULATE = KERNEL_BASE(ID_KHRONOS, LIBRARY_KHR_BASE) + 0x16
    KERNEL_ACCUMULATE_WEIGHTED = KERNEL_BASE(ID_KHRONOS, LIBRARY_KHR_BASE) + 0x17
    KERNEL_ACCUMULATE_SQUARE = KERNEL_BASE(ID_KHRONOS, LIBRARY_KHR_BASE) + 0x18
    KERNEL_MINMAXLOC = KERNEL_BASE(ID_KHRONOS, LIBRARY_KHR_BASE) + 0x19
    KERNEL_CONVERTDEPTH = KERNEL_BASE(ID_KHRONOS, LIBRARY_KHR_BASE) + 0x1A
    KERNEL_CANNY_EDGE_DETECTOR = KERNEL_BASE(ID_KHRONOS, LIBRARY_KHR_BASE) + 0x1B
    KERNEL_AND = KERNEL_BASE(ID_KHRONOS, LIBRARY_KHR_BASE) + 0x1C
    KERNEL_OR = KERNEL_BASE(ID_KHRONOS, LIBRARY_KHR_BASE) + 0x1D
    KERNEL_XOR = KERNEL_BASE(ID_KHRONOS, LIBRARY_KHR_BASE) + 0x1E
    KERNEL_NOT = KERNEL_BASE(ID_KHRONOS, LIBRARY_KHR_BASE) + 0x1F
    KERNEL_MULTIPLY = KERNEL_BASE(ID_KHRONOS, LIBRARY_KHR_BASE) + 0x20
    KERNEL_ADD = KERNEL_BASE(ID_KHRONOS, LIBRARY_KHR_BASE) + 0x21
    KERNEL_SUBTRACT = KERNEL_BASE(ID_KHRONOS, LIBRARY_KHR_BASE) + 0x22
    KERNEL_WARP_AFFINE = KERNEL_BASE(ID_KHRONOS, LIBRARY_KHR_BASE) + 0x23
    KERNEL_WARP_PERSPECTIVE = KERNEL_BASE(ID_KHRONOS, LIBRARY_KHR_BASE) + 0x24
    KERNEL_HARRIS_CORNERS = KERNEL_BASE(ID_KHRONOS, LIBRARY_KHR_BASE) + 0x25
    KERNEL_FAST_CORNERS = KERNEL_BASE(ID_KHRONOS, LIBRARY_KHR_BASE) + 0x26
    KERNEL_OPTICAL_FLOW_PYR_LK = KERNEL_BASE(ID_KHRONOS, LIBRARY_KHR_BASE) + 0x27
    KERNEL_REMAP = KERNEL_BASE(ID_KHRONOS, LIBRARY_KHR_BASE) + 0x28
    KERNEL_HALFSCALE_GAUSSIAN = KERNEL_BASE(ID_KHRONOS, LIBRARY_KHR_BASE) + 0x29
    #VX_KERNEL_MAX_1_0 -- used internally only
    KERNEL_LAPLACIAN_PYRAMID = KERNEL_BASE(ID_KHRONOS, LIBRARY_KHR_BASE) + 0x2A
    KERNEL_LAPLACIAN_RECONSTRUCT = KERNEL_BASE(ID_KHRONOS, LIBRARY_KHR_BASE) + 0x2B
    KERNEL_NON_LINEAR_FILTER = KERNEL_BASE(ID_KHRONOS, LIBRARY_KHR_BASE) + 0x2C
    #VX_KERNEL_MAX_1_1 -- used internally only
    KERNEL_MATCH_TEMPLATE = KERNEL_BASE(ID_KHRONOS, LIBRARY_KHR_BASE) + 0x2D
    KERNEL_LBP = KERNEL_BASE(ID_KHRONOS, LIBRARY_KHR_BASE) + 0x2E
    KERNEL_HOUGH_LINES_P = KERNEL_BASE(ID_KHRONOS, LIBRARY_KHR_BASE) + 0x2F
    KERNEL_TENSOR_MULTIPLY = KERNEL_BASE(ID_KHRONOS, LIBRARY_KHR_BASE) + 0x30
    KERNEL_TENSOR_ADD = KERNEL_BASE(ID_KHRONOS, LIBRARY_KHR_BASE) + 0x31
    KERNEL_TENSOR_SUBTRACT = KERNEL_BASE(ID_KHRONOS, LIBRARY_KHR_BASE) + 0x32
    KERNEL_TENSOR_TABLE_LOOKUP = KERNEL_BASE(ID_KHRONOS, LIBRARY_KHR_BASE) + 0x33
    KERNEL_TENSOR_TRANSPOSE = KERNEL_BASE(ID_KHRONOS, LIBRARY_KHR_BASE) + 0x34
    KERNEL_TENSOR_CONVERT_DEPTH = KERNEL_BASE(ID_KHRONOS, LIBRARY_KHR_BASE) + 0x35
    KERNEL_TENSOR_MATRIX_MULTIPLY = KERNEL_BASE(ID_KHRONOS, LIBRARY_KHR_BASE) + 0x36
    KERNEL_COPY = KERNEL_BASE(ID_KHRONOS, LIBRARY_KHR_BASE) + 0x37
    KERNEL_NON_MAX_SUPPRESSION = KERNEL_BASE(ID_KHRONOS, LIBRARY_KHR_BASE) + 0x38
    KERNEL_SCALAR_OPERATION = KERNEL_BASE(ID_KHRONOS, LIBRARY_KHR_BASE) + 0x39
    KERNEL_HOG_FEATURES = KERNEL_BASE(ID_KHRONOS, LIBRARY_KHR_BASE) + 0x3A
    KERNEL_HOG_CELLS = KERNEL_BASE(ID_KHRONOS, LIBRARY_KHR_BASE) + 0x3B
    KERNEL_BILATERAL_FILTER = KERNEL_BASE(ID_KHRONOS, LIBRARY_KHR_BASE) + 0x3C
    KERNEL_SELECT = KERNEL_BASE(ID_KHRONOS, LIBRARY_KHR_BASE) + 0x3D
    #VX_KERNEL_MAX_1_2 -- used internally only
    KERNEL_MAX = KERNEL_BASE(ID_KHRONOS, LIBRARY_KHR_BASE) + 0x3E
    KERNEL_MIN = KERNEL_BASE(ID_KHRONOS, LIBRARY_KHR_BASE) + 0x3F
end

@cenum vx_kernel_nn_ext_e::Int32 begin
    KERNEL_CONVOLUTION_LAYER = 4096
    KERNEL_FULLY_CONNECTED_LAYER = 4097
    KERNEL_POOLING_LAYER = 4098
    KERNEL_SOFTMAX_LAYER = 4099
    KERNEL_NORMALIZATION_LAYER = 4100
    KERNEL_ACTIVATION_LAYER = 4101
    KERNEL_ROI_POOLING_LAYER = 4102
    KERNEL_DECONVOLUTION_LAYER = 4103
end

@cenum vx_nn_enum_e::Int32 begin
    ENUM_NN_ROUNDING_TYPE = 26
    ENUM_NN_POOLING_TYPE = 27
    ENUM_NN_NORMALIZATION_TYPE = 28
    ENUM_NN_ACTIVATION_FUNCTION_TYPE = 29
end

@cenum vx_nn_rounding_type_e::Int32 begin
    NN_DS_SIZE_ROUNDING_FLOOR = 106496
    NN_DS_SIZE_ROUNDING_CEILING = 106497
end

@cenum vx_nn_pooling_type_e::Int32 begin
    NN_POOLING_MAX = 110592
    NN_POOLING_AVG = 110593
end

@cenum vx_nn_norm_type_e::Int32 begin
    NN_NORMALIZATION_SAME_MAP = 114688
    NN_NORMALIZATION_ACROSS_MAPS = 114689
end

@cenum vx_nn_activation_function_e::Int32 begin
    NN_ACTIVATION_LOGISTIC = 118784
    NN_ACTIVATION_HYPERBOLIC_TAN = 118785
    NN_ACTIVATION_RELU = 118786
    NN_ACTIVATION_BRELU = 118787
    NN_ACTIVATION_SOFTRELU = 118788
    NN_ACTIVATION_ABS = 118789
    NN_ACTIVATION_SQUARE = 118790
    NN_ACTIVATION_SQRT = 118791
    NN_ACTIVATION_LINEAR = 118792
end

@cenum vx_nn_type_e::Int32 begin
    TYPE_NN_CONVOLUTION_PARAMS = 37
    TYPE_NN_DECONVOLUTION_PARAMS = 38
    TYPE_NN_ROI_POOL_PARAMS = 39
end

@cenum ago_type_public_e::Int32 begin
    TYPE_FLOAT16 = 15
    TYPE_STRING_AMD = 17
    AGO_TYPE_KEYPOINT_XYS = 1024
    AGO_TYPE_MEANSTDDEV_DATA = 3072
    AGO_TYPE_MINMAXLOC_DATA = 3073
    AGO_TYPE_CANNY_STACK = 3074
    AGO_TYPE_SCALE_MATRIX = 3075
end

@cenum vx_context_attribute_amd_e::Int32 begin
    CONTEXT_ATTRIBUTE_AMD_OPENCL_CONTEXT = 14156033
    CONTEXT_ATTRIBUTE_AMD_AFFINITY = 14156034
    CONTEXT_ATTRIBUTE_AMD_SET_TEXT_MACRO = 14156035
    CONTEXT_ATTRIBUTE_AMD_SET_MERGE_RULE = 14156036
    CONTEXT_MAX_TENSOR_DIMENSIONS = 14156037
    CONTEXT_CL_QUEUE_PROPERTIES = 14156038
end

@cenum vx_kernel_attribute_amd_e::Int32 begin
    KERNEL_ATTRIBUTE_AMD_QUERY_TARGET_SUPPORT = 14156801
    KERNEL_ATTRIBUTE_AMD_OPENCL_CODEGEN_CALLBACK = 14156802
    KERNEL_ATTRIBUTE_AMD_NODE_REGEN_CALLBACK = 14156803
    KERNEL_ATTRIBUTE_AMD_OPENCL_GLOBAL_WORK_UPDATE_CALLBACK = 14156804
    KERNEL_ATTRIBUTE_AMD_OPENCL_BUFFER_ACCESS_ENABLE = 14156805
    KERNEL_ATTRIBUTE_AMD_OPENCL_BUFFER_UPDATE_CALLBACK = 14156806
end

@cenum vx_graph_attribute_amd_e::Int32 begin
    GRAPH_ATTRIBUTE_AMD_AFFINITY = 14156289
    GRAPH_ATTRIBUTE_AMD_IMPORT_FROM_TEXT = 14156290
    GRAPH_ATTRIBUTE_AMD_EXPORT_TO_TEXT = 14156291
    GRAPH_ATTRIBUTE_AMD_OPTIMIZER_FLAGS = 14156292
    GRAPH_ATTRIBUTE_AMD_PERFORMANCE_INTERNAL_LAST = 14156293
    GRAPH_ATTRIBUTE_AMD_PERFORMANCE_INTERNAL_AVG = 14156294
    GRAPH_ATTRIBUTE_AMD_PERFORMANCE_INTERNAL_PROFILE = 14156295
    GRAPH_ATTRIBUTE_AMD_OPENCL_COMMAND_QUEUE = 14156296
end

@cenum vx_node_attribute_amd_e::Int32 begin
    NODE_ATTRIBUTE_AMD_AFFINITY = 14156545
    NODE_ATTRIBUTE_AMD_OPENCL_COMMAND_QUEUE = 14156546
end

@cenum vx_image_attribute_amd_e::Int32 begin
    IMAGE_ATTRIBUTE_AMD_OPENCL_BUFFER = 14159617
    IMAGE_ATTRIBUTE_AMD_OPENCL_BUFFER_OFFSET = 14159618
    IMAGE_ATTRIBUTE_AMD_ENABLE_USER_BUFFER_OPENCL = 14159619
    IMAGE_ATTRIBUTE_AMD_OPENCL_BUFFER_STRIDE = 14159620
    IMAGE_ATTRIBUTE_AMD_HOST_BUFFER = 14159621
end

@cenum vx_tensor_attribute_amd_e::Int32 begin
    TENSOR_STRIDE_OPENCL = 14161157
    TENSOR_OFFSET_OPENCL = 14161158
    TENSOR_BUFFER_OPENCL = 14161159
    TENSOR_MEMORY_TYPE = 14161160
end

@cenum vx_array_attribute_amd_e::Int32 begin
    ARRAY_BUFFER_OPENCL = 14159369
    ARRAY_BUFFER_HIP = 14159376
    ARRAY_BUFFER = 14159377
end

@cenum vx_directive_amd_e::Int32 begin
    DIRECTIVE_AMD_READ_ONLY = 13643777
    DIRECTIVE_AMD_COPY_TO_OPENCL = 13643778
    DIRECTIVE_AMD_ENABLE_PROFILE_CAPTURE = 13643779
    DIRECTIVE_AMD_DISABLE_PROFILE_CAPTURE = 13643780
    DIRECTIVE_AMD_DISABLE_OPENCL_FLUSH = 13643781
end

@cenum vx_memory_type_amd_e::Int32 begin
    MEMORY_TYPE_OPENCL = 57346
end

@cenum vx_color_space_amd_e::Int32 begin
    COLOR_SPACE_BT2020 = 13656065
end

@cenum vx_df_image_amd_e::Int32 begin
    DF_IMAGE_U1_AMD = 825241685
    DF_IMAGE_F16_AMD = 909193286
    DF_IMAGE_F32_AMD = 842215494
    DF_IMAGE_F64_AMD = 875966534
    DF_IMAGE_F32x3_AMD = 842216262
end

@cenum vx_ext_import_type_e::Int32 begin
    TYPE_IMPORT = 2068
end

@cenum vx_kernel_attribute_tiling_e::Int32 begin
    KERNEL_INPUT_NEIGHBORHOOD = 525319
    KERNEL_OUTPUT_TILE_BLOCK_SIZE = 525320
    KERNEL_BORDER = 525321
    KERNEL_TILE_MEMORY_SIZE = 525322
end

@cenum vx_node_attribute_tiling_e::Int32 begin
    NODE_INPUT_NEIGHBORHOOD = 525067
    NODE_OUTPUT_TILE_BLOCK_SIZE = 525068
    NODE_TILE_MEMORY_SIZE = 525069
end

@cenum vx_border_tiling_e::Int32 begin
    BORDER_MODE_SELF = 49155
end

@cenum vx_ext_import_types_e::Int32 begin
    IMPORT_TYPE_XML = 0
end

@cenum vx_import_attribute_e::Int32 begin
    IMPORT_ATTRIBUTE_COUNT = 529408
    IMPORT_ATTRIBUTE_TYPE = 529409
end


text:
csv2html Example

            Character
            Speech

            The multitude
            The messiah! Show us the messiah!

            Brians mother
            Now you listen here! He's not the messiah; he's a very naughty boy! Now go away!

            The multitude
            Who are you?

            Brians mother
            I'm his mother; that's who!

            The multitude
            Behold his mother! Behold his mother!

ext: jl

max_stars_repo_name: ethansaxenian/RosettaDecode

max_issues_repo_name: ethansaxenian/RosettaDecode

max_forks_repo_name: ethansaxenian/RosettaDecode


text:
module Molly

using BioStructures
using CellListMap
using ChainRulesCore
import Chemfiles # Imported to avoid clashing names
using Colors
using Combinatorics
using CUDA
using Distances
using Distributions
using EzXML
using ForwardDiff
using KernelDensity
using NearestNeighbors
import NNlib
using ProgressMeter
using Reexport
using Requires
using Unitful
using Zygote

@reexport using AtomsBase
@reexport using StaticArrays
@reexport using Unitful

using Base.Threads
using LinearAlgebra
using SparseArrays

include("types.jl")
include("cutoffs.jl")
include("spatial.jl")
include("force.jl")
include("interactions/lennard_jones.jl")
include("interactions/soft_sphere.jl")
include("interactions/mie.jl")
include("interactions/coulomb.jl")
include("interactions/coulomb_reaction_field.jl")
include("interactions/gravity.jl")
include("interactions/harmonic_bond.jl")
include("interactions/harmonic_angle.jl")
include("interactions/periodic_torsion.jl")
include("interactions/rb_torsion.jl")
include("energy.jl")
include("simulators.jl")
include("coupling.jl")
include("neighbors.jl")
include("loggers.jl")
include("analysis.jl")
include("chain_rules.jl")
include("zygote.jl")
include("setup.jl")

function __init__()
    @require GLMakie="e9467ef8-e4e7-5192-8a1a-b1aee30e663a" include("makie.jl")
end

end


text:
### A Pluto.jl notebook ###
# v0.12.18

using Markdown
using InteractiveUtils

# This Pluto notebook uses @bind for interactivity. When running this notebook outside of Pluto, the following 'mock version' of @bind gives bound variables a default value (instead of an error).
macro bind(def, element)
    quote
        local el = $(esc(element))
        global $(esc(def)) = Core.applicable(Base.get, el) ? Base.get(el) : missing
        el
    end
end

# ╔═╡ c5af5d4a-455b-11eb-0b57-4d8d63615b85
begin
	using MLDatasets
	using SimilaritySearch
	using NeighborhoodApproximationIndex
	using Colors
	using PlutoUI
end

# ╔═╡ 5cd87a9e-5506-11eb-2744-6f02144677ff
md"""
# Using the Neighborhood Approximation (NAPP) Index with MNIST

This example shows how to create a NAPP over datasets of images easily.
"""

# ╔═╡ d8d27dbc-5507-11eb-20e9-0f16ddba080b
md"""
As first step, you must download the dataset (MNIST, FashionMNIST) before fetching the train data, e.g.

```MNIST.download()```

apparently, this doesn't work on Pluto and must be done using the terminal directly and accepting the terms and conditions of using the dataset.

You can also accept it from Pluto passing keyworkd argument `i_accept_the_terms_of_use=true`, e.g., `MNIST.download(i_accept_the_terms_of_use=true)`.

"""

# ╔═╡ a23b0cae-455d-11eb-0e50-4dc31c050cc1
begin
	T, y = MNIST.traindata()
	n = size(T, 3)
	X = [Float32.(view(T, :, :, i)) for i in 1:n]
	length(X), size(X[1]), length(X[1])
end

# ╔═╡ 1ce583f6-54fb-11eb-10ad-b5dc9328ca3b
index = DeloneInvIndex(L2Distance(), X; numcenters=128, initial=:rand, maxiters=3, ksearch=3);
# index = fit(Sequential, X);

# ╔═╡ 9899d2b8-550c-11eb-3eef-59e40dfe6d26

# ╔═╡ 5b743cbc-54fa-11eb-1be4-4b619e1070b2
begin
	sel = @bind example_symbol html"<input type='range' min='1' max='$n' step='1'>"
	md"""
	select the query object using the bar: $(sel)
	"""
end

# ╔═╡ 3fb931fc-618a-11eb-2d13-eb5322bb307e
begin
	qinverted = 1 .- X[example_symbol]' # just to distinguish easily
	res = KnnResult(10)
	with_terminal() do
		@info "search time:"
		@time search(index, X[example_symbol], res)
		for p in res
			print(p.id => round(p.dist, digits=3), ", ")
		end
		println("end; k=$(length(res))")
	end
end

# ╔═╡ def63abc-45e7-11eb-231d-11d94709acd3
begin
		h = hcat(qinverted,  [X[p.id]' for p in res]...);

	md""" $(size(h))

Query Id: $(example_symbol)
database size: $(length(X))

# Result:
$(Gray.(h))

note: the symbol is the query object and its colors has been inverted
"""
end

# ╔═╡ Cell order:
# ╠═5cd87a9e-5506-11eb-2744-6f02144677ff
# ╠═c5af5d4a-455b-11eb-0b57-4d8d63615b85
# ╠═d8d27dbc-5507-11eb-20e9-0f16ddba080b
# ╠═a23b0cae-455d-11eb-0e50-4dc31c050cc1
# ╠═1ce583f6-54fb-11eb-10ad-b5dc9328ca3b
# ╠═9899d2b8-550c-11eb-3eef-59e40dfe6d26
# ╟─5b743cbc-54fa-11eb-1be4-4b619e1070b2
# ╟─3fb931fc-618a-11eb-2d13-eb5322bb307e
# ╠═def63abc-45e7-11eb-231d-11d94709acd3


text:
# Use baremodule to shave off a few KB from the serialized `.ji` file
baremodule Fontconfig_jll
using Base
using Base: UUID
import JLLWrappers

JLLWrappers.@generate_main_file_header("Fontconfig")
JLLWrappers.@generate_main_file("Fontconfig", UUID("a3f928ae-7b40-5064-980b-68af3947d34b"))
end  # module Fontconfig_jll


text:
# module Buffer

# This is really similar to the CircularBuffer implementation, but has _some_ nice things that aren't available.
# Ideally we might want to reimplement _data_frame with a DataStructures Circular Buffer to make this implementation simpler.

# Although, it might be better to keep this delinked as the data_frame implementation allows for inline memory of the arrays.

using DataFrames
import Base.size, Base.getindex

export CircularBuffer, add!, size, capacity, getindex

mutable struct CircularBuffer
    _data_frame::DataFrame
    _current_col::Int64
    _capacity::Int64
    _full::bool
    _data_types::Array
    function CircularBuffer(size, types; column_names=nothing)
        if column_names != nothing
            data_frame = DataFrame(types, column_names, size)
        else
            data_frame = DataFrame(types, size)
        end
        new(data_frame, 1, size, false, types)
    end
    function CircularBuffer(args...; kwargs...)
        data_frame = DataFrame(args...; kwargs...)
        new(data_frame, 1, size(data_frame)[1], false, eltypes(d))
    end
end

# function _set_row

function add!(buffer::CircularBuffer, experience)
    ret = buffer._current_col
    for (idx, dat) in enumerate(experience)
        buffer._data_frame[buffer._current_col, idx] = dat
    end
    buffer._current_col += 1
    if buffer._current_col > buffer._capacity
        buffer._current_col = 1
        buffer._full = true
    end
    return ret
end

function size(buffer::CircularBuffer)
    if (buffer._full)
        size(buffer._data_frame)
    else
        (buffer._current_col-1, length(buffer._data_types))
    end
end
capacity(buffer::CircularBuffer) = buffer._capacity
getindex(buffer::CircularBuffer, idx) = getindex(buffer._data_frame, idx)
getrow(buffer::CircularBuffer, idx) = buffer._data_frame[idx,:]
# get(idx::Array{Int64, 1}) = d[idx]

# end

max_stars_repo_name: mkschleg/JuliaRL

max_issues_repo_name: mkschleg/JuliaRL

max_forks_repo_name: mkschleg/JuliaRL


text:
# Deprecations in OIFITS module.

import Base: @deprecate

# Deprecated in v0.2
@deprecate readtable(ff::FITSFile) read_table(ff::FITSFile)

# Deprecated in v0.3.2
@deprecate name2Symbol(name::AbstractString) symbolicname(name::AbstractString)


text:
logmgf(model, x0, T, u) = ψ(model, u) * T - u * ψ(model, 1) * T

include("heston.jl")

# BlackScholes
analyticinterval(::BlackScholes) = (-Inf, Inf)
ψ(m::BlackScholes, u) = 0.5 * m.σ^2 * u^2

# Compound Poisson
struct CompoundPoisson
  λ::Float64
  μ::Float64
  δ::Float64
end
analyticinterval(m::CompoundPoisson) = (-3 / m.δ, 3 / m.δ)
ψ(m::CompoundPoisson, u) = m.λ * (exp(0.5 * m.δ^2 * u^2 + m.μ * u) - 1)

# Merton
ψ(m::Merton, u) =
  ψ(BlackScholes(m.α, m.σ), u) +
  ψ(CompoundPoisson(m.λ, m.μ, m.δ), u)
analyticinterval(m::Merton) = analyticinterval(CompoundPoisson(m.λ, m.μ, m.δ))

# Bates
function analyticinterval(m::Bates)
  a1, a2 = analyticinterval(Heston(m.α, m.κ, m.θ, m.σ, m.ρ))
  b1, b2 = analyticinterval(CompoundPoisson(m.λ, m.μ, m.δ))
  min(a1, b1), max(a2, b2)
end
logmgf(m::Bates, x0, T, u) =
  logmgf(Heston(m.α, m.κ, m.θ, m.σ, m.ρ), x0, T, u) +
  logmgf(CompoundPoisson(m.λ, m.μ, m.δ), x0, T, u)


text:
## code for figure gen
include("src/simulation/PaperSimulation.jl")
include("src/exampleanalysis/PaperAnalysis.jl")
include("src/figures/PaperFigures.jl")
using Plots, StatsPlots, Dates, OceanWaveSpectralFitting
theme(:vibrant)
fontsize = 10
default(xtickfontsize = fontsize, ytickfontsize = fontsize, colorbar_tickfontsize = fontsize, legendfontsize = fontsize, guidefontsize = fontsize)
pyplot(dpi = 300)
foldername = "fig/"
isdir(foldername) || mkdir(foldername)

## Figure 1 - example S(ω,ϕ)
pyplot(size = (1000,300))
plot(PaperFigures.Figure1(), colorbar = false)
savefig(foldername * "figure1_nocolorbar.png")
plot(PaperFigures.ColorFig1(PaperFigures.Figure1()))
savefig(foldername * "figure1_colorbar.png")
println("Finished figure 1")

## Figure 2 - S(ω,ϕ) vs f(ω)
pyplot(size = (1000,500))
plot(plot(PaperFigures.Figure2a()), plot(PaperFigures.Figure2b()), layout = (1,2))
savefig(foldername * "figure2.png")
println("Finished figure 2")

## Figure 3 - buoy data summary
pyplot(size = (1000,1000))
plot(PaperFigures.Figure3())
savefig(foldername * "figure3.png")
println("Finished figure 3")

## Figure 4 - S(ω,ϕ), f(ω), D(ω,ϕ)
pyplot(size = (1000,250))
plot(PaperFigures.Figure4())
savefig(foldername * "figure4.png")
println("Finished figure 4")

## Figure 5 - Vary parameters
pyplot(size = (1000,600))
plot(PaperFigures.Figure5(),legend=false)
savefig(foldername * "figure5.png")
println("Finished figure 5")

## Figure 6 - Scenario S(ω,ϕ)
pyplot(size = (1000,300))
plot(PaperFigures.Figure6())
savefig(foldername * "figure6_nocolorbar.png")
plot(PaperFigures.ColorFig6(PaperFigures.Figure6()))
savefig(foldername * "figure6_colorbar.png")
println("Finished figure 6")

## Figure 7 - Marginal parameter estimates (simulation)
pyplot(size = (1000,800))
plot(PaperFigures.Figure7(truncate=true))
savefig(foldername * "figure7.png")
plot(PaperFigures.Figure7(truncate=false))
savefig(foldername * "figure7untruncated.png")
println("Finished figure 7")

## Figure 8 - Directional parameter estimates (simulation)
pyplot(size = (1000,1000))
plot(PaperFigures.Figure8(truncate=true))
savefig(foldername * "figure8.png")
plot(PaperFigures.Figure8(truncate=false))
savefig(foldername * "figure8untruncated.png")
println("Finished figure 8")

## Figure 9 - Heatmap of ̂R(ω,t)
pyplot(size = (1000,250))
plot(PaperFigures.Figure9())
savefig(foldername * "figure9.png")
println("Finished figure 9")

## Figure 10 - Spectrogram with cutoffs
pyplot(size = (1000,250))
plot(PaperFigures.Figure10())
savefig(foldername * "figure10.png")
println("Finished figure 10")

## Figure 11 - Parameter estimates (buoy data)
pyplot(size = (1000,750))
plot(PaperFigures.Figure11())
savefig(foldername * "figure11.png")
println("Finished figure 11")