• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * By downloading, copying, installing or using the software you agree to this license.
3  * If you do not agree to this license, do not download, install,
4  * copy or use the software.
5  *
6  *
7  *                           License Agreement
8  *                For Open Source Computer Vision Library
9  *                        (3-clause BSD License)
10  *
11  * Copyright (C) 2014-2015, NVIDIA Corporation, all rights reserved.
12  * Third party copyrights are property of their respective owners.
13  *
14  * Redistribution and use in source and binary forms, with or without modification,
15  * are permitted provided that the following conditions are met:
16  *
17  *   * Redistributions of source code must retain the above copyright notice,
18  *     this list of conditions and the following disclaimer.
19  *
20  *   * Redistributions in binary form must reproduce the above copyright notice,
21  *     this list of conditions and the following disclaimer in the documentation
22  *     and/or other materials provided with the distribution.
23  *
24  *   * Neither the names of the copyright holders nor the names of the contributors
25  *     may be used to endorse or promote products derived from this software
26  *     without specific prior written permission.
27  *
28  * This software is provided by the copyright holders and contributors "as is" and
29  * any express or implied warranties, including, but not limited to, the implied
30  * warranties of merchantability and fitness for a particular purpose are disclaimed.
31  * In no event shall copyright holders or contributors be liable for any direct,
32  * indirect, incidental, special, exemplary, or consequential damages
33  * (including, but not limited to, procurement of substitute goods or services;
34  * loss of use, data, or profits; or business interruption) however caused
35  * and on any theory of liability, whether in contract, strict liability,
36  * or tort (including negligence or otherwise) arising in any way out of
37  * the use of this software, even if advised of the possibility of such damage.
38  */
39 
40 #ifndef CAROTENE_TYPES_HPP
41 #define CAROTENE_TYPES_HPP
42 
43 #include <carotene/definitions.hpp>
44 #include <stdint.h>
45 #include <cstddef>
46 
47 #ifndef UINT32_MAX
48     #define UINT32_MAX (4294967295U)
49 #endif
50 
51 namespace CAROTENE_NS {
52     using std::size_t;
53     using std::ptrdiff_t;
54 
55     typedef int8_t   s8;
56     typedef uint8_t  u8;
57     typedef int16_t  s16;
58     typedef uint16_t u16;
59     typedef int32_t  s32;
60     typedef uint32_t u32;
61     typedef float    f32;
62     typedef int64_t  s64;
63     typedef uint64_t u64;
64     typedef double   f64;
65 
66     typedef ptrdiff_t  stride_t;
67 
68     enum CONVERT_POLICY
69     {
70         CONVERT_POLICY_WRAP,
71         CONVERT_POLICY_SATURATE
72     };
73 
74     enum BORDER_MODE
75     {
76         BORDER_MODE_UNDEFINED,
77         BORDER_MODE_CONSTANT,
78         BORDER_MODE_REPLICATE,
79         BORDER_MODE_REFLECT,
80         BORDER_MODE_REFLECT101,
81         BORDER_MODE_WRAP
82     };
83 
84     enum FLIP_MODE
85     {
86         FLIP_HORIZONTAL_MODE = 1,
87         FLIP_VERTICAL_MODE = 2,
88         FLIP_BOTH_MODE = FLIP_HORIZONTAL_MODE | FLIP_VERTICAL_MODE
89     };
90 
91     enum COLOR_SPACE
92     {
93         COLOR_SPACE_BT601,
94         COLOR_SPACE_BT709
95     };
96 
97     struct Size2D {
Size2DCAROTENE_NS::Size2D98         Size2D() : width(0), height(0) {}
Size2DCAROTENE_NS::Size2D99         Size2D(size_t width_, size_t height_) : width(width_), height(height_) {}
100 
101         size_t width;
102         size_t height;
103 
totalCAROTENE_NS::Size2D104         inline size_t total() const
105         {
106             return width * height;
107         }
108     };
109 
110     struct Margin {
MarginCAROTENE_NS::Margin111         Margin() : left(0), right(0), top(0), bottom(0) {}
MarginCAROTENE_NS::Margin112         Margin(size_t left_, size_t right_, size_t top_, size_t bottom_)
113             : left(left_), right(right_), top(top_), bottom(bottom_) {}
114 
115         // these are measured in elements
116         size_t left, right, top, bottom;
117     };
118 
119     struct KeypointStore {
120         virtual void push(f32 kpX, f32 kpY, f32 kpSize, f32 kpAngle=-1, f32 kpResponse=0, s32 kpOctave=0, s32 kpClass_id=-1) = 0;
~KeypointStoreCAROTENE_NS::KeypointStore121         virtual ~KeypointStore() {};
122     };
123 }
124 
125 #endif
126