Skip to content

Commit b991665

Browse files
committed
Merge pull request opencv#9000 from alalek:fix_winpack_build
2 parents eff47b1 + 16d1bbf commit b991665

File tree

7 files changed

+17
-22
lines changed

7 files changed

+17
-22
lines changed

modules/dnn/src/halide_scheduler.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
// Copyright (C) 2017, Intel Corporation, all rights reserved.
66
// Third party copyrights are property of their respective owners.
77

8+
#include "precomp.hpp"
89
#include "halide_scheduler.hpp"
910
#include "op_halide.hpp"
1011

modules/dnn/src/op_halide.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
// Copyright (C) 2017, Intel Corporation, all rights reserved.
66
// Third party copyrights are property of their respective owners.
77

8+
#include "precomp.hpp"
89
#include "op_halide.hpp"
910

1011
#ifdef HAVE_HALIDE

modules/dnn/src/torch/THDiskFile.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#include "../precomp.hpp"
12
#if defined(ENABLE_TORCH_IMPORTER) && ENABLE_TORCH_IMPORTER
23
#include "THGeneral.h"
34
#include "THDiskFile.h"

modules/dnn/src/torch/THFile.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#include "../precomp.hpp"
12
#if defined(ENABLE_TORCH_IMPORTER) && ENABLE_TORCH_IMPORTER
23
#include "THFile.h"
34
#include "THFilePrivate.h"

modules/dnn/src/torch/THFile.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
//#include "THStorage.h"
55
#if defined(ENABLE_TORCH_IMPORTER) && ENABLE_TORCH_IMPORTER
6-
#include "THGeneral.h"
76
#include "opencv2/core/hal/interface.h"
7+
#include "THGeneral.h"
88

99
typedef struct THFile__ THFile;
1010

modules/dnn/src/torch/THGeneral.cpp

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#include "../precomp.hpp"
12
#if defined(ENABLE_TORCH_IMPORTER) && ENABLE_TORCH_IMPORTER
23
#include <opencv2/core.hpp>
34

@@ -14,7 +15,9 @@ extern "C"
1415
{
1516

1617
#ifndef TH_HAVE_THREAD
17-
#define __thread
18+
#define TH_THREAD
19+
#else
20+
#define TH_THREAD __thread
1821
#endif
1922

2023
/* Torch Error Handling */
@@ -23,8 +26,8 @@ static void defaultTorchErrorHandlerFunction(const char *msg, void*)
2326
CV_Error(cv::Error::StsError, cv::String("Torch Error: ") + msg);
2427
}
2528

26-
static __thread void (*torchErrorHandlerFunction)(const char *msg, void *data) = defaultTorchErrorHandlerFunction;
27-
static __thread void *torchErrorHandlerData;
29+
static TH_THREAD void (*torchErrorHandlerFunction)(const char *msg, void *data) = defaultTorchErrorHandlerFunction;
30+
static TH_THREAD void *torchErrorHandlerData;
2831

2932
void _THError(const char *file, const int line, const char *fmt, ...)
3033
{
@@ -71,8 +74,8 @@ static void defaultTorchArgErrorHandlerFunction(int argNumber, const char *msg,
7174
CV_Error(cv::Error::StsError, cv::format("Invalid argument %d", argNumber));
7275
}
7376

74-
static __thread void (*torchArgErrorHandlerFunction)(int argNumber, const char *msg, void *data) = defaultTorchArgErrorHandlerFunction;
75-
static __thread void *torchArgErrorHandlerData;
77+
static TH_THREAD void (*torchArgErrorHandlerFunction)(int argNumber, const char *msg, void *data) = defaultTorchArgErrorHandlerFunction;
78+
static TH_THREAD void *torchArgErrorHandlerData;
7679

7780
void _THArgCheck(const char *file, int line, int condition, int argNumber, const char *fmt, ...)
7881
{
@@ -103,10 +106,10 @@ void THSetArgErrorHandler( void (*torchArgErrorHandlerFunction_)(int argNumber,
103106
torchArgErrorHandlerData = data;
104107
}
105108

106-
static __thread void (*torchGCFunction)(void *data) = NULL;
107-
static __thread void *torchGCData;
108-
static __thread long torchHeapSize = 0;
109-
static __thread long torchHeapSizeSoftMax = 300000000; // 300MB, adjusted upward dynamically
109+
static TH_THREAD void (*torchGCFunction)(void *data) = NULL;
110+
static TH_THREAD void *torchGCData;
111+
static TH_THREAD long torchHeapSize = 0;
112+
static TH_THREAD long torchHeapSizeSoftMax = 300000000; // 300MB, adjusted upward dynamically
110113

111114
/* Optional hook for integrating with a garbage-collected frontend.
112115
*
@@ -242,15 +245,5 @@ void THFree(void *ptr)
242245
free(ptr);
243246
}
244247

245-
double THLog1p(const double x)
246-
{
247-
#if (defined(_MSC_VER) || defined(__MINGW32__))
248-
volatile double y = 1 + x;
249-
return log(y) - ((y-1)-x)/y ; /* cancels errors with IEEE arithmetic */
250-
#else
251-
return log1p(x);
252-
#endif
253-
}
254-
255248
}
256249
#endif

modules/dnn/src/torch/THGeneral.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
# define M_PI 3.14159265358979323846
3131
#endif
3232

33-
TH_API double THLog1p(const double x);
3433
TH_API void _THError(const char *file, const int line, const char *fmt, ...);
3534
TH_API void _THAssertionFailed(const char *file, const int line, const char *exp, const char *fmt, ...);
3635
TH_API void THSetErrorHandler( void (*torchErrorHandlerFunction)(const char *msg, void *data), void *data );
@@ -80,7 +79,6 @@ do { \
8079
#define THMax(X, Y) ((X) > (Y) ? (X) : (Y))
8180

8281
#if (defined(_MSC_VER) || defined(__MINGW32__))
83-
# define log1p(x) THLog1p(x)
8482
#define snprintf _snprintf
8583
#define popen _popen
8684
#define pclose _pclose

0 commit comments

Comments
 (0)