Skip to content

Commit 0cf479d

Browse files
committed
Merge remote-tracking branch 'upstream/3.4' into merge-3.4
2 parents 1f736a9 + 2693ed9 commit 0cf479d

28 files changed

+2282
-72
lines changed

3rdparty/zlib/zutil.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ const char * ZEXPORT zError(err)
136136
return ERR_MSG(err);
137137
}
138138

139-
#if defined(_WIN32_WCE)
139+
#if defined(_WIN32_WCE) && _WIN32_WCE < 0x800
140140
/* The Microsoft C Run-Time Library for Windows CE doesn't have
141141
* errno. We define it as a global variable to simplify porting.
142142
* Its value is always 0 and should not be used.

3rdparty/zlib/zutil.h

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -169,11 +169,13 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
169169

170170
#if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX
171171
# if defined(_WIN32_WCE)
172-
# define fdopen(fd,mode) NULL /* No fdopen() */
173-
# ifndef _PTRDIFF_T_DEFINED
174-
typedef int ptrdiff_t;
175-
# define _PTRDIFF_T_DEFINED
176-
# endif
172+
# if _WIN32_WCE < 0x800
173+
# define fdopen(fd,mode) NULL /* No fdopen() */
174+
# ifndef _PTRDIFF_T_DEFINED
175+
typedef int ptrdiff_t;
176+
# define _PTRDIFF_T_DEFINED
177+
# endif
178+
# endif
177179
# else
178180
# define fdopen(fd,type) _fdopen(fd,type)
179181
# endif

CMakeLists.txt

Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -53,35 +53,6 @@ if(NOT DEFINED CMAKE_INSTALL_PREFIX)
5353
endif()
5454
endif()
5555

56-
if(CMAKE_SYSTEM_NAME MATCHES WindowsPhone OR CMAKE_SYSTEM_NAME MATCHES WindowsStore)
57-
set(WINRT TRUE)
58-
endif()
59-
60-
if(WINRT)
61-
add_definitions(-DWINRT -DNO_GETENV)
62-
63-
# Making definitions available to other configurations and
64-
# to filter dependency restrictions at compile time.
65-
if(CMAKE_SYSTEM_NAME MATCHES WindowsPhone)
66-
set(WINRT_PHONE TRUE)
67-
add_definitions(-DWINRT_PHONE)
68-
elseif(CMAKE_SYSTEM_NAME MATCHES WindowsStore)
69-
set(WINRT_STORE TRUE)
70-
add_definitions(-DWINRT_STORE)
71-
endif()
72-
73-
if(CMAKE_SYSTEM_VERSION MATCHES 10)
74-
set(WINRT_10 TRUE)
75-
add_definitions(-DWINRT_10)
76-
elseif(CMAKE_SYSTEM_VERSION MATCHES 8.1)
77-
set(WINRT_8_1 TRUE)
78-
add_definitions(-DWINRT_8_1)
79-
elseif(CMAKE_SYSTEM_VERSION MATCHES 8.0)
80-
set(WINRT_8_0 TRUE)
81-
add_definitions(-DWINRT_8_0)
82-
endif()
83-
endif()
84-
8556
if(POLICY CMP0026)
8657
cmake_policy(SET CMP0026 NEW)
8758
endif()
@@ -136,6 +107,39 @@ enable_testing()
136107

137108
project(OpenCV CXX C)
138109

110+
if(CMAKE_SYSTEM_NAME MATCHES WindowsPhone OR CMAKE_SYSTEM_NAME MATCHES WindowsStore)
111+
set(WINRT TRUE)
112+
endif()
113+
114+
if(WINRT OR WINCE)
115+
add_definitions(-DNO_GETENV)
116+
endif()
117+
118+
if(WINRT)
119+
add_definitions(-DWINRT)
120+
121+
# Making definitions available to other configurations and
122+
# to filter dependency restrictions at compile time.
123+
if(CMAKE_SYSTEM_NAME MATCHES WindowsPhone)
124+
set(WINRT_PHONE TRUE)
125+
add_definitions(-DWINRT_PHONE)
126+
elseif(CMAKE_SYSTEM_NAME MATCHES WindowsStore)
127+
set(WINRT_STORE TRUE)
128+
add_definitions(-DWINRT_STORE)
129+
endif()
130+
131+
if(CMAKE_SYSTEM_VERSION MATCHES 10)
132+
set(WINRT_10 TRUE)
133+
add_definitions(-DWINRT_10)
134+
elseif(CMAKE_SYSTEM_VERSION MATCHES 8.1)
135+
set(WINRT_8_1 TRUE)
136+
add_definitions(-DWINRT_8_1)
137+
elseif(CMAKE_SYSTEM_VERSION MATCHES 8.0)
138+
set(WINRT_8_0 TRUE)
139+
add_definitions(-DWINRT_8_0)
140+
endif()
141+
endif()
142+
139143
if(MSVC)
140144
set(CMAKE_USE_RELATIVE_PATHS ON CACHE INTERNAL "" FORCE)
141145
endif()

cmake/OpenCVDetectInferenceEngine.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ endif()
8080

8181
if(INF_ENGINE_TARGET)
8282
if(NOT INF_ENGINE_RELEASE)
83-
message(WARNING "InferenceEngine version have not been set, 2019R1 will be used by default. Set INF_ENGINE_RELEASE variable if you experience build errors.")
83+
message(WARNING "InferenceEngine version have not been set, 2019R2 will be used by default. Set INF_ENGINE_RELEASE variable if you experience build errors.")
8484
endif()
85-
set(INF_ENGINE_RELEASE "2019010000" CACHE STRING "Force IE version, should be in form YYYYAABBCC (e.g. 2018R2.0.2 -> 2018020002)")
85+
set(INF_ENGINE_RELEASE "2019020000" CACHE STRING "Force IE version, should be in form YYYYAABBCC (e.g. 2018R2.0.2 -> 2018020002)")
8686
set_target_properties(${INF_ENGINE_TARGET} PROPERTIES
8787
INTERFACE_COMPILE_DEFINITIONS "HAVE_INF_ENGINE=1;INF_ENGINE_RELEASE=${INF_ENGINE_RELEASE}"
8888
)
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
// This file is part of OpenCV project.
2+
// It is subject to the license terms in the LICENSE file found in the top-level directory
3+
// of this distribution and at http://opencv.org/license.html.
4+
5+
#ifndef OPENCV_CORE_SIMD_INTRINSICS_HPP
6+
#define OPENCV_CORE_SIMD_INTRINSICS_HPP
7+
8+
/**
9+
Helper header to support SIMD intrinsics (universal intrinsics) in user code.
10+
Intrinsics documentation: https://docs.opencv.org/3.4/df/d91/group__core__hal__intrin.html
11+
12+
13+
Checks of target CPU instruction set based on compiler definitions don't work well enough.
14+
More reliable solutions require utilization of configuration systems (like CMake).
15+
16+
So, probably you need to specify your own configuration.
17+
18+
You can do that via CMake in this way:
19+
add_definitions(/DOPENCV_SIMD_CONFIG_HEADER=opencv_simd_config_custom.hpp)
20+
or
21+
add_definitions(/DOPENCV_SIMD_CONFIG_INCLUDE_DIR=1)
22+
23+
Additionally you may need to add include directory to your files:
24+
include_directories("${CMAKE_CURRENT_LIST_DIR}/opencv_config_${MYTARGET}")
25+
26+
These files can be pre-generated for target configurations of your application
27+
or generated by CMake on the fly (use CMAKE_BINARY_DIR for that).
28+
29+
Notes:
30+
- H/W capability checks are still responsibility of your applcation
31+
- runtime dispatching is not covered by this helper header
32+
*/
33+
34+
#ifdef __OPENCV_BUILD
35+
#error "Use core/hal/intrin.hpp during OpenCV build"
36+
#endif
37+
38+
#ifdef OPENCV_HAL_INTRIN_HPP
39+
#error "core/simd_intrinsics.hpp must be included before core/hal/intrin.hpp"
40+
#endif
41+
42+
#include "opencv2/core/cvdef.h"
43+
#include "opencv2/core/version.hpp"
44+
45+
#ifdef OPENCV_SIMD_CONFIG_HEADER
46+
#include CVAUX_STR(OPENCV_SIMD_CONFIG_HEADER)
47+
#elif defined(OPENCV_SIMD_CONFIG_INCLUDE_DIR)
48+
#include "opencv_simd_config.hpp" // corresponding directory should be added via -I compiler parameter
49+
#else // custom config headers
50+
51+
#if (!defined(CV_AVX_512F) || !CV_AVX_512F) && (defined(__AVX512__) || defined(__AVX512F__))
52+
# include <immintrin.h>
53+
# undef CV_AVX_512F
54+
# define CV_AVX_512F 1
55+
# ifndef OPENCV_SIMD_DONT_ASSUME_SKX // Skylake-X with AVX-512F/CD/BW/DQ/VL
56+
# undef CV_AVX512_SKX
57+
# define CV_AVX512_SKX 1
58+
# undef CV_AVX_512CD
59+
# define CV_AVX_512CD 1
60+
# undef CV_AVX_512BW
61+
# define CV_AVX_512BW 1
62+
# undef CV_AVX_512DQ
63+
# define CV_AVX_512DQ 1
64+
# undef CV_AVX_512VL
65+
# define CV_AVX_512VL 1
66+
# endif
67+
#endif // AVX512
68+
69+
// GCC/Clang: -mavx2
70+
// MSVC: /arch:AVX2
71+
#if defined __AVX2__
72+
# include <immintrin.h>
73+
# undef CV_AVX2
74+
# define CV_AVX2 1
75+
# if defined __F16C__
76+
# undef CV_FP16
77+
# define CV_FP16 1
78+
# endif
79+
#endif
80+
81+
#endif
82+
83+
// SSE / NEON / VSX is handled by cv_cpu_dispatch.h compatibility block
84+
#include "cv_cpu_dispatch.h"
85+
86+
#include "hal/intrin.hpp"
87+
88+
#endif // OPENCV_CORE_SIMD_INTRINSICS_HPP

modules/core/include/opencv2/core/utils/filesystem.private.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#ifndef OPENCV_HAVE_FILESYSTEM_SUPPORT
1010
# if defined(__EMSCRIPTEN__) || defined(__native_client__)
1111
/* no support */
12-
# elif defined WINRT
12+
# elif defined WINRT || defined _WIN32_WCE
1313
/* not supported */
1414
# elif defined __ANDROID__ || defined __linux__ || defined _WIN32 || \
1515
defined __FreeBSD__ || defined __bsdi__ || defined __HAIKU__

modules/core/src/glob.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ namespace
5757

5858
struct DIR
5959
{
60-
#ifdef WINRT
60+
#if defined(WINRT) || defined(_WIN32_WCE)
6161
WIN32_FIND_DATAW data;
6262
#else
6363
WIN32_FIND_DATAA data;
@@ -78,7 +78,7 @@ namespace
7878
{
7979
DIR* dir = new DIR;
8080
dir->ent.d_name = 0;
81-
#ifdef WINRT
81+
#if defined(WINRT) || defined(_WIN32_WCE)
8282
cv::String full_path = cv::String(path) + "\\*";
8383
wchar_t wfull_path[MAX_PATH];
8484
size_t copied = mbstowcs(wfull_path, full_path.c_str(), MAX_PATH);
@@ -100,7 +100,7 @@ namespace
100100

101101
dirent* readdir(DIR* dir)
102102
{
103-
#ifdef WINRT
103+
#if defined(WINRT) || defined(_WIN32_WCE)
104104
if (dir->ent.d_name != 0)
105105
{
106106
if (::FindNextFileW(dir->handle, &dir->data) != TRUE)

modules/core/src/matmul.simd.hpp

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2511,6 +2511,27 @@ double dotProd_32f(const float* src1, const float* src2, int len)
25112511

25122512
int j = 0;
25132513
int cWidth = v_float32::nlanes;
2514+
2515+
#if CV_ENABLE_UNROLLED
2516+
v_float32 v_sum1 = vx_setzero_f32();
2517+
v_float32 v_sum2 = vx_setzero_f32();
2518+
v_float32 v_sum3 = vx_setzero_f32();
2519+
2520+
for (; j <= blockSize - (cWidth * 4); j += (cWidth * 4))
2521+
{
2522+
v_sum = v_muladd(vx_load(src1 + j),
2523+
vx_load(src2 + j), v_sum);
2524+
v_sum1 = v_muladd(vx_load(src1 + j + cWidth),
2525+
vx_load(src2 + j + cWidth), v_sum1);
2526+
v_sum2 = v_muladd(vx_load(src1 + j + (cWidth * 2)),
2527+
vx_load(src2 + j + (cWidth * 2)), v_sum2);
2528+
v_sum3 = v_muladd(vx_load(src1 + j + (cWidth * 3)),
2529+
vx_load(src2 + j + (cWidth * 3)), v_sum3);
2530+
}
2531+
2532+
v_sum += v_sum1 + v_sum2 + v_sum3;
2533+
#endif
2534+
25142535
for (; j <= blockSize - cWidth; j += cWidth)
25152536
v_sum = v_muladd(vx_load(src1 + j), vx_load(src2 + j), v_sum);
25162537

@@ -2532,4 +2553,4 @@ double dotProd_64f(const double* src1, const double* src2, int len)
25322553

25332554
#endif
25342555
CV_CPU_OPTIMIZATION_NAMESPACE_END
2535-
} // namespace
2556+
} // namespace

modules/core/src/ocl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1722,7 +1722,7 @@ static bool parseOpenCLDeviceConfiguration(const std::string& configurationStr,
17221722
return true;
17231723
}
17241724

1725-
#ifdef WINRT
1725+
#if defined WINRT || defined _WIN32_WCE
17261726
static cl_device_id selectOpenCLDevice()
17271727
{
17281728
return NULL;

modules/core/src/system.cpp

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ struct HWFeatures
378378

379379
void initialize(void)
380380
{
381-
#ifndef WINRT
381+
#ifndef NO_GETENV
382382
if (getenv("OPENCV_DUMP_CONFIG"))
383383
{
384384
fprintf(stderr, "\nOpenCV build configuration is:\n%s\n",
@@ -614,10 +614,10 @@ struct HWFeatures
614614
{
615615
bool dump = true;
616616
const char* disabled_features =
617-
#ifndef WINRT
618-
getenv("OPENCV_CPU_DISABLE");
619-
#else
617+
#ifdef NO_GETENV
620618
NULL;
619+
#else
620+
getenv("OPENCV_CPU_DISABLE");
621621
#endif
622622
if (disabled_features && disabled_features[0] != 0)
623623
{
@@ -889,7 +889,7 @@ String format( const char* fmt, ... )
889889
String tempfile( const char* suffix )
890890
{
891891
String fname;
892-
#ifndef WINRT
892+
#ifndef NO_GETENV
893893
const char *temp_dir = getenv("OPENCV_TEMP_PATH");
894894
#endif
895895

@@ -910,6 +910,20 @@ String tempfile( const char* suffix )
910910
CV_Assert((copied != MAX_PATH) && (copied != (size_t)-1));
911911
fname = String(aname);
912912
RoUninitialize();
913+
#elif defined(_WIN32_WCE)
914+
const auto kMaxPathSize = MAX_PATH+1;
915+
wchar_t temp_dir[kMaxPathSize] = {0};
916+
wchar_t temp_file[kMaxPathSize] = {0};
917+
918+
::GetTempPathW(kMaxPathSize, temp_dir);
919+
920+
if(0 != ::GetTempFileNameW(temp_dir, L"ocv", 0, temp_file)) {
921+
DeleteFileW(temp_file);
922+
char aname[MAX_PATH];
923+
size_t copied = wcstombs(aname, temp_file, MAX_PATH);
924+
CV_Assert((copied != MAX_PATH) && (copied != (size_t)-1));
925+
fname = String(aname);
926+
}
913927
#else
914928
char temp_dir2[MAX_PATH] = { 0 };
915929
char temp_file[MAX_PATH] = { 0 };

0 commit comments

Comments
 (0)