Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed MSVC 2013 build errors and workaround for an internal compiler cra... #1653

Merged
merged 6 commits into from Oct 22, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions 3rdparty/openexr/IlmImf/ImfAcesFile.cpp
Expand Up @@ -42,6 +42,7 @@
#include <ImfRgbaFile.h>
#include <ImfStandardAttributes.h>
#include <Iex.h>
#include <algorithm> // for std::max()

using namespace std;
using namespace Imath;
Expand Down
1 change: 1 addition & 0 deletions 3rdparty/openexr/IlmImf/ImfOutputFile.cpp
Expand Up @@ -58,6 +58,7 @@
#include <vector>
#include <fstream>
#include <assert.h>
#include <algorithm> // for std::max()


namespace Imf {
Expand Down
1 change: 1 addition & 0 deletions 3rdparty/openexr/IlmImf/ImfScanLineInputFile.cpp
Expand Up @@ -56,6 +56,7 @@
#include <string>
#include <vector>
#include <assert.h>
#include <algorithm> // for std::max()


namespace Imf {
Expand Down
1 change: 1 addition & 0 deletions 3rdparty/openexr/IlmImf/ImfTiledMisc.cpp
Expand Up @@ -43,6 +43,7 @@
#include "Iex.h"
#include <ImfMisc.h>
#include <ImfChannelList.h>
#include <algorithm> // for std::max()


namespace Imf {
Expand Down
1 change: 1 addition & 0 deletions 3rdparty/openexr/IlmImf/ImfTiledOutputFile.cpp
Expand Up @@ -63,6 +63,7 @@
#include <fstream>
#include <assert.h>
#include <map>
#include <algorithm> // for std::max()


namespace Imf {
Expand Down
1 change: 1 addition & 0 deletions 3rdparty/openexr/Imath/ImathMatrixAlgo.cpp
Expand Up @@ -44,6 +44,7 @@

#include "ImathMatrixAlgo.h"
#include <cmath>
#include <algorithm> // for std::max()

#if defined(OPENEXR_DLL)
#define EXPORT_CONST __declspec(dllexport)
Expand Down
72 changes: 72 additions & 0 deletions 3rdparty/openexr/fix_msvc2013_errors.patch
@@ -0,0 +1,72 @@
diff --git a/3rdparty/openexr/IlmImf/ImfAcesFile.cpp b/3rdparty/openexr/IlmImf/ImfAcesFile.cpp
index de4bf83..9418b9d 100644
--- a/3rdparty/openexr/IlmImf/ImfAcesFile.cpp
+++ b/3rdparty/openexr/IlmImf/ImfAcesFile.cpp
@@ -42,6 +42,7 @@
#include <ImfRgbaFile.h>
#include <ImfStandardAttributes.h>
#include <Iex.h>
+#include <algorithm> // for std::max()

using namespace std;
using namespace Imath;
diff --git a/3rdparty/openexr/IlmImf/ImfOutputFile.cpp b/3rdparty/openexr/IlmImf/ImfOutputFile.cpp
index 8831ec9..e69b92b 100644
--- a/3rdparty/openexr/IlmImf/ImfOutputFile.cpp
+++ b/3rdparty/openexr/IlmImf/ImfOutputFile.cpp
@@ -58,6 +58,7 @@
#include <vector>
#include <fstream>
#include <assert.h>
+#include <algorithm> // for std::max()


namespace Imf {
diff --git a/3rdparty/openexr/IlmImf/ImfScanLineInputFile.cpp b/3rdparty/openexr/IlmImf/ImfScanLineInputFile.cpp
index f7a12a3..5d8b522 100644
--- a/3rdparty/openexr/IlmImf/ImfScanLineInputFile.cpp
+++ b/3rdparty/openexr/IlmImf/ImfScanLineInputFile.cpp
@@ -56,6 +56,7 @@
#include <string>
#include <vector>
#include <assert.h>
+#include <algorithm> // for std::max()


namespace Imf {
diff --git a/3rdparty/openexr/IlmImf/ImfTiledMisc.cpp b/3rdparty/openexr/IlmImf/ImfTiledMisc.cpp
index 57f52f1..9588e78 100644
--- a/3rdparty/openexr/IlmImf/ImfTiledMisc.cpp
+++ b/3rdparty/openexr/IlmImf/ImfTiledMisc.cpp
@@ -43,6 +43,7 @@
#include "Iex.h"
#include <ImfMisc.h>
#include <ImfChannelList.h>
+#include <algorithm> // for std::max()


namespace Imf {
diff --git a/3rdparty/openexr/IlmImf/ImfTiledOutputFile.cpp b/3rdparty/openexr/IlmImf/ImfTiledOutputFile.cpp
index 0882106..0bc3cb3 100644
--- a/3rdparty/openexr/IlmImf/ImfTiledOutputFile.cpp
+++ b/3rdparty/openexr/IlmImf/ImfTiledOutputFile.cpp
@@ -63,6 +63,7 @@
#include <fstream>
#include <assert.h>
#include <map>
+#include <algorithm> // for std::max()


namespace Imf {
diff --git a/3rdparty/openexr/Imath/ImathMatrixAlgo.cpp b/3rdparty/openexr/Imath/ImathMatrixAlgo.cpp
index f0d2ed6..7ddc649 100644
--- a/3rdparty/openexr/Imath/ImathMatrixAlgo.cpp
+++ b/3rdparty/openexr/Imath/ImathMatrixAlgo.cpp
@@ -44,6 +44,7 @@

#include "ImathMatrixAlgo.h"
#include <cmath>
+#include <algorithm> // for std::max()

#if defined(OPENEXR_DLL)
#define EXPORT_CONST __declspec(dllexport)
2 changes: 1 addition & 1 deletion modules/features2d/src/features2d_init.cpp
Expand Up @@ -176,7 +176,7 @@ CV_INIT_ALGORITHM(DenseFeatureDetector, "Feature2D.Dense",
obj.info()->addParam(obj, "varyImgBoundWithScale", obj.varyImgBoundWithScale));

CV_INIT_ALGORITHM(GridAdaptedFeatureDetector, "Feature2D.Grid",
obj.info()->addParam(obj, "detector", obj.detector);
obj.info()->addParam<FeatureDetector>(obj, "detector", obj.detector, false, 0, 0); // Extra params added to avoid VS2013 fatal error in opencv2/core.hpp (decl. of addParam)
obj.info()->addParam(obj, "maxTotalKeypoints", obj.maxTotalKeypoints);
obj.info()->addParam(obj, "gridRows", obj.gridRows);
obj.info()->addParam(obj, "gridCols", obj.gridCols));
Expand Down
13 changes: 8 additions & 5 deletions modules/features2d/src/orb.cpp
Expand Up @@ -138,13 +138,16 @@ static void computeOrbDescriptor(const KeyPoint& kpt,
const uchar* center = &img.at<uchar>(cvRound(kpt.pt.y), cvRound(kpt.pt.x));
int step = (int)img.step;

#if 1
#define GET_VALUE(idx) \
center[cvRound(pattern[idx].x*b + pattern[idx].y*a)*step + \
cvRound(pattern[idx].x*a - pattern[idx].y*b)]
#else
float x, y;
int ix, iy;
#if 1
#define GET_VALUE(idx) \
(x = pattern[idx].x*a - pattern[idx].y*b, \
y = pattern[idx].x*b + pattern[idx].y*a, \
ix = cvRound(x), \
iy = cvRound(y), \
*(center + iy*step + ix) )
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What problem does this solve? Also, you can pull the variable declarations out of the #if, because they're common to both branches.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazingly... an internal compiler crash. Unrolling the code like this was the only way I found to make it to compile.
On getting x,y,ix,iy out of the #if, you're right, but I'm not sure how to change it now in GitHub. Should I remove this pull request and open a new one, or can I modify it? Otherwise, you can also do the change yourself, it'll be ok.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can add additional commits and push them to your branch.

EDIT: to the branch in your GitHub repo, that is.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks (I'm rather new to Git!)

It's done now, I think this pull request is now complete.

#else
#define GET_VALUE(idx) \
(x = pattern[idx].x*a - pattern[idx].y*b, \
y = pattern[idx].x*b + pattern[idx].y*a, \
Expand Down