openCV library for Renesas RZ/A

Dependents:   RZ_A2M_Mbed_samples

Committer:
RyoheiHagimoto
Date:
Fri Jan 29 04:53:38 2021 +0000
Revision:
0:0e0631af0305
copied from https://github.com/d-kato/opencv-lib.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
RyoheiHagimoto 0:0e0631af0305 1 /*M///////////////////////////////////////////////////////////////////////////////////////
RyoheiHagimoto 0:0e0631af0305 2 //
RyoheiHagimoto 0:0e0631af0305 3 // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
RyoheiHagimoto 0:0e0631af0305 4 //
RyoheiHagimoto 0:0e0631af0305 5 // By downloading, copying, installing or using the software you agree to this license.
RyoheiHagimoto 0:0e0631af0305 6 // If you do not agree to this license, do not download, install,
RyoheiHagimoto 0:0e0631af0305 7 // copy or use the software.
RyoheiHagimoto 0:0e0631af0305 8 //
RyoheiHagimoto 0:0e0631af0305 9 //
RyoheiHagimoto 0:0e0631af0305 10 // License Agreement
RyoheiHagimoto 0:0e0631af0305 11 // For Open Source Computer Vision Library
RyoheiHagimoto 0:0e0631af0305 12 //
RyoheiHagimoto 0:0e0631af0305 13 // Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
RyoheiHagimoto 0:0e0631af0305 14 // Copyright (C) 2009, Willow Garage Inc., all rights reserved.
RyoheiHagimoto 0:0e0631af0305 15 // Copyright (C) 2013, OpenCV Foundation, all rights reserved.
RyoheiHagimoto 0:0e0631af0305 16 // Copyright (C) 2015, Itseez Inc., all rights reserved.
RyoheiHagimoto 0:0e0631af0305 17 // Third party copyrights are property of their respective owners.
RyoheiHagimoto 0:0e0631af0305 18 //
RyoheiHagimoto 0:0e0631af0305 19 // Redistribution and use in source and binary forms, with or without modification,
RyoheiHagimoto 0:0e0631af0305 20 // are permitted provided that the following conditions are met:
RyoheiHagimoto 0:0e0631af0305 21 //
RyoheiHagimoto 0:0e0631af0305 22 // * Redistribution's of source code must retain the above copyright notice,
RyoheiHagimoto 0:0e0631af0305 23 // this list of conditions and the following disclaimer.
RyoheiHagimoto 0:0e0631af0305 24 //
RyoheiHagimoto 0:0e0631af0305 25 // * Redistribution's in binary form must reproduce the above copyright notice,
RyoheiHagimoto 0:0e0631af0305 26 // this list of conditions and the following disclaimer in the documentation
RyoheiHagimoto 0:0e0631af0305 27 // and/or other materials provided with the distribution.
RyoheiHagimoto 0:0e0631af0305 28 //
RyoheiHagimoto 0:0e0631af0305 29 // * The name of the copyright holders may not be used to endorse or promote products
RyoheiHagimoto 0:0e0631af0305 30 // derived from this software without specific prior written permission.
RyoheiHagimoto 0:0e0631af0305 31 //
RyoheiHagimoto 0:0e0631af0305 32 // This software is provided by the copyright holders and contributors "as is" and
RyoheiHagimoto 0:0e0631af0305 33 // any express or implied warranties, including, but not limited to, the implied
RyoheiHagimoto 0:0e0631af0305 34 // warranties of merchantability and fitness for a particular purpose are disclaimed.
RyoheiHagimoto 0:0e0631af0305 35 // In no event shall the Intel Corporation or contributors be liable for any direct,
RyoheiHagimoto 0:0e0631af0305 36 // indirect, incidental, special, exemplary, or consequential damages
RyoheiHagimoto 0:0e0631af0305 37 // (including, but not limited to, procurement of substitute goods or services;
RyoheiHagimoto 0:0e0631af0305 38 // loss of use, data, or profits; or business interruption) however caused
RyoheiHagimoto 0:0e0631af0305 39 // and on any theory of liability, whether in contract, strict liability,
RyoheiHagimoto 0:0e0631af0305 40 // or tort (including negligence or otherwise) arising in any way out of
RyoheiHagimoto 0:0e0631af0305 41 // the use of this software, even if advised of the possibility of such damage.
RyoheiHagimoto 0:0e0631af0305 42 //
RyoheiHagimoto 0:0e0631af0305 43 //M*/
RyoheiHagimoto 0:0e0631af0305 44
RyoheiHagimoto 0:0e0631af0305 45 #ifndef OPENCV_CORE_CVDEF_H
RyoheiHagimoto 0:0e0631af0305 46 #define OPENCV_CORE_CVDEF_H
RyoheiHagimoto 0:0e0631af0305 47
RyoheiHagimoto 0:0e0631af0305 48 //! @addtogroup core_utils
RyoheiHagimoto 0:0e0631af0305 49 //! @{
RyoheiHagimoto 0:0e0631af0305 50
RyoheiHagimoto 0:0e0631af0305 51 #if !defined _CRT_SECURE_NO_DEPRECATE && defined _MSC_VER && _MSC_VER > 1300
RyoheiHagimoto 0:0e0631af0305 52 # define _CRT_SECURE_NO_DEPRECATE /* to avoid multiple Visual Studio warnings */
RyoheiHagimoto 0:0e0631af0305 53 #endif
RyoheiHagimoto 0:0e0631af0305 54
RyoheiHagimoto 0:0e0631af0305 55 // undef problematic defines sometimes defined by system headers (windows.h in particular)
RyoheiHagimoto 0:0e0631af0305 56 #undef small
RyoheiHagimoto 0:0e0631af0305 57 #undef min
RyoheiHagimoto 0:0e0631af0305 58 #undef max
RyoheiHagimoto 0:0e0631af0305 59 #undef abs
RyoheiHagimoto 0:0e0631af0305 60 #undef Complex
RyoheiHagimoto 0:0e0631af0305 61
RyoheiHagimoto 0:0e0631af0305 62 #if !defined _CRT_SECURE_NO_DEPRECATE && defined _MSC_VER && _MSC_VER > 1300
RyoheiHagimoto 0:0e0631af0305 63 # define _CRT_SECURE_NO_DEPRECATE /* to avoid multiple Visual Studio warnings */
RyoheiHagimoto 0:0e0631af0305 64 #endif
RyoheiHagimoto 0:0e0631af0305 65
RyoheiHagimoto 0:0e0631af0305 66 #include <limits.h>
RyoheiHagimoto 0:0e0631af0305 67 #include "opencv2/core/hal/interface.h"
RyoheiHagimoto 0:0e0631af0305 68
RyoheiHagimoto 0:0e0631af0305 69 #if defined __ICL
RyoheiHagimoto 0:0e0631af0305 70 # define CV_ICC __ICL
RyoheiHagimoto 0:0e0631af0305 71 #elif defined __ICC
RyoheiHagimoto 0:0e0631af0305 72 # define CV_ICC __ICC
RyoheiHagimoto 0:0e0631af0305 73 #elif defined __ECL
RyoheiHagimoto 0:0e0631af0305 74 # define CV_ICC __ECL
RyoheiHagimoto 0:0e0631af0305 75 #elif defined __ECC
RyoheiHagimoto 0:0e0631af0305 76 # define CV_ICC __ECC
RyoheiHagimoto 0:0e0631af0305 77 #elif defined __INTEL_COMPILER
RyoheiHagimoto 0:0e0631af0305 78 # define CV_ICC __INTEL_COMPILER
RyoheiHagimoto 0:0e0631af0305 79 #endif
RyoheiHagimoto 0:0e0631af0305 80
RyoheiHagimoto 0:0e0631af0305 81 #ifndef CV_INLINE
RyoheiHagimoto 0:0e0631af0305 82 # if defined __cplusplus
RyoheiHagimoto 0:0e0631af0305 83 # define CV_INLINE static inline
RyoheiHagimoto 0:0e0631af0305 84 # elif defined _MSC_VER
RyoheiHagimoto 0:0e0631af0305 85 # define CV_INLINE __inline
RyoheiHagimoto 0:0e0631af0305 86 # else
RyoheiHagimoto 0:0e0631af0305 87 # define CV_INLINE static
RyoheiHagimoto 0:0e0631af0305 88 # endif
RyoheiHagimoto 0:0e0631af0305 89 #endif
RyoheiHagimoto 0:0e0631af0305 90
RyoheiHagimoto 0:0e0631af0305 91 #if defined CV_ICC && !defined CV_ENABLE_UNROLLED
RyoheiHagimoto 0:0e0631af0305 92 # define CV_ENABLE_UNROLLED 0
RyoheiHagimoto 0:0e0631af0305 93 #else
RyoheiHagimoto 0:0e0631af0305 94 # define CV_ENABLE_UNROLLED 1
RyoheiHagimoto 0:0e0631af0305 95 #endif
RyoheiHagimoto 0:0e0631af0305 96
RyoheiHagimoto 0:0e0631af0305 97 #ifdef __GNUC__
RyoheiHagimoto 0:0e0631af0305 98 # define CV_DECL_ALIGNED(x) __attribute__ ((aligned (x)))
RyoheiHagimoto 0:0e0631af0305 99 #elif defined _MSC_VER
RyoheiHagimoto 0:0e0631af0305 100 # define CV_DECL_ALIGNED(x) __declspec(align(x))
RyoheiHagimoto 0:0e0631af0305 101 #else
RyoheiHagimoto 0:0e0631af0305 102 # define CV_DECL_ALIGNED(x)
RyoheiHagimoto 0:0e0631af0305 103 #endif
RyoheiHagimoto 0:0e0631af0305 104
RyoheiHagimoto 0:0e0631af0305 105 /* CPU features and intrinsics support */
RyoheiHagimoto 0:0e0631af0305 106 #define CV_CPU_NONE 0
RyoheiHagimoto 0:0e0631af0305 107 #define CV_CPU_MMX 1
RyoheiHagimoto 0:0e0631af0305 108 #define CV_CPU_SSE 2
RyoheiHagimoto 0:0e0631af0305 109 #define CV_CPU_SSE2 3
RyoheiHagimoto 0:0e0631af0305 110 #define CV_CPU_SSE3 4
RyoheiHagimoto 0:0e0631af0305 111 #define CV_CPU_SSSE3 5
RyoheiHagimoto 0:0e0631af0305 112 #define CV_CPU_SSE4_1 6
RyoheiHagimoto 0:0e0631af0305 113 #define CV_CPU_SSE4_2 7
RyoheiHagimoto 0:0e0631af0305 114 #define CV_CPU_POPCNT 8
RyoheiHagimoto 0:0e0631af0305 115 #define CV_CPU_FP16 9
RyoheiHagimoto 0:0e0631af0305 116 #define CV_CPU_AVX 10
RyoheiHagimoto 0:0e0631af0305 117 #define CV_CPU_AVX2 11
RyoheiHagimoto 0:0e0631af0305 118 #define CV_CPU_FMA3 12
RyoheiHagimoto 0:0e0631af0305 119
RyoheiHagimoto 0:0e0631af0305 120 #define CV_CPU_AVX_512F 13
RyoheiHagimoto 0:0e0631af0305 121 #define CV_CPU_AVX_512BW 14
RyoheiHagimoto 0:0e0631af0305 122 #define CV_CPU_AVX_512CD 15
RyoheiHagimoto 0:0e0631af0305 123 #define CV_CPU_AVX_512DQ 16
RyoheiHagimoto 0:0e0631af0305 124 #define CV_CPU_AVX_512ER 17
RyoheiHagimoto 0:0e0631af0305 125 #define CV_CPU_AVX_512IFMA512 18
RyoheiHagimoto 0:0e0631af0305 126 #define CV_CPU_AVX_512PF 19
RyoheiHagimoto 0:0e0631af0305 127 #define CV_CPU_AVX_512VBMI 20
RyoheiHagimoto 0:0e0631af0305 128 #define CV_CPU_AVX_512VL 21
RyoheiHagimoto 0:0e0631af0305 129
RyoheiHagimoto 0:0e0631af0305 130 #define CV_CPU_NEON 100
RyoheiHagimoto 0:0e0631af0305 131
RyoheiHagimoto 0:0e0631af0305 132 // when adding to this list remember to update the following enum
RyoheiHagimoto 0:0e0631af0305 133 #define CV_HARDWARE_MAX_FEATURE 255
RyoheiHagimoto 0:0e0631af0305 134
RyoheiHagimoto 0:0e0631af0305 135 /** @brief Available CPU features.
RyoheiHagimoto 0:0e0631af0305 136 */
RyoheiHagimoto 0:0e0631af0305 137 enum CpuFeatures {
RyoheiHagimoto 0:0e0631af0305 138 CPU_MMX = 1,
RyoheiHagimoto 0:0e0631af0305 139 CPU_SSE = 2,
RyoheiHagimoto 0:0e0631af0305 140 CPU_SSE2 = 3,
RyoheiHagimoto 0:0e0631af0305 141 CPU_SSE3 = 4,
RyoheiHagimoto 0:0e0631af0305 142 CPU_SSSE3 = 5,
RyoheiHagimoto 0:0e0631af0305 143 CPU_SSE4_1 = 6,
RyoheiHagimoto 0:0e0631af0305 144 CPU_SSE4_2 = 7,
RyoheiHagimoto 0:0e0631af0305 145 CPU_POPCNT = 8,
RyoheiHagimoto 0:0e0631af0305 146 CPU_FP16 = 9,
RyoheiHagimoto 0:0e0631af0305 147 CPU_AVX = 10,
RyoheiHagimoto 0:0e0631af0305 148 CPU_AVX2 = 11,
RyoheiHagimoto 0:0e0631af0305 149 CPU_FMA3 = 12,
RyoheiHagimoto 0:0e0631af0305 150
RyoheiHagimoto 0:0e0631af0305 151 CPU_AVX_512F = 13,
RyoheiHagimoto 0:0e0631af0305 152 CPU_AVX_512BW = 14,
RyoheiHagimoto 0:0e0631af0305 153 CPU_AVX_512CD = 15,
RyoheiHagimoto 0:0e0631af0305 154 CPU_AVX_512DQ = 16,
RyoheiHagimoto 0:0e0631af0305 155 CPU_AVX_512ER = 17,
RyoheiHagimoto 0:0e0631af0305 156 CPU_AVX_512IFMA512 = 18,
RyoheiHagimoto 0:0e0631af0305 157 CPU_AVX_512PF = 19,
RyoheiHagimoto 0:0e0631af0305 158 CPU_AVX_512VBMI = 20,
RyoheiHagimoto 0:0e0631af0305 159 CPU_AVX_512VL = 21,
RyoheiHagimoto 0:0e0631af0305 160
RyoheiHagimoto 0:0e0631af0305 161 CPU_NEON = 100
RyoheiHagimoto 0:0e0631af0305 162 };
RyoheiHagimoto 0:0e0631af0305 163
RyoheiHagimoto 0:0e0631af0305 164 // do not include SSE/AVX/NEON headers for NVCC compiler
RyoheiHagimoto 0:0e0631af0305 165 #ifndef __CUDACC__
RyoheiHagimoto 0:0e0631af0305 166
RyoheiHagimoto 0:0e0631af0305 167 #if defined __SSE2__ || defined _M_X64 || (defined _M_IX86_FP && _M_IX86_FP >= 2)
RyoheiHagimoto 0:0e0631af0305 168 # include <emmintrin.h>
RyoheiHagimoto 0:0e0631af0305 169 # define CV_MMX 1
RyoheiHagimoto 0:0e0631af0305 170 # define CV_SSE 1
RyoheiHagimoto 0:0e0631af0305 171 # define CV_SSE2 1
RyoheiHagimoto 0:0e0631af0305 172 # if defined __SSE3__ || (defined _MSC_VER && _MSC_VER >= 1500)
RyoheiHagimoto 0:0e0631af0305 173 # include <pmmintrin.h>
RyoheiHagimoto 0:0e0631af0305 174 # define CV_SSE3 1
RyoheiHagimoto 0:0e0631af0305 175 # endif
RyoheiHagimoto 0:0e0631af0305 176 # if defined __SSSE3__ || (defined _MSC_VER && _MSC_VER >= 1500)
RyoheiHagimoto 0:0e0631af0305 177 # include <tmmintrin.h>
RyoheiHagimoto 0:0e0631af0305 178 # define CV_SSSE3 1
RyoheiHagimoto 0:0e0631af0305 179 # endif
RyoheiHagimoto 0:0e0631af0305 180 # if defined __SSE4_1__ || (defined _MSC_VER && _MSC_VER >= 1500)
RyoheiHagimoto 0:0e0631af0305 181 # include <smmintrin.h>
RyoheiHagimoto 0:0e0631af0305 182 # define CV_SSE4_1 1
RyoheiHagimoto 0:0e0631af0305 183 # endif
RyoheiHagimoto 0:0e0631af0305 184 # if defined __SSE4_2__ || (defined _MSC_VER && _MSC_VER >= 1500)
RyoheiHagimoto 0:0e0631af0305 185 # include <nmmintrin.h>
RyoheiHagimoto 0:0e0631af0305 186 # define CV_SSE4_2 1
RyoheiHagimoto 0:0e0631af0305 187 # endif
RyoheiHagimoto 0:0e0631af0305 188 # if defined __POPCNT__ || (defined _MSC_VER && _MSC_VER >= 1500)
RyoheiHagimoto 0:0e0631af0305 189 # ifdef _MSC_VER
RyoheiHagimoto 0:0e0631af0305 190 # include <nmmintrin.h>
RyoheiHagimoto 0:0e0631af0305 191 # else
RyoheiHagimoto 0:0e0631af0305 192 # include <popcntintrin.h>
RyoheiHagimoto 0:0e0631af0305 193 # endif
RyoheiHagimoto 0:0e0631af0305 194 # define CV_POPCNT 1
RyoheiHagimoto 0:0e0631af0305 195 # endif
RyoheiHagimoto 0:0e0631af0305 196 # if defined __AVX__ || (defined _MSC_VER && _MSC_VER >= 1600 && 0)
RyoheiHagimoto 0:0e0631af0305 197 // MS Visual Studio 2010 (2012?) has no macro pre-defined to identify the use of /arch:AVX
RyoheiHagimoto 0:0e0631af0305 198 // See: http://connect.microsoft.com/VisualStudio/feedback/details/605858/arch-avx-should-define-a-predefined-macro-in-x64-and-set-a-unique-value-for-m-ix86-fp-in-win32
RyoheiHagimoto 0:0e0631af0305 199 # include <immintrin.h>
RyoheiHagimoto 0:0e0631af0305 200 # define CV_AVX 1
RyoheiHagimoto 0:0e0631af0305 201 # if defined(_XCR_XFEATURE_ENABLED_MASK)
RyoheiHagimoto 0:0e0631af0305 202 # define __xgetbv() _xgetbv(_XCR_XFEATURE_ENABLED_MASK)
RyoheiHagimoto 0:0e0631af0305 203 # else
RyoheiHagimoto 0:0e0631af0305 204 # define __xgetbv() 0
RyoheiHagimoto 0:0e0631af0305 205 # endif
RyoheiHagimoto 0:0e0631af0305 206 # endif
RyoheiHagimoto 0:0e0631af0305 207 # if defined __AVX2__ || (defined _MSC_VER && _MSC_VER >= 1800 && 0)
RyoheiHagimoto 0:0e0631af0305 208 # include <immintrin.h>
RyoheiHagimoto 0:0e0631af0305 209 # define CV_AVX2 1
RyoheiHagimoto 0:0e0631af0305 210 # if defined __FMA__
RyoheiHagimoto 0:0e0631af0305 211 # define CV_FMA3 1
RyoheiHagimoto 0:0e0631af0305 212 # endif
RyoheiHagimoto 0:0e0631af0305 213 # endif
RyoheiHagimoto 0:0e0631af0305 214 #endif
RyoheiHagimoto 0:0e0631af0305 215
RyoheiHagimoto 0:0e0631af0305 216 #if (defined WIN32 || defined _WIN32) && defined(_M_ARM)
RyoheiHagimoto 0:0e0631af0305 217 # include <Intrin.h>
RyoheiHagimoto 0:0e0631af0305 218 # include <arm_neon.h>
RyoheiHagimoto 0:0e0631af0305 219 # define CV_NEON 1
RyoheiHagimoto 0:0e0631af0305 220 # define CPU_HAS_NEON_FEATURE (true)
RyoheiHagimoto 0:0e0631af0305 221 #elif defined(__ARM_NEON__) || (defined (__ARM_NEON) && defined(__aarch64__))
RyoheiHagimoto 0:0e0631af0305 222 # include <arm_neon.h>
RyoheiHagimoto 0:0e0631af0305 223 # define CV_NEON 1
RyoheiHagimoto 0:0e0631af0305 224 #endif
RyoheiHagimoto 0:0e0631af0305 225
RyoheiHagimoto 0:0e0631af0305 226 #if defined __GNUC__ && defined __arm__ && (defined __ARM_PCS_VFP || defined __ARM_VFPV3__ || defined __ARM_NEON__) && !defined __SOFTFP__
RyoheiHagimoto 0:0e0631af0305 227 # define CV_VFP 1
RyoheiHagimoto 0:0e0631af0305 228 #endif
RyoheiHagimoto 0:0e0631af0305 229
RyoheiHagimoto 0:0e0631af0305 230 #endif // __CUDACC__
RyoheiHagimoto 0:0e0631af0305 231
RyoheiHagimoto 0:0e0631af0305 232 #ifndef CV_POPCNT
RyoheiHagimoto 0:0e0631af0305 233 #define CV_POPCNT 0
RyoheiHagimoto 0:0e0631af0305 234 #endif
RyoheiHagimoto 0:0e0631af0305 235 #ifndef CV_MMX
RyoheiHagimoto 0:0e0631af0305 236 # define CV_MMX 0
RyoheiHagimoto 0:0e0631af0305 237 #endif
RyoheiHagimoto 0:0e0631af0305 238 #ifndef CV_SSE
RyoheiHagimoto 0:0e0631af0305 239 # define CV_SSE 0
RyoheiHagimoto 0:0e0631af0305 240 #endif
RyoheiHagimoto 0:0e0631af0305 241 #ifndef CV_SSE2
RyoheiHagimoto 0:0e0631af0305 242 # define CV_SSE2 0
RyoheiHagimoto 0:0e0631af0305 243 #endif
RyoheiHagimoto 0:0e0631af0305 244 #ifndef CV_SSE3
RyoheiHagimoto 0:0e0631af0305 245 # define CV_SSE3 0
RyoheiHagimoto 0:0e0631af0305 246 #endif
RyoheiHagimoto 0:0e0631af0305 247 #ifndef CV_SSSE3
RyoheiHagimoto 0:0e0631af0305 248 # define CV_SSSE3 0
RyoheiHagimoto 0:0e0631af0305 249 #endif
RyoheiHagimoto 0:0e0631af0305 250 #ifndef CV_SSE4_1
RyoheiHagimoto 0:0e0631af0305 251 # define CV_SSE4_1 0
RyoheiHagimoto 0:0e0631af0305 252 #endif
RyoheiHagimoto 0:0e0631af0305 253 #ifndef CV_SSE4_2
RyoheiHagimoto 0:0e0631af0305 254 # define CV_SSE4_2 0
RyoheiHagimoto 0:0e0631af0305 255 #endif
RyoheiHagimoto 0:0e0631af0305 256 #ifndef CV_AVX
RyoheiHagimoto 0:0e0631af0305 257 # define CV_AVX 0
RyoheiHagimoto 0:0e0631af0305 258 #endif
RyoheiHagimoto 0:0e0631af0305 259 #ifndef CV_AVX2
RyoheiHagimoto 0:0e0631af0305 260 # define CV_AVX2 0
RyoheiHagimoto 0:0e0631af0305 261 #endif
RyoheiHagimoto 0:0e0631af0305 262 #ifndef CV_FMA3
RyoheiHagimoto 0:0e0631af0305 263 # define CV_FMA3 0
RyoheiHagimoto 0:0e0631af0305 264 #endif
RyoheiHagimoto 0:0e0631af0305 265 #ifndef CV_AVX_512F
RyoheiHagimoto 0:0e0631af0305 266 # define CV_AVX_512F 0
RyoheiHagimoto 0:0e0631af0305 267 #endif
RyoheiHagimoto 0:0e0631af0305 268 #ifndef CV_AVX_512BW
RyoheiHagimoto 0:0e0631af0305 269 # define CV_AVX_512BW 0
RyoheiHagimoto 0:0e0631af0305 270 #endif
RyoheiHagimoto 0:0e0631af0305 271 #ifndef CV_AVX_512CD
RyoheiHagimoto 0:0e0631af0305 272 # define CV_AVX_512CD 0
RyoheiHagimoto 0:0e0631af0305 273 #endif
RyoheiHagimoto 0:0e0631af0305 274 #ifndef CV_AVX_512DQ
RyoheiHagimoto 0:0e0631af0305 275 # define CV_AVX_512DQ 0
RyoheiHagimoto 0:0e0631af0305 276 #endif
RyoheiHagimoto 0:0e0631af0305 277 #ifndef CV_AVX_512ER
RyoheiHagimoto 0:0e0631af0305 278 # define CV_AVX_512ER 0
RyoheiHagimoto 0:0e0631af0305 279 #endif
RyoheiHagimoto 0:0e0631af0305 280 #ifndef CV_AVX_512IFMA512
RyoheiHagimoto 0:0e0631af0305 281 # define CV_AVX_512IFMA512 0
RyoheiHagimoto 0:0e0631af0305 282 #endif
RyoheiHagimoto 0:0e0631af0305 283 #ifndef CV_AVX_512PF
RyoheiHagimoto 0:0e0631af0305 284 # define CV_AVX_512PF 0
RyoheiHagimoto 0:0e0631af0305 285 #endif
RyoheiHagimoto 0:0e0631af0305 286 #ifndef CV_AVX_512VBMI
RyoheiHagimoto 0:0e0631af0305 287 # define CV_AVX_512VBMI 0
RyoheiHagimoto 0:0e0631af0305 288 #endif
RyoheiHagimoto 0:0e0631af0305 289 #ifndef CV_AVX_512VL
RyoheiHagimoto 0:0e0631af0305 290 # define CV_AVX_512VL 0
RyoheiHagimoto 0:0e0631af0305 291 #endif
RyoheiHagimoto 0:0e0631af0305 292
RyoheiHagimoto 0:0e0631af0305 293 #ifndef CV_NEON
RyoheiHagimoto 0:0e0631af0305 294 # define CV_NEON 0
RyoheiHagimoto 0:0e0631af0305 295 #endif
RyoheiHagimoto 0:0e0631af0305 296
RyoheiHagimoto 0:0e0631af0305 297 #ifndef CV_VFP
RyoheiHagimoto 0:0e0631af0305 298 # define CV_VFP 0
RyoheiHagimoto 0:0e0631af0305 299 #endif
RyoheiHagimoto 0:0e0631af0305 300
RyoheiHagimoto 0:0e0631af0305 301 /* fundamental constants */
RyoheiHagimoto 0:0e0631af0305 302 #define CV_PI 3.1415926535897932384626433832795
RyoheiHagimoto 0:0e0631af0305 303 #define CV_2PI 6.283185307179586476925286766559
RyoheiHagimoto 0:0e0631af0305 304 #define CV_LOG2 0.69314718055994530941723212145818
RyoheiHagimoto 0:0e0631af0305 305
RyoheiHagimoto 0:0e0631af0305 306 #if defined __ARM_FP16_FORMAT_IEEE \
RyoheiHagimoto 0:0e0631af0305 307 && !defined __CUDACC__
RyoheiHagimoto 0:0e0631af0305 308 # define CV_FP16_TYPE 1
RyoheiHagimoto 0:0e0631af0305 309 #else
RyoheiHagimoto 0:0e0631af0305 310 # define CV_FP16_TYPE 0
RyoheiHagimoto 0:0e0631af0305 311 #endif
RyoheiHagimoto 0:0e0631af0305 312
RyoheiHagimoto 0:0e0631af0305 313 typedef union Cv16suf
RyoheiHagimoto 0:0e0631af0305 314 {
RyoheiHagimoto 0:0e0631af0305 315 short i;
RyoheiHagimoto 0:0e0631af0305 316 #if CV_FP16_TYPE
RyoheiHagimoto 0:0e0631af0305 317 __fp16 h;
RyoheiHagimoto 0:0e0631af0305 318 #endif
RyoheiHagimoto 0:0e0631af0305 319 struct _fp16Format
RyoheiHagimoto 0:0e0631af0305 320 {
RyoheiHagimoto 0:0e0631af0305 321 unsigned int significand : 10;
RyoheiHagimoto 0:0e0631af0305 322 unsigned int exponent : 5;
RyoheiHagimoto 0:0e0631af0305 323 unsigned int sign : 1;
RyoheiHagimoto 0:0e0631af0305 324 } fmt;
RyoheiHagimoto 0:0e0631af0305 325 }
RyoheiHagimoto 0:0e0631af0305 326 Cv16suf;
RyoheiHagimoto 0:0e0631af0305 327
RyoheiHagimoto 0:0e0631af0305 328 typedef union Cv32suf
RyoheiHagimoto 0:0e0631af0305 329 {
RyoheiHagimoto 0:0e0631af0305 330 int i;
RyoheiHagimoto 0:0e0631af0305 331 unsigned u;
RyoheiHagimoto 0:0e0631af0305 332 float f;
RyoheiHagimoto 0:0e0631af0305 333 struct _fp32Format
RyoheiHagimoto 0:0e0631af0305 334 {
RyoheiHagimoto 0:0e0631af0305 335 unsigned int significand : 23;
RyoheiHagimoto 0:0e0631af0305 336 unsigned int exponent : 8;
RyoheiHagimoto 0:0e0631af0305 337 unsigned int sign : 1;
RyoheiHagimoto 0:0e0631af0305 338 } fmt;
RyoheiHagimoto 0:0e0631af0305 339 }
RyoheiHagimoto 0:0e0631af0305 340 Cv32suf;
RyoheiHagimoto 0:0e0631af0305 341
RyoheiHagimoto 0:0e0631af0305 342 typedef union Cv64suf
RyoheiHagimoto 0:0e0631af0305 343 {
RyoheiHagimoto 0:0e0631af0305 344 int64 i;
RyoheiHagimoto 0:0e0631af0305 345 uint64 u;
RyoheiHagimoto 0:0e0631af0305 346 double f;
RyoheiHagimoto 0:0e0631af0305 347 }
RyoheiHagimoto 0:0e0631af0305 348 Cv64suf;
RyoheiHagimoto 0:0e0631af0305 349
RyoheiHagimoto 0:0e0631af0305 350 #define OPENCV_ABI_COMPATIBILITY 300
RyoheiHagimoto 0:0e0631af0305 351
RyoheiHagimoto 0:0e0631af0305 352 #ifdef __OPENCV_BUILD
RyoheiHagimoto 0:0e0631af0305 353 # define DISABLE_OPENCV_24_COMPATIBILITY
RyoheiHagimoto 0:0e0631af0305 354 #endif
RyoheiHagimoto 0:0e0631af0305 355
RyoheiHagimoto 0:0e0631af0305 356 #if (defined WIN32 || defined _WIN32 || defined WINCE || defined __CYGWIN__) && defined CVAPI_EXPORTS
RyoheiHagimoto 0:0e0631af0305 357 # define CV_EXPORTS __declspec(dllexport)
RyoheiHagimoto 0:0e0631af0305 358 #elif defined __GNUC__ && __GNUC__ >= 4
RyoheiHagimoto 0:0e0631af0305 359 # define CV_EXPORTS __attribute__ ((visibility ("default")))
RyoheiHagimoto 0:0e0631af0305 360 #else
RyoheiHagimoto 0:0e0631af0305 361 # define CV_EXPORTS
RyoheiHagimoto 0:0e0631af0305 362 #endif
RyoheiHagimoto 0:0e0631af0305 363
RyoheiHagimoto 0:0e0631af0305 364 #ifndef CV_EXTERN_C
RyoheiHagimoto 0:0e0631af0305 365 # ifdef __cplusplus
RyoheiHagimoto 0:0e0631af0305 366 # define CV_EXTERN_C extern "C"
RyoheiHagimoto 0:0e0631af0305 367 # else
RyoheiHagimoto 0:0e0631af0305 368 # define CV_EXTERN_C
RyoheiHagimoto 0:0e0631af0305 369 # endif
RyoheiHagimoto 0:0e0631af0305 370 #endif
RyoheiHagimoto 0:0e0631af0305 371
RyoheiHagimoto 0:0e0631af0305 372 /* special informative macros for wrapper generators */
RyoheiHagimoto 0:0e0631af0305 373 #define CV_EXPORTS_W CV_EXPORTS
RyoheiHagimoto 0:0e0631af0305 374 #define CV_EXPORTS_W_SIMPLE CV_EXPORTS
RyoheiHagimoto 0:0e0631af0305 375 #define CV_EXPORTS_AS(synonym) CV_EXPORTS
RyoheiHagimoto 0:0e0631af0305 376 #define CV_EXPORTS_W_MAP CV_EXPORTS
RyoheiHagimoto 0:0e0631af0305 377 #define CV_IN_OUT
RyoheiHagimoto 0:0e0631af0305 378 #define CV_OUT
RyoheiHagimoto 0:0e0631af0305 379 #define CV_PROP
RyoheiHagimoto 0:0e0631af0305 380 #define CV_PROP_RW
RyoheiHagimoto 0:0e0631af0305 381 #define CV_WRAP
RyoheiHagimoto 0:0e0631af0305 382 #define CV_WRAP_AS(synonym)
RyoheiHagimoto 0:0e0631af0305 383
RyoheiHagimoto 0:0e0631af0305 384 /****************************************************************************************\
RyoheiHagimoto 0:0e0631af0305 385 * Matrix type (Mat) *
RyoheiHagimoto 0:0e0631af0305 386 \****************************************************************************************/
RyoheiHagimoto 0:0e0631af0305 387
RyoheiHagimoto 0:0e0631af0305 388 #define CV_MAT_CN_MASK ((CV_CN_MAX - 1) << CV_CN_SHIFT)
RyoheiHagimoto 0:0e0631af0305 389 #define CV_MAT_CN(flags) ((((flags) & CV_MAT_CN_MASK) >> CV_CN_SHIFT) + 1)
RyoheiHagimoto 0:0e0631af0305 390 #define CV_MAT_TYPE_MASK (CV_DEPTH_MAX*CV_CN_MAX - 1)
RyoheiHagimoto 0:0e0631af0305 391 #define CV_MAT_TYPE(flags) ((flags) & CV_MAT_TYPE_MASK)
RyoheiHagimoto 0:0e0631af0305 392 #define CV_MAT_CONT_FLAG_SHIFT 14
RyoheiHagimoto 0:0e0631af0305 393 #define CV_MAT_CONT_FLAG (1 << CV_MAT_CONT_FLAG_SHIFT)
RyoheiHagimoto 0:0e0631af0305 394 #define CV_IS_MAT_CONT(flags) ((flags) & CV_MAT_CONT_FLAG)
RyoheiHagimoto 0:0e0631af0305 395 #define CV_IS_CONT_MAT CV_IS_MAT_CONT
RyoheiHagimoto 0:0e0631af0305 396 #define CV_SUBMAT_FLAG_SHIFT 15
RyoheiHagimoto 0:0e0631af0305 397 #define CV_SUBMAT_FLAG (1 << CV_SUBMAT_FLAG_SHIFT)
RyoheiHagimoto 0:0e0631af0305 398 #define CV_IS_SUBMAT(flags) ((flags) & CV_MAT_SUBMAT_FLAG)
RyoheiHagimoto 0:0e0631af0305 399
RyoheiHagimoto 0:0e0631af0305 400 /** Size of each channel item,
RyoheiHagimoto 0:0e0631af0305 401 0x124489 = 1000 0100 0100 0010 0010 0001 0001 ~ array of sizeof(arr_type_elem) */
RyoheiHagimoto 0:0e0631af0305 402 #define CV_ELEM_SIZE1(type) \
RyoheiHagimoto 0:0e0631af0305 403 ((((sizeof(size_t)<<28)|0x8442211) >> CV_MAT_DEPTH(type)*4) & 15)
RyoheiHagimoto 0:0e0631af0305 404
RyoheiHagimoto 0:0e0631af0305 405 /** 0x3a50 = 11 10 10 01 01 00 00 ~ array of log2(sizeof(arr_type_elem)) */
RyoheiHagimoto 0:0e0631af0305 406 #define CV_ELEM_SIZE(type) \
RyoheiHagimoto 0:0e0631af0305 407 (CV_MAT_CN(type) << ((((sizeof(size_t)/4+1)*16384|0x3a50) >> CV_MAT_DEPTH(type)*2) & 3))
RyoheiHagimoto 0:0e0631af0305 408
RyoheiHagimoto 0:0e0631af0305 409 #ifndef MIN
RyoheiHagimoto 0:0e0631af0305 410 # define MIN(a,b) ((a) > (b) ? (b) : (a))
RyoheiHagimoto 0:0e0631af0305 411 #endif
RyoheiHagimoto 0:0e0631af0305 412
RyoheiHagimoto 0:0e0631af0305 413 #ifndef MAX
RyoheiHagimoto 0:0e0631af0305 414 # define MAX(a,b) ((a) < (b) ? (b) : (a))
RyoheiHagimoto 0:0e0631af0305 415 #endif
RyoheiHagimoto 0:0e0631af0305 416
RyoheiHagimoto 0:0e0631af0305 417 /****************************************************************************************\
RyoheiHagimoto 0:0e0631af0305 418 * exchange-add operation for atomic operations on reference counters *
RyoheiHagimoto 0:0e0631af0305 419 \****************************************************************************************/
RyoheiHagimoto 0:0e0631af0305 420
RyoheiHagimoto 0:0e0631af0305 421 #ifdef CV_XADD
RyoheiHagimoto 0:0e0631af0305 422 // allow to use user-defined macro
RyoheiHagimoto 0:0e0631af0305 423 #elif defined __GNUC__
RyoheiHagimoto 0:0e0631af0305 424 # if defined __clang__ && __clang_major__ >= 3 && !defined __ANDROID__ && !defined __EMSCRIPTEN__ && !defined(__CUDACC__)
RyoheiHagimoto 0:0e0631af0305 425 # ifdef __ATOMIC_ACQ_REL
RyoheiHagimoto 0:0e0631af0305 426 # define CV_XADD(addr, delta) __c11_atomic_fetch_add((_Atomic(int)*)(addr), delta, __ATOMIC_ACQ_REL)
RyoheiHagimoto 0:0e0631af0305 427 # else
RyoheiHagimoto 0:0e0631af0305 428 # define CV_XADD(addr, delta) __atomic_fetch_add((_Atomic(int)*)(addr), delta, 4)
RyoheiHagimoto 0:0e0631af0305 429 # endif
RyoheiHagimoto 0:0e0631af0305 430 # else
RyoheiHagimoto 0:0e0631af0305 431 # if defined __ATOMIC_ACQ_REL && !defined __clang__
RyoheiHagimoto 0:0e0631af0305 432 // version for gcc >= 4.7
RyoheiHagimoto 0:0e0631af0305 433 # define CV_XADD(addr, delta) (int)__atomic_fetch_add((unsigned*)(addr), (unsigned)(delta), __ATOMIC_ACQ_REL)
RyoheiHagimoto 0:0e0631af0305 434 # else
RyoheiHagimoto 0:0e0631af0305 435 # define CV_XADD(addr, delta) (int)__sync_fetch_and_add((unsigned*)(addr), (unsigned)(delta))
RyoheiHagimoto 0:0e0631af0305 436 # endif
RyoheiHagimoto 0:0e0631af0305 437 # endif
RyoheiHagimoto 0:0e0631af0305 438 #elif defined _MSC_VER && !defined RC_INVOKED
RyoheiHagimoto 0:0e0631af0305 439 # include <intrin.h>
RyoheiHagimoto 0:0e0631af0305 440 # define CV_XADD(addr, delta) (int)_InterlockedExchangeAdd((long volatile*)addr, delta)
RyoheiHagimoto 0:0e0631af0305 441 #else
RyoheiHagimoto 0:0e0631af0305 442 CV_INLINE CV_XADD(int* addr, int delta) { int tmp = *addr; *addr += delta; return tmp; }
RyoheiHagimoto 0:0e0631af0305 443 #endif
RyoheiHagimoto 0:0e0631af0305 444
RyoheiHagimoto 0:0e0631af0305 445
RyoheiHagimoto 0:0e0631af0305 446 /****************************************************************************************\
RyoheiHagimoto 0:0e0631af0305 447 * CV_NORETURN attribute *
RyoheiHagimoto 0:0e0631af0305 448 \****************************************************************************************/
RyoheiHagimoto 0:0e0631af0305 449
RyoheiHagimoto 0:0e0631af0305 450 #ifndef CV_NORETURN
RyoheiHagimoto 0:0e0631af0305 451 # if defined(__GNUC__)
RyoheiHagimoto 0:0e0631af0305 452 # define CV_NORETURN __attribute__((__noreturn__))
RyoheiHagimoto 0:0e0631af0305 453 # elif defined(_MSC_VER) && (_MSC_VER >= 1300)
RyoheiHagimoto 0:0e0631af0305 454 # define CV_NORETURN __declspec(noreturn)
RyoheiHagimoto 0:0e0631af0305 455 # else
RyoheiHagimoto 0:0e0631af0305 456 # define CV_NORETURN /* nothing by default */
RyoheiHagimoto 0:0e0631af0305 457 # endif
RyoheiHagimoto 0:0e0631af0305 458 #endif
RyoheiHagimoto 0:0e0631af0305 459
RyoheiHagimoto 0:0e0631af0305 460
RyoheiHagimoto 0:0e0631af0305 461 /****************************************************************************************\
RyoheiHagimoto 0:0e0631af0305 462 * C++ Move semantics *
RyoheiHagimoto 0:0e0631af0305 463 \****************************************************************************************/
RyoheiHagimoto 0:0e0631af0305 464
RyoheiHagimoto 0:0e0631af0305 465 #ifndef CV_CXX_MOVE_SEMANTICS
RyoheiHagimoto 0:0e0631af0305 466 # if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__) || defined(_MSC_VER) && _MSC_VER >= 1600
RyoheiHagimoto 0:0e0631af0305 467 # define CV_CXX_MOVE_SEMANTICS 1
RyoheiHagimoto 0:0e0631af0305 468 # elif defined(__clang)
RyoheiHagimoto 0:0e0631af0305 469 # if __has_feature(cxx_rvalue_references)
RyoheiHagimoto 0:0e0631af0305 470 # define CV_CXX_MOVE_SEMANTICS 1
RyoheiHagimoto 0:0e0631af0305 471 # endif
RyoheiHagimoto 0:0e0631af0305 472 # endif
RyoheiHagimoto 0:0e0631af0305 473 #else
RyoheiHagimoto 0:0e0631af0305 474 # if CV_CXX_MOVE_SEMANTICS == 0
RyoheiHagimoto 0:0e0631af0305 475 # undef CV_CXX_MOVE_SEMANTICS
RyoheiHagimoto 0:0e0631af0305 476 # endif
RyoheiHagimoto 0:0e0631af0305 477 #endif
RyoheiHagimoto 0:0e0631af0305 478
RyoheiHagimoto 0:0e0631af0305 479 //! @}
RyoheiHagimoto 0:0e0631af0305 480
RyoheiHagimoto 0:0e0631af0305 481 #endif // OPENCV_CORE_CVDEF_H