Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of gr-peach-opencv-project-sd-card by
intrin.hpp
00001 /*M/////////////////////////////////////////////////////////////////////////////////////// 00002 // 00003 // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 00004 // 00005 // By downloading, copying, installing or using the software you agree to this license. 00006 // If you do not agree to this license, do not download, install, 00007 // copy or use the software. 00008 // 00009 // 00010 // License Agreement 00011 // For Open Source Computer Vision Library 00012 // 00013 // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 00014 // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 00015 // Copyright (C) 2013, OpenCV Foundation, all rights reserved. 00016 // Copyright (C) 2015, Itseez Inc., all rights reserved. 00017 // Third party copyrights are property of their respective owners. 00018 // 00019 // Redistribution and use in source and binary forms, with or without modification, 00020 // are permitted provided that the following conditions are met: 00021 // 00022 // * Redistribution's of source code must retain the above copyright notice, 00023 // this list of conditions and the following disclaimer. 00024 // 00025 // * Redistribution's in binary form must reproduce the above copyright notice, 00026 // this list of conditions and the following disclaimer in the documentation 00027 // and/or other materials provided with the distribution. 00028 // 00029 // * The name of the copyright holders may not be used to endorse or promote products 00030 // derived from this software without specific prior written permission. 00031 // 00032 // This software is provided by the copyright holders and contributors "as is" and 00033 // any express or implied warranties, including, but not limited to, the implied 00034 // warranties of merchantability and fitness for a particular purpose are disclaimed. 00035 // In no event shall the Intel Corporation or contributors be liable for any direct, 00036 // indirect, incidental, special, exemplary, or consequential damages 00037 // (including, but not limited to, procurement of substitute goods or services; 00038 // loss of use, data, or profits; or business interruption) however caused 00039 // and on any theory of liability, whether in contract, strict liability, 00040 // or tort (including negligence or otherwise) arising in any way out of 00041 // the use of this software, even if advised of the possibility of such damage. 00042 // 00043 //M*/ 00044 00045 #ifndef __OPENCV_HAL_INTRIN_HPP__ 00046 #define __OPENCV_HAL_INTRIN_HPP__ 00047 00048 #include <cmath> 00049 #include <float.h> 00050 #include <stdlib.h> 00051 #include "opencv2/core/cvdef.h" 00052 00053 #define OPENCV_HAL_ADD(a, b) ((a) + (b)) 00054 #define OPENCV_HAL_AND(a, b) ((a) & (b)) 00055 #define OPENCV_HAL_NOP(a) (a) 00056 #define OPENCV_HAL_1ST(a, b) (a) 00057 00058 // unlike HAL API, which is in cv::hal, 00059 // we put intrinsics into cv namespace to make its 00060 // access from within opencv code more accessible 00061 namespace cv { 00062 00063 //! @addtogroup core_hal_intrin 00064 //! @{ 00065 00066 //! @cond IGNORED 00067 template<typename _Tp> struct V_TypeTraits 00068 { 00069 typedef _Tp int_type; 00070 typedef _Tp uint_type; 00071 typedef _Tp abs_type; 00072 typedef _Tp sum_type; 00073 00074 enum { delta = 0, shift = 0 }; 00075 00076 static int_type reinterpret_int(_Tp x) { return x; } 00077 static uint_type reinterpet_uint(_Tp x) { return x; } 00078 static _Tp reinterpret_from_int(int_type x) { return (_Tp)x; } 00079 }; 00080 00081 template<> struct V_TypeTraits<uchar> 00082 { 00083 typedef uchar value_type; 00084 typedef schar int_type; 00085 typedef uchar uint_type; 00086 typedef uchar abs_type; 00087 typedef int sum_type; 00088 00089 typedef ushort w_type; 00090 typedef unsigned q_type; 00091 00092 enum { delta = 128, shift = 8 }; 00093 00094 static int_type reinterpret_int(value_type x) { return (int_type)x; } 00095 static uint_type reinterpret_uint(value_type x) { return (uint_type)x; } 00096 static value_type reinterpret_from_int(int_type x) { return (value_type)x; } 00097 }; 00098 00099 template<> struct V_TypeTraits<schar> 00100 { 00101 typedef schar value_type; 00102 typedef schar int_type; 00103 typedef uchar uint_type; 00104 typedef uchar abs_type; 00105 typedef int sum_type; 00106 00107 typedef short w_type; 00108 typedef int q_type; 00109 00110 enum { delta = 128, shift = 8 }; 00111 00112 static int_type reinterpret_int(value_type x) { return (int_type)x; } 00113 static uint_type reinterpret_uint(value_type x) { return (uint_type)x; } 00114 static value_type reinterpret_from_int(int_type x) { return (value_type)x; } 00115 }; 00116 00117 template<> struct V_TypeTraits<ushort> 00118 { 00119 typedef ushort value_type; 00120 typedef short int_type; 00121 typedef ushort uint_type; 00122 typedef ushort abs_type; 00123 typedef int sum_type; 00124 00125 typedef unsigned w_type; 00126 typedef uchar nu_type; 00127 00128 enum { delta = 32768, shift = 16 }; 00129 00130 static int_type reinterpret_int(value_type x) { return (int_type)x; } 00131 static uint_type reinterpret_uint(value_type x) { return (uint_type)x; } 00132 static value_type reinterpret_from_int(int_type x) { return (value_type)x; } 00133 }; 00134 00135 template<> struct V_TypeTraits<short> 00136 { 00137 typedef short value_type; 00138 typedef short int_type; 00139 typedef ushort uint_type; 00140 typedef ushort abs_type; 00141 typedef int sum_type; 00142 00143 typedef int w_type; 00144 typedef uchar nu_type; 00145 typedef schar n_type; 00146 00147 enum { delta = 128, shift = 8 }; 00148 00149 static int_type reinterpret_int(value_type x) { return (int_type)x; } 00150 static uint_type reinterpret_uint(value_type x) { return (uint_type)x; } 00151 static value_type reinterpret_from_int(int_type x) { return (value_type)x; } 00152 }; 00153 00154 template<> struct V_TypeTraits<unsigned> 00155 { 00156 typedef unsigned value_type; 00157 typedef int int_type; 00158 typedef unsigned uint_type; 00159 typedef unsigned abs_type; 00160 typedef unsigned sum_type; 00161 00162 typedef uint64 w_type; 00163 typedef ushort nu_type; 00164 00165 static int_type reinterpret_int(value_type x) { return (int_type)x; } 00166 static uint_type reinterpret_uint(value_type x) { return (uint_type)x; } 00167 static value_type reinterpret_from_int(int_type x) { return (value_type)x; } 00168 }; 00169 00170 template<> struct V_TypeTraits<int> 00171 { 00172 typedef int value_type; 00173 typedef int int_type; 00174 typedef unsigned uint_type; 00175 typedef unsigned abs_type; 00176 typedef int sum_type; 00177 00178 typedef int64 w_type; 00179 typedef short n_type; 00180 typedef ushort nu_type; 00181 00182 static int_type reinterpret_int(value_type x) { return (int_type)x; } 00183 static uint_type reinterpret_uint(value_type x) { return (uint_type)x; } 00184 static value_type reinterpret_from_int(int_type x) { return (value_type)x; } 00185 }; 00186 00187 template<> struct V_TypeTraits<uint64> 00188 { 00189 typedef uint64 value_type; 00190 typedef int64 int_type; 00191 typedef uint64 uint_type; 00192 typedef uint64 abs_type; 00193 typedef uint64 sum_type; 00194 00195 typedef unsigned nu_type; 00196 00197 static int_type reinterpret_int(value_type x) { return (int_type)x; } 00198 static uint_type reinterpret_uint(value_type x) { return (uint_type)x; } 00199 static value_type reinterpret_from_int(int_type x) { return (value_type)x; } 00200 }; 00201 00202 template<> struct V_TypeTraits<int64> 00203 { 00204 typedef int64 value_type; 00205 typedef int64 int_type; 00206 typedef uint64 uint_type; 00207 typedef uint64 abs_type; 00208 typedef int64 sum_type; 00209 00210 typedef int nu_type; 00211 00212 static int_type reinterpret_int(value_type x) { return (int_type)x; } 00213 static uint_type reinterpret_uint(value_type x) { return (uint_type)x; } 00214 static value_type reinterpret_from_int(int_type x) { return (value_type)x; } 00215 }; 00216 00217 00218 template<> struct V_TypeTraits<float> 00219 { 00220 typedef float value_type; 00221 typedef int int_type; 00222 typedef unsigned uint_type; 00223 typedef float abs_type; 00224 typedef float sum_type; 00225 00226 typedef double w_type; 00227 00228 static int_type reinterpret_int(value_type x) 00229 { 00230 Cv32suf u; 00231 u.f = x; 00232 return u.i; 00233 } 00234 static uint_type reinterpet_uint(value_type x) 00235 { 00236 Cv32suf u; 00237 u.f = x; 00238 return u.u; 00239 } 00240 static value_type reinterpret_from_int(int_type x) 00241 { 00242 Cv32suf u; 00243 u.i = x; 00244 return u.f; 00245 } 00246 }; 00247 00248 template<> struct V_TypeTraits<double> 00249 { 00250 typedef double value_type; 00251 typedef int64 int_type; 00252 typedef uint64 uint_type; 00253 typedef double abs_type; 00254 typedef double sum_type; 00255 static int_type reinterpret_int(value_type x) 00256 { 00257 Cv64suf u; 00258 u.f = x; 00259 return u.i; 00260 } 00261 static uint_type reinterpet_uint(value_type x) 00262 { 00263 Cv64suf u; 00264 u.f = x; 00265 return u.u; 00266 } 00267 static value_type reinterpret_from_int(int_type x) 00268 { 00269 Cv64suf u; 00270 u.i = x; 00271 return u.f; 00272 } 00273 }; 00274 00275 template <typename T> struct V_SIMD128Traits 00276 { 00277 enum { nlanes = 16 / sizeof(T) }; 00278 }; 00279 00280 //! @endcond 00281 00282 //! @} 00283 00284 } 00285 00286 #ifdef CV_DOXYGEN 00287 # undef CV_SSE2 00288 # undef CV_NEON 00289 #endif 00290 00291 #if CV_SSE2 00292 00293 #include "opencv2/core/hal/intrin_sse.hpp" 00294 00295 #elif CV_NEON 00296 00297 #include "opencv2/core/hal/intrin_neon.hpp" 00298 00299 #else 00300 00301 #include "opencv2/core/hal/intrin_cpp.hpp" 00302 00303 #endif 00304 00305 //! @addtogroup core_hal_intrin 00306 //! @{ 00307 00308 #ifndef CV_SIMD128 00309 //! Set to 1 if current compiler supports vector extensions (NEON or SSE is enabled) 00310 #define CV_SIMD128 0 00311 #endif 00312 00313 #ifndef CV_SIMD128_64F 00314 //! Set to 1 if current intrinsics implementation supports 64-bit float vectors 00315 #define CV_SIMD128_64F 0 00316 #endif 00317 00318 //! @} 00319 00320 #endif 00321
Generated on Tue Jul 12 2022 14:47:12 by
1.7.2
