diff --git a/third_party/libopenjpeg/mct.c b/third_party/libopenjpeg/mct.c
index 88c8f4092..c4c2e732e 100644
--- a/third_party/libopenjpeg/mct.c
+++ b/third_party/libopenjpeg/mct.c
@@ -37,13 +37,15 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifdef __SSE__
+#if defined(__SSE__) && !defined(_M_IX86) && !defined(__i386)
+#define USE_SSE
 #include <xmmintrin.h>
 #endif
-#ifdef __SSE2__
+#if defined(__SSE2__) && !defined(_M_IX86) && !defined(__i386)
+#define USE_SSE2
 #include <emmintrin.h>
 #endif
-#ifdef __SSE4_1__
+#if defined(__SSE4_1__) && !defined(_M_IX86) && !defined(__i386)
 #include <smmintrin.h>
 #endif
 
@@ -72,7 +74,7 @@ const OPJ_FLOAT64 * opj_mct_get_mct_norms_real()
 /* <summary> */
 /* Forward reversible MCT. */
 /* </summary> */
-#ifdef __SSE2__
+#ifdef USE_SSE2
 void opj_mct_encode(
     OPJ_INT32* OPJ_RESTRICT c0,
     OPJ_INT32* OPJ_RESTRICT c1,
@@ -141,7 +143,7 @@ void opj_mct_encode(
 /* <summary> */
 /* Inverse reversible MCT. */
 /* </summary> */
-#ifdef __SSE2__
+#ifdef USE_SSE2
 void opj_mct_decode(
     OPJ_INT32* OPJ_RESTRICT c0,
     OPJ_INT32* OPJ_RESTRICT c1,
@@ -216,7 +218,7 @@ void opj_mct_encode_real(
     OPJ_SIZE_T n)
 {
     OPJ_SIZE_T i;
-#ifdef __SSE__
+#ifdef USE_SSE
     const __m128 YR = _mm_set1_ps(0.299f);
     const __m128 YG = _mm_set1_ps(0.587f);
     const __m128 YB = _mm_set1_ps(0.114f);
@@ -286,7 +288,7 @@ void opj_mct_decode_real(
     OPJ_SIZE_T n)
 {
     OPJ_SIZE_T i;
-#ifdef __SSE__
+#ifdef USE_SSE
     __m128 vrv, vgu, vgv, vbu;
     vrv = _mm_set1_ps(1.402f);
     vgu = _mm_set1_ps(0.34413f);
