openCV library for Renesas RZ/A
Dependents: RZ_A2M_Mbed_samples
include/opencv2/core/hal/intrin.hpp@0:0e0631af0305, 2021-01-29 (annotated)
- 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?
| User | Revision | Line number | New 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_HAL_INTRIN_HPP |
| RyoheiHagimoto | 0:0e0631af0305 | 46 | #define OPENCV_HAL_INTRIN_HPP |
| RyoheiHagimoto | 0:0e0631af0305 | 47 | |
| RyoheiHagimoto | 0:0e0631af0305 | 48 | #include <cmath> |
| RyoheiHagimoto | 0:0e0631af0305 | 49 | #include <float.h> |
| RyoheiHagimoto | 0:0e0631af0305 | 50 | #include <stdlib.h> |
| RyoheiHagimoto | 0:0e0631af0305 | 51 | #include "opencv2/core/cvdef.h" |
| RyoheiHagimoto | 0:0e0631af0305 | 52 | |
| RyoheiHagimoto | 0:0e0631af0305 | 53 | #define OPENCV_HAL_ADD(a, b) ((a) + (b)) |
| RyoheiHagimoto | 0:0e0631af0305 | 54 | #define OPENCV_HAL_AND(a, b) ((a) & (b)) |
| RyoheiHagimoto | 0:0e0631af0305 | 55 | #define OPENCV_HAL_NOP(a) (a) |
| RyoheiHagimoto | 0:0e0631af0305 | 56 | #define OPENCV_HAL_1ST(a, b) (a) |
| RyoheiHagimoto | 0:0e0631af0305 | 57 | |
| RyoheiHagimoto | 0:0e0631af0305 | 58 | // unlike HAL API, which is in cv::hal, |
| RyoheiHagimoto | 0:0e0631af0305 | 59 | // we put intrinsics into cv namespace to make its |
| RyoheiHagimoto | 0:0e0631af0305 | 60 | // access from within opencv code more accessible |
| RyoheiHagimoto | 0:0e0631af0305 | 61 | namespace cv { |
| RyoheiHagimoto | 0:0e0631af0305 | 62 | |
| RyoheiHagimoto | 0:0e0631af0305 | 63 | //! @addtogroup core_hal_intrin |
| RyoheiHagimoto | 0:0e0631af0305 | 64 | //! @{ |
| RyoheiHagimoto | 0:0e0631af0305 | 65 | |
| RyoheiHagimoto | 0:0e0631af0305 | 66 | //! @cond IGNORED |
| RyoheiHagimoto | 0:0e0631af0305 | 67 | template<typename _Tp> struct V_TypeTraits |
| RyoheiHagimoto | 0:0e0631af0305 | 68 | { |
| RyoheiHagimoto | 0:0e0631af0305 | 69 | typedef _Tp int_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 70 | typedef _Tp uint_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 71 | typedef _Tp abs_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 72 | typedef _Tp sum_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 73 | |
| RyoheiHagimoto | 0:0e0631af0305 | 74 | enum { delta = 0, shift = 0 }; |
| RyoheiHagimoto | 0:0e0631af0305 | 75 | |
| RyoheiHagimoto | 0:0e0631af0305 | 76 | static int_type reinterpret_int(_Tp x) { return x; } |
| RyoheiHagimoto | 0:0e0631af0305 | 77 | static uint_type reinterpet_uint(_Tp x) { return x; } |
| RyoheiHagimoto | 0:0e0631af0305 | 78 | static _Tp reinterpret_from_int(int_type x) { return (_Tp)x; } |
| RyoheiHagimoto | 0:0e0631af0305 | 79 | }; |
| RyoheiHagimoto | 0:0e0631af0305 | 80 | |
| RyoheiHagimoto | 0:0e0631af0305 | 81 | template<> struct V_TypeTraits<uchar> |
| RyoheiHagimoto | 0:0e0631af0305 | 82 | { |
| RyoheiHagimoto | 0:0e0631af0305 | 83 | typedef uchar value_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 84 | typedef schar int_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 85 | typedef uchar uint_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 86 | typedef uchar abs_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 87 | typedef int sum_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 88 | |
| RyoheiHagimoto | 0:0e0631af0305 | 89 | typedef ushort w_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 90 | typedef unsigned q_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 91 | |
| RyoheiHagimoto | 0:0e0631af0305 | 92 | enum { delta = 128, shift = 8 }; |
| RyoheiHagimoto | 0:0e0631af0305 | 93 | |
| RyoheiHagimoto | 0:0e0631af0305 | 94 | static int_type reinterpret_int(value_type x) { return (int_type)x; } |
| RyoheiHagimoto | 0:0e0631af0305 | 95 | static uint_type reinterpret_uint(value_type x) { return (uint_type)x; } |
| RyoheiHagimoto | 0:0e0631af0305 | 96 | static value_type reinterpret_from_int(int_type x) { return (value_type)x; } |
| RyoheiHagimoto | 0:0e0631af0305 | 97 | }; |
| RyoheiHagimoto | 0:0e0631af0305 | 98 | |
| RyoheiHagimoto | 0:0e0631af0305 | 99 | template<> struct V_TypeTraits<schar> |
| RyoheiHagimoto | 0:0e0631af0305 | 100 | { |
| RyoheiHagimoto | 0:0e0631af0305 | 101 | typedef schar value_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 102 | typedef schar int_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 103 | typedef uchar uint_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 104 | typedef uchar abs_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 105 | typedef int sum_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 106 | |
| RyoheiHagimoto | 0:0e0631af0305 | 107 | typedef short w_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 108 | typedef int q_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 109 | |
| RyoheiHagimoto | 0:0e0631af0305 | 110 | enum { delta = 128, shift = 8 }; |
| RyoheiHagimoto | 0:0e0631af0305 | 111 | |
| RyoheiHagimoto | 0:0e0631af0305 | 112 | static int_type reinterpret_int(value_type x) { return (int_type)x; } |
| RyoheiHagimoto | 0:0e0631af0305 | 113 | static uint_type reinterpret_uint(value_type x) { return (uint_type)x; } |
| RyoheiHagimoto | 0:0e0631af0305 | 114 | static value_type reinterpret_from_int(int_type x) { return (value_type)x; } |
| RyoheiHagimoto | 0:0e0631af0305 | 115 | }; |
| RyoheiHagimoto | 0:0e0631af0305 | 116 | |
| RyoheiHagimoto | 0:0e0631af0305 | 117 | template<> struct V_TypeTraits<ushort> |
| RyoheiHagimoto | 0:0e0631af0305 | 118 | { |
| RyoheiHagimoto | 0:0e0631af0305 | 119 | typedef ushort value_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 120 | typedef short int_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 121 | typedef ushort uint_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 122 | typedef ushort abs_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 123 | typedef int sum_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 124 | |
| RyoheiHagimoto | 0:0e0631af0305 | 125 | typedef unsigned w_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 126 | typedef uchar nu_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 127 | |
| RyoheiHagimoto | 0:0e0631af0305 | 128 | enum { delta = 32768, shift = 16 }; |
| RyoheiHagimoto | 0:0e0631af0305 | 129 | |
| RyoheiHagimoto | 0:0e0631af0305 | 130 | static int_type reinterpret_int(value_type x) { return (int_type)x; } |
| RyoheiHagimoto | 0:0e0631af0305 | 131 | static uint_type reinterpret_uint(value_type x) { return (uint_type)x; } |
| RyoheiHagimoto | 0:0e0631af0305 | 132 | static value_type reinterpret_from_int(int_type x) { return (value_type)x; } |
| RyoheiHagimoto | 0:0e0631af0305 | 133 | }; |
| RyoheiHagimoto | 0:0e0631af0305 | 134 | |
| RyoheiHagimoto | 0:0e0631af0305 | 135 | template<> struct V_TypeTraits<short> |
| RyoheiHagimoto | 0:0e0631af0305 | 136 | { |
| RyoheiHagimoto | 0:0e0631af0305 | 137 | typedef short value_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 138 | typedef short int_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 139 | typedef ushort uint_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 140 | typedef ushort abs_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 141 | typedef int sum_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 142 | |
| RyoheiHagimoto | 0:0e0631af0305 | 143 | typedef int w_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 144 | typedef uchar nu_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 145 | typedef schar n_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 146 | |
| RyoheiHagimoto | 0:0e0631af0305 | 147 | enum { delta = 128, shift = 8 }; |
| RyoheiHagimoto | 0:0e0631af0305 | 148 | |
| RyoheiHagimoto | 0:0e0631af0305 | 149 | static int_type reinterpret_int(value_type x) { return (int_type)x; } |
| RyoheiHagimoto | 0:0e0631af0305 | 150 | static uint_type reinterpret_uint(value_type x) { return (uint_type)x; } |
| RyoheiHagimoto | 0:0e0631af0305 | 151 | static value_type reinterpret_from_int(int_type x) { return (value_type)x; } |
| RyoheiHagimoto | 0:0e0631af0305 | 152 | }; |
| RyoheiHagimoto | 0:0e0631af0305 | 153 | |
| RyoheiHagimoto | 0:0e0631af0305 | 154 | template<> struct V_TypeTraits<unsigned> |
| RyoheiHagimoto | 0:0e0631af0305 | 155 | { |
| RyoheiHagimoto | 0:0e0631af0305 | 156 | typedef unsigned value_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 157 | typedef int int_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 158 | typedef unsigned uint_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 159 | typedef unsigned abs_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 160 | typedef unsigned sum_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 161 | |
| RyoheiHagimoto | 0:0e0631af0305 | 162 | typedef uint64 w_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 163 | typedef ushort nu_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 164 | |
| RyoheiHagimoto | 0:0e0631af0305 | 165 | static int_type reinterpret_int(value_type x) { return (int_type)x; } |
| RyoheiHagimoto | 0:0e0631af0305 | 166 | static uint_type reinterpret_uint(value_type x) { return (uint_type)x; } |
| RyoheiHagimoto | 0:0e0631af0305 | 167 | static value_type reinterpret_from_int(int_type x) { return (value_type)x; } |
| RyoheiHagimoto | 0:0e0631af0305 | 168 | }; |
| RyoheiHagimoto | 0:0e0631af0305 | 169 | |
| RyoheiHagimoto | 0:0e0631af0305 | 170 | template<> struct V_TypeTraits<int> |
| RyoheiHagimoto | 0:0e0631af0305 | 171 | { |
| RyoheiHagimoto | 0:0e0631af0305 | 172 | typedef int value_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 173 | typedef int int_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 174 | typedef unsigned uint_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 175 | typedef unsigned abs_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 176 | typedef int sum_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 177 | |
| RyoheiHagimoto | 0:0e0631af0305 | 178 | typedef int64 w_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 179 | typedef short n_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 180 | typedef ushort nu_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 181 | |
| RyoheiHagimoto | 0:0e0631af0305 | 182 | static int_type reinterpret_int(value_type x) { return (int_type)x; } |
| RyoheiHagimoto | 0:0e0631af0305 | 183 | static uint_type reinterpret_uint(value_type x) { return (uint_type)x; } |
| RyoheiHagimoto | 0:0e0631af0305 | 184 | static value_type reinterpret_from_int(int_type x) { return (value_type)x; } |
| RyoheiHagimoto | 0:0e0631af0305 | 185 | }; |
| RyoheiHagimoto | 0:0e0631af0305 | 186 | |
| RyoheiHagimoto | 0:0e0631af0305 | 187 | template<> struct V_TypeTraits<uint64> |
| RyoheiHagimoto | 0:0e0631af0305 | 188 | { |
| RyoheiHagimoto | 0:0e0631af0305 | 189 | typedef uint64 value_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 190 | typedef int64 int_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 191 | typedef uint64 uint_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 192 | typedef uint64 abs_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 193 | typedef uint64 sum_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 194 | |
| RyoheiHagimoto | 0:0e0631af0305 | 195 | typedef unsigned nu_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 196 | |
| RyoheiHagimoto | 0:0e0631af0305 | 197 | static int_type reinterpret_int(value_type x) { return (int_type)x; } |
| RyoheiHagimoto | 0:0e0631af0305 | 198 | static uint_type reinterpret_uint(value_type x) { return (uint_type)x; } |
| RyoheiHagimoto | 0:0e0631af0305 | 199 | static value_type reinterpret_from_int(int_type x) { return (value_type)x; } |
| RyoheiHagimoto | 0:0e0631af0305 | 200 | }; |
| RyoheiHagimoto | 0:0e0631af0305 | 201 | |
| RyoheiHagimoto | 0:0e0631af0305 | 202 | template<> struct V_TypeTraits<int64> |
| RyoheiHagimoto | 0:0e0631af0305 | 203 | { |
| RyoheiHagimoto | 0:0e0631af0305 | 204 | typedef int64 value_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 205 | typedef int64 int_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 206 | typedef uint64 uint_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 207 | typedef uint64 abs_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 208 | typedef int64 sum_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 209 | |
| RyoheiHagimoto | 0:0e0631af0305 | 210 | typedef int nu_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 211 | |
| RyoheiHagimoto | 0:0e0631af0305 | 212 | static int_type reinterpret_int(value_type x) { return (int_type)x; } |
| RyoheiHagimoto | 0:0e0631af0305 | 213 | static uint_type reinterpret_uint(value_type x) { return (uint_type)x; } |
| RyoheiHagimoto | 0:0e0631af0305 | 214 | static value_type reinterpret_from_int(int_type x) { return (value_type)x; } |
| RyoheiHagimoto | 0:0e0631af0305 | 215 | }; |
| RyoheiHagimoto | 0:0e0631af0305 | 216 | |
| RyoheiHagimoto | 0:0e0631af0305 | 217 | |
| RyoheiHagimoto | 0:0e0631af0305 | 218 | template<> struct V_TypeTraits<float> |
| RyoheiHagimoto | 0:0e0631af0305 | 219 | { |
| RyoheiHagimoto | 0:0e0631af0305 | 220 | typedef float value_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 221 | typedef int int_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 222 | typedef unsigned uint_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 223 | typedef float abs_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 224 | typedef float sum_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 225 | |
| RyoheiHagimoto | 0:0e0631af0305 | 226 | typedef double w_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 227 | |
| RyoheiHagimoto | 0:0e0631af0305 | 228 | static int_type reinterpret_int(value_type x) |
| RyoheiHagimoto | 0:0e0631af0305 | 229 | { |
| RyoheiHagimoto | 0:0e0631af0305 | 230 | Cv32suf u; |
| RyoheiHagimoto | 0:0e0631af0305 | 231 | u.f = x; |
| RyoheiHagimoto | 0:0e0631af0305 | 232 | return u.i; |
| RyoheiHagimoto | 0:0e0631af0305 | 233 | } |
| RyoheiHagimoto | 0:0e0631af0305 | 234 | static uint_type reinterpet_uint(value_type x) |
| RyoheiHagimoto | 0:0e0631af0305 | 235 | { |
| RyoheiHagimoto | 0:0e0631af0305 | 236 | Cv32suf u; |
| RyoheiHagimoto | 0:0e0631af0305 | 237 | u.f = x; |
| RyoheiHagimoto | 0:0e0631af0305 | 238 | return u.u; |
| RyoheiHagimoto | 0:0e0631af0305 | 239 | } |
| RyoheiHagimoto | 0:0e0631af0305 | 240 | static value_type reinterpret_from_int(int_type x) |
| RyoheiHagimoto | 0:0e0631af0305 | 241 | { |
| RyoheiHagimoto | 0:0e0631af0305 | 242 | Cv32suf u; |
| RyoheiHagimoto | 0:0e0631af0305 | 243 | u.i = x; |
| RyoheiHagimoto | 0:0e0631af0305 | 244 | return u.f; |
| RyoheiHagimoto | 0:0e0631af0305 | 245 | } |
| RyoheiHagimoto | 0:0e0631af0305 | 246 | }; |
| RyoheiHagimoto | 0:0e0631af0305 | 247 | |
| RyoheiHagimoto | 0:0e0631af0305 | 248 | template<> struct V_TypeTraits<double> |
| RyoheiHagimoto | 0:0e0631af0305 | 249 | { |
| RyoheiHagimoto | 0:0e0631af0305 | 250 | typedef double value_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 251 | typedef int64 int_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 252 | typedef uint64 uint_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 253 | typedef double abs_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 254 | typedef double sum_type; |
| RyoheiHagimoto | 0:0e0631af0305 | 255 | static int_type reinterpret_int(value_type x) |
| RyoheiHagimoto | 0:0e0631af0305 | 256 | { |
| RyoheiHagimoto | 0:0e0631af0305 | 257 | Cv64suf u; |
| RyoheiHagimoto | 0:0e0631af0305 | 258 | u.f = x; |
| RyoheiHagimoto | 0:0e0631af0305 | 259 | return u.i; |
| RyoheiHagimoto | 0:0e0631af0305 | 260 | } |
| RyoheiHagimoto | 0:0e0631af0305 | 261 | static uint_type reinterpet_uint(value_type x) |
| RyoheiHagimoto | 0:0e0631af0305 | 262 | { |
| RyoheiHagimoto | 0:0e0631af0305 | 263 | Cv64suf u; |
| RyoheiHagimoto | 0:0e0631af0305 | 264 | u.f = x; |
| RyoheiHagimoto | 0:0e0631af0305 | 265 | return u.u; |
| RyoheiHagimoto | 0:0e0631af0305 | 266 | } |
| RyoheiHagimoto | 0:0e0631af0305 | 267 | static value_type reinterpret_from_int(int_type x) |
| RyoheiHagimoto | 0:0e0631af0305 | 268 | { |
| RyoheiHagimoto | 0:0e0631af0305 | 269 | Cv64suf u; |
| RyoheiHagimoto | 0:0e0631af0305 | 270 | u.i = x; |
| RyoheiHagimoto | 0:0e0631af0305 | 271 | return u.f; |
| RyoheiHagimoto | 0:0e0631af0305 | 272 | } |
| RyoheiHagimoto | 0:0e0631af0305 | 273 | }; |
| RyoheiHagimoto | 0:0e0631af0305 | 274 | |
| RyoheiHagimoto | 0:0e0631af0305 | 275 | template <typename T> struct V_SIMD128Traits |
| RyoheiHagimoto | 0:0e0631af0305 | 276 | { |
| RyoheiHagimoto | 0:0e0631af0305 | 277 | enum { nlanes = 16 / sizeof(T) }; |
| RyoheiHagimoto | 0:0e0631af0305 | 278 | }; |
| RyoheiHagimoto | 0:0e0631af0305 | 279 | |
| RyoheiHagimoto | 0:0e0631af0305 | 280 | //! @endcond |
| RyoheiHagimoto | 0:0e0631af0305 | 281 | |
| RyoheiHagimoto | 0:0e0631af0305 | 282 | //! @} |
| RyoheiHagimoto | 0:0e0631af0305 | 283 | |
| RyoheiHagimoto | 0:0e0631af0305 | 284 | } |
| RyoheiHagimoto | 0:0e0631af0305 | 285 | |
| RyoheiHagimoto | 0:0e0631af0305 | 286 | #ifdef CV_DOXYGEN |
| RyoheiHagimoto | 0:0e0631af0305 | 287 | # undef CV_SSE2 |
| RyoheiHagimoto | 0:0e0631af0305 | 288 | # undef CV_NEON |
| RyoheiHagimoto | 0:0e0631af0305 | 289 | #endif |
| RyoheiHagimoto | 0:0e0631af0305 | 290 | |
| RyoheiHagimoto | 0:0e0631af0305 | 291 | #if CV_SSE2 |
| RyoheiHagimoto | 0:0e0631af0305 | 292 | |
| RyoheiHagimoto | 0:0e0631af0305 | 293 | #include "opencv2/core/hal/intrin_sse.hpp" |
| RyoheiHagimoto | 0:0e0631af0305 | 294 | |
| RyoheiHagimoto | 0:0e0631af0305 | 295 | #elif CV_NEON |
| RyoheiHagimoto | 0:0e0631af0305 | 296 | |
| RyoheiHagimoto | 0:0e0631af0305 | 297 | #include "opencv2/core/hal/intrin_neon.hpp" |
| RyoheiHagimoto | 0:0e0631af0305 | 298 | |
| RyoheiHagimoto | 0:0e0631af0305 | 299 | #else |
| RyoheiHagimoto | 0:0e0631af0305 | 300 | |
| RyoheiHagimoto | 0:0e0631af0305 | 301 | #include "opencv2/core/hal/intrin_cpp.hpp" |
| RyoheiHagimoto | 0:0e0631af0305 | 302 | |
| RyoheiHagimoto | 0:0e0631af0305 | 303 | #endif |
| RyoheiHagimoto | 0:0e0631af0305 | 304 | |
| RyoheiHagimoto | 0:0e0631af0305 | 305 | //! @addtogroup core_hal_intrin |
| RyoheiHagimoto | 0:0e0631af0305 | 306 | //! @{ |
| RyoheiHagimoto | 0:0e0631af0305 | 307 | |
| RyoheiHagimoto | 0:0e0631af0305 | 308 | #ifndef CV_SIMD128 |
| RyoheiHagimoto | 0:0e0631af0305 | 309 | //! Set to 1 if current compiler supports vector extensions (NEON or SSE is enabled) |
| RyoheiHagimoto | 0:0e0631af0305 | 310 | #define CV_SIMD128 0 |
| RyoheiHagimoto | 0:0e0631af0305 | 311 | #endif |
| RyoheiHagimoto | 0:0e0631af0305 | 312 | |
| RyoheiHagimoto | 0:0e0631af0305 | 313 | #ifndef CV_SIMD128_64F |
| RyoheiHagimoto | 0:0e0631af0305 | 314 | //! Set to 1 if current intrinsics implementation supports 64-bit float vectors |
| RyoheiHagimoto | 0:0e0631af0305 | 315 | #define CV_SIMD128_64F 0 |
| RyoheiHagimoto | 0:0e0631af0305 | 316 | #endif |
| RyoheiHagimoto | 0:0e0631af0305 | 317 | |
| RyoheiHagimoto | 0:0e0631af0305 | 318 | //! @} |
| RyoheiHagimoto | 0:0e0631af0305 | 319 | |
| RyoheiHagimoto | 0:0e0631af0305 | 320 | //================================================================================================== |
| RyoheiHagimoto | 0:0e0631af0305 | 321 | |
| RyoheiHagimoto | 0:0e0631af0305 | 322 | //! @cond IGNORED |
| RyoheiHagimoto | 0:0e0631af0305 | 323 | |
| RyoheiHagimoto | 0:0e0631af0305 | 324 | namespace cv { |
| RyoheiHagimoto | 0:0e0631af0305 | 325 | |
| RyoheiHagimoto | 0:0e0631af0305 | 326 | template <typename R> struct V_RegTrait128; |
| RyoheiHagimoto | 0:0e0631af0305 | 327 | |
| RyoheiHagimoto | 0:0e0631af0305 | 328 | template <> struct V_RegTrait128<uchar> { |
| RyoheiHagimoto | 0:0e0631af0305 | 329 | typedef v_uint8x16 reg; |
| RyoheiHagimoto | 0:0e0631af0305 | 330 | typedef v_uint16x8 w_reg; |
| RyoheiHagimoto | 0:0e0631af0305 | 331 | typedef v_uint32x4 q_reg; |
| RyoheiHagimoto | 0:0e0631af0305 | 332 | typedef v_uint8x16 u_reg; |
| RyoheiHagimoto | 0:0e0631af0305 | 333 | static v_uint8x16 zero() { return v_setzero_u8(); } |
| RyoheiHagimoto | 0:0e0631af0305 | 334 | static v_uint8x16 all(uchar val) { return v_setall_u8(val); } |
| RyoheiHagimoto | 0:0e0631af0305 | 335 | }; |
| RyoheiHagimoto | 0:0e0631af0305 | 336 | |
| RyoheiHagimoto | 0:0e0631af0305 | 337 | template <> struct V_RegTrait128<schar> { |
| RyoheiHagimoto | 0:0e0631af0305 | 338 | typedef v_int8x16 reg; |
| RyoheiHagimoto | 0:0e0631af0305 | 339 | typedef v_int16x8 w_reg; |
| RyoheiHagimoto | 0:0e0631af0305 | 340 | typedef v_int32x4 q_reg; |
| RyoheiHagimoto | 0:0e0631af0305 | 341 | typedef v_uint8x16 u_reg; |
| RyoheiHagimoto | 0:0e0631af0305 | 342 | static v_int8x16 zero() { return v_setzero_s8(); } |
| RyoheiHagimoto | 0:0e0631af0305 | 343 | static v_int8x16 all(schar val) { return v_setall_s8(val); } |
| RyoheiHagimoto | 0:0e0631af0305 | 344 | }; |
| RyoheiHagimoto | 0:0e0631af0305 | 345 | |
| RyoheiHagimoto | 0:0e0631af0305 | 346 | template <> struct V_RegTrait128<ushort> { |
| RyoheiHagimoto | 0:0e0631af0305 | 347 | typedef v_uint16x8 reg; |
| RyoheiHagimoto | 0:0e0631af0305 | 348 | typedef v_uint32x4 w_reg; |
| RyoheiHagimoto | 0:0e0631af0305 | 349 | typedef v_int16x8 int_reg; |
| RyoheiHagimoto | 0:0e0631af0305 | 350 | typedef v_uint16x8 u_reg; |
| RyoheiHagimoto | 0:0e0631af0305 | 351 | static v_uint16x8 zero() { return v_setzero_u16(); } |
| RyoheiHagimoto | 0:0e0631af0305 | 352 | static v_uint16x8 all(ushort val) { return v_setall_u16(val); } |
| RyoheiHagimoto | 0:0e0631af0305 | 353 | }; |
| RyoheiHagimoto | 0:0e0631af0305 | 354 | |
| RyoheiHagimoto | 0:0e0631af0305 | 355 | template <> struct V_RegTrait128<short> { |
| RyoheiHagimoto | 0:0e0631af0305 | 356 | typedef v_int16x8 reg; |
| RyoheiHagimoto | 0:0e0631af0305 | 357 | typedef v_int32x4 w_reg; |
| RyoheiHagimoto | 0:0e0631af0305 | 358 | typedef v_uint16x8 u_reg; |
| RyoheiHagimoto | 0:0e0631af0305 | 359 | static v_int16x8 zero() { return v_setzero_s16(); } |
| RyoheiHagimoto | 0:0e0631af0305 | 360 | static v_int16x8 all(short val) { return v_setall_s16(val); } |
| RyoheiHagimoto | 0:0e0631af0305 | 361 | }; |
| RyoheiHagimoto | 0:0e0631af0305 | 362 | |
| RyoheiHagimoto | 0:0e0631af0305 | 363 | template <> struct V_RegTrait128<unsigned> { |
| RyoheiHagimoto | 0:0e0631af0305 | 364 | typedef v_uint32x4 reg; |
| RyoheiHagimoto | 0:0e0631af0305 | 365 | typedef v_uint64x2 w_reg; |
| RyoheiHagimoto | 0:0e0631af0305 | 366 | typedef v_int32x4 int_reg; |
| RyoheiHagimoto | 0:0e0631af0305 | 367 | typedef v_uint32x4 u_reg; |
| RyoheiHagimoto | 0:0e0631af0305 | 368 | static v_uint32x4 zero() { return v_setzero_u32(); } |
| RyoheiHagimoto | 0:0e0631af0305 | 369 | static v_uint32x4 all(unsigned val) { return v_setall_u32(val); } |
| RyoheiHagimoto | 0:0e0631af0305 | 370 | }; |
| RyoheiHagimoto | 0:0e0631af0305 | 371 | |
| RyoheiHagimoto | 0:0e0631af0305 | 372 | template <> struct V_RegTrait128<int> { |
| RyoheiHagimoto | 0:0e0631af0305 | 373 | typedef v_int32x4 reg; |
| RyoheiHagimoto | 0:0e0631af0305 | 374 | typedef v_int64x2 w_reg; |
| RyoheiHagimoto | 0:0e0631af0305 | 375 | typedef v_uint32x4 u_reg; |
| RyoheiHagimoto | 0:0e0631af0305 | 376 | static v_int32x4 zero() { return v_setzero_s32(); } |
| RyoheiHagimoto | 0:0e0631af0305 | 377 | static v_int32x4 all(int val) { return v_setall_s32(val); } |
| RyoheiHagimoto | 0:0e0631af0305 | 378 | }; |
| RyoheiHagimoto | 0:0e0631af0305 | 379 | |
| RyoheiHagimoto | 0:0e0631af0305 | 380 | template <> struct V_RegTrait128<uint64> { |
| RyoheiHagimoto | 0:0e0631af0305 | 381 | typedef v_uint64x2 reg; |
| RyoheiHagimoto | 0:0e0631af0305 | 382 | static v_uint64x2 zero() { return v_setzero_u64(); } |
| RyoheiHagimoto | 0:0e0631af0305 | 383 | static v_uint64x2 all(uint64 val) { return v_setall_u64(val); } |
| RyoheiHagimoto | 0:0e0631af0305 | 384 | }; |
| RyoheiHagimoto | 0:0e0631af0305 | 385 | |
| RyoheiHagimoto | 0:0e0631af0305 | 386 | template <> struct V_RegTrait128<int64> { |
| RyoheiHagimoto | 0:0e0631af0305 | 387 | typedef v_int64x2 reg; |
| RyoheiHagimoto | 0:0e0631af0305 | 388 | static v_int64x2 zero() { return v_setzero_s64(); } |
| RyoheiHagimoto | 0:0e0631af0305 | 389 | static v_int64x2 all(int64 val) { return v_setall_s64(val); } |
| RyoheiHagimoto | 0:0e0631af0305 | 390 | }; |
| RyoheiHagimoto | 0:0e0631af0305 | 391 | |
| RyoheiHagimoto | 0:0e0631af0305 | 392 | template <> struct V_RegTrait128<float> { |
| RyoheiHagimoto | 0:0e0631af0305 | 393 | typedef v_float32x4 reg; |
| RyoheiHagimoto | 0:0e0631af0305 | 394 | typedef v_int32x4 int_reg; |
| RyoheiHagimoto | 0:0e0631af0305 | 395 | typedef v_float32x4 u_reg; |
| RyoheiHagimoto | 0:0e0631af0305 | 396 | static v_float32x4 zero() { return v_setzero_f32(); } |
| RyoheiHagimoto | 0:0e0631af0305 | 397 | static v_float32x4 all(float val) { return v_setall_f32(val); } |
| RyoheiHagimoto | 0:0e0631af0305 | 398 | }; |
| RyoheiHagimoto | 0:0e0631af0305 | 399 | |
| RyoheiHagimoto | 0:0e0631af0305 | 400 | #if CV_SIMD128_64F |
| RyoheiHagimoto | 0:0e0631af0305 | 401 | template <> struct V_RegTrait128<double> { |
| RyoheiHagimoto | 0:0e0631af0305 | 402 | typedef v_float64x2 reg; |
| RyoheiHagimoto | 0:0e0631af0305 | 403 | typedef v_int32x4 int_reg; |
| RyoheiHagimoto | 0:0e0631af0305 | 404 | typedef v_float64x2 u_reg; |
| RyoheiHagimoto | 0:0e0631af0305 | 405 | static v_float64x2 zero() { return v_setzero_f64(); } |
| RyoheiHagimoto | 0:0e0631af0305 | 406 | static v_float64x2 all(double val) { return v_setall_f64(val); } |
| RyoheiHagimoto | 0:0e0631af0305 | 407 | }; |
| RyoheiHagimoto | 0:0e0631af0305 | 408 | #endif |
| RyoheiHagimoto | 0:0e0631af0305 | 409 | |
| RyoheiHagimoto | 0:0e0631af0305 | 410 | } // cv:: |
| RyoheiHagimoto | 0:0e0631af0305 | 411 | |
| RyoheiHagimoto | 0:0e0631af0305 | 412 | //! @endcond |
| RyoheiHagimoto | 0:0e0631af0305 | 413 | |
| RyoheiHagimoto | 0:0e0631af0305 | 414 | #endif |