diff --git a/toonz/sources/common/trop/tblur.cpp b/toonz/sources/common/trop/tblur.cpp index d3a21c9..ff92e11 100644 --- a/toonz/sources/common/trop/tblur.cpp +++ b/toonz/sources/common/trop/tblur.cpp @@ -3,11 +3,17 @@ #include "traster.h" #include "trop.h" #include "tpixelgr.h" -#ifdef _WIN32 + +#if defined(_WIN32) && defined(x64) +#define USE_SSE2 +#endif + +#ifdef USE_SSE2 #include #include #endif + namespace { #ifdef _WIN32 @@ -223,7 +229,7 @@ inline void blur_code(PIXEL_SRC *row1, PIXEL_DST *row2, int length, float coeff, //------------------------------------------------------------------- -#ifdef _WIN32 +#ifdef USE_SSE2 //------------------------------------------------------------------- template @@ -556,7 +562,7 @@ void load_channel_col32(float *buffer, float *col, int lx, int ly, int x, template void do_filtering_chan(BlurPixel

*row1, T *row2, int length, float coeff, float coeffq, int brad, float diff, bool useSSE) { -#ifdef _WIN32 +#ifdef USE_SSE2 if (useSSE && T::maxChannelValue == 255) blur_code_SSE2(row1, row2, length, coeff, coeffq, brad, diff, 0.5); else @@ -744,7 +750,7 @@ void do_filtering_floatRgb(T *row1, BlurPixel

*row2, int length, float coeff, BLUR_CODE(0, unsigned char) */ -#ifdef _WIN32 +#ifdef USE_SSE2 if (useSSE) blur_code_SSE2(row1, row2, length, coeff, coeffq, brad, diff, 0); else diff --git a/toonz/sources/common/trop/toperators.cpp b/toonz/sources/common/trop/toperators.cpp index 2d73c8d..a1bb38b 100644 --- a/toonz/sources/common/trop/toperators.cpp +++ b/toonz/sources/common/trop/toperators.cpp @@ -4,9 +4,17 @@ #include "tpixel.h" #include "tpixelutils.h" -#ifdef _WIN32 +// calls to _mm_* functions disabled in code for now (marked as comment) +// so disable include +/* +#if defined(_WIN32) && defined(x64) + #define ENABLE_SSE2 +#endif + +#ifdef ENABLE_SSE2 #include // per SSE2 #endif + */ namespace { inline double luminance(TPixel32 *pix) { diff --git a/toonz/sources/common/trop/tover.cpp b/toonz/sources/common/trop/tover.cpp index 208919e..aae900f 100644 --- a/toonz/sources/common/trop/tover.cpp +++ b/toonz/sources/common/trop/tover.cpp @@ -7,7 +7,11 @@ #include "tropcm.h" #include "tpalette.h" -#ifdef _WIN32 +#if defined(_WIN32) && defined(x64) +#define USE_SSE2 +#endif + +#ifdef USE_SSE2 #include // per SSE2 #endif @@ -156,7 +160,7 @@ void do_overT2(TRasterPT rout, const TRasterPT &rup) { //----------------------------------------------------------------------------- -#ifdef _WIN32 +#ifdef USE_SSE2 void do_over_SSE2(TRaster32P rout, const TRaster32P &rup) { __m128i zeros = _mm_setzero_si128(); @@ -331,7 +335,7 @@ void TRop::over(const TRasterP &rout, const TRasterP &rup, const TPoint &pos) { // TRaster64P rout64 = rout, rin64 = rin; if (rout32 && rup32) { -#ifdef _WIN32 +#ifdef USE_SSE2 if (TSystem::getCPUExtensions() & TSystem::CpuSupportsSse2) do_over_SSE2(rout32, rup32); else diff --git a/toonz/sources/common/trop/tresample.cpp b/toonz/sources/common/trop/tresample.cpp index 1f3cee2..59172e7 100644 --- a/toonz/sources/common/trop/tresample.cpp +++ b/toonz/sources/common/trop/tresample.cpp @@ -18,7 +18,11 @@ using namespace TConsts; -#ifdef _WIN32 +#if defined(_WIN32) && defined(x64) +#define USE_SSE2 +#endif + +#ifdef USE_SSE2 #include // per SSE2 #endif @@ -1345,7 +1349,7 @@ void resample_main_rgbm(TRasterPT rout, const TRasterPT &rin, //--------------------------------------------------------------------------- -#ifdef _WIN32 +#ifdef USE_SSE2 namespace { @@ -2563,7 +2567,7 @@ void rop_resample_rgbm(TRasterPT rout, const TRasterPT &rin, } } -#ifdef _WIN32 +#ifdef USE_SSE2 if ((TSystem::getCPUExtensions() & TSystem::CpuSupportsSse2) && T::maxChannelValue == 255) resample_main_rgbm_SSE2(rout, rin, aff_xy2uv, aff0_uv2fg, min_pix_ref_u, @@ -3205,7 +3209,7 @@ void do_resample(TRasterCM32P rout, const TRasterCM32P &rin, //----------------------------------------------------------------------------- -#ifdef _WIN32 +#ifdef USE_SSE2 template void resample_main_cm32_rgbm_SSE2(TRasterPT rout, const TRasterCM32P &rin, const TAffine &aff_xy2uv, @@ -4593,7 +4597,7 @@ void rop_resample_rgbm_2(TRasterPT rout, const TRasterCM32P &rin, } } -#ifdef _MSC_VER +#if defined(USE_SSE2) && defined(_MSC_VER) TRaster32P rout32 = rout; if ((TSystem::getCPUExtensions() & TSystem::CpuSupportsSse2) && rout32) resample_main_cm32_rgbm_SSE2( diff --git a/toonz/sources/common/trop/tropcm.cpp b/toonz/sources/common/trop/tropcm.cpp index 73e2b4a..26cf024 100644 --- a/toonz/sources/common/trop/tropcm.cpp +++ b/toonz/sources/common/trop/tropcm.cpp @@ -23,7 +23,7 @@ extern "C" { #include "toonz4.6/raster.h" } -#ifdef _WIN32 +#if defined(_WIN32) && defined(x64) #define USE_SSE2 #endif @@ -75,7 +75,7 @@ void TRop::convert(const TRaster32P &rasOut, const TRasterCM32P &rasIn, rasOut->lock(); rasIn->lock(); -#ifdef _WIN32 +#ifdef USE_SSE2 if (TSystem::getCPUExtensions() & TSystem::CpuSupportsSse2) { __m128i zeros = _mm_setzero_si128(); TPixelFloat *paints =