Ask Your Question
0

How should I enable SSE2 in Visual Studio 2008 builds?

asked 2013-02-13 13:12:51 -0600

xaffeine gravatar image

Even though I set ENABLE_SSE and ENABLE_SSE2 to true in CMake, I see that CV_SSE2 is not defined in the generated projects. In internal.hpp, the only place where CV_SSE2 can be defined to 1 is inside a <#if defined __SSE2__ || defined _M_X64 || (defined _M_IX86_FP && _M_IX86_FP >= 2)> block.

It seems that the author(s) expected the compiler to predefine __SSE2__ whenever sse2 instructions are available, but this is not the case with Visual Studio 2008.

What is the best workaround for this bug in OpenCV 2.4.3? Should I manually change internal.hpp, or is there a configuration option that I should know about?

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
1

answered 2013-02-15 14:37:28 -0600

xaffeine gravatar image

updated 2013-03-04 15:29:35 -0600

I have a workaround. In cmake, it is possible to add "/D__SSE2__" to the CMAKE_C_FLAGS and CMAKE_CXX_FLAGS. Obviously, this is a hack. I wonder if I should report this as a bug.

Meanwhile, I've seen that the problem does NOT arise when using Visual Studio 2010.

edit flag offensive delete link more
0

answered 2013-03-05 01:49:19 -0600

You can enable SSE, SSE2, etc as compiler option and parts of code that is written with SSE, SSE2 instructions. Add -DENABLE_SSE=ON, -DENABLE_SSE2=ON, etc to command line to enable hand made SSEx code. It must enable SSE support in compiler automatically. Also you can check, that SSEx is enabled in Visual Studio in Project properties -> C++ -> Instruction set option.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-02-13 13:12:51 -0600

Seen: 1,270 times

Last updated: Mar 05 '13