From 49e45c46e4bf6aabe7ebbdf3712ddcc93e335cf4 Mon Sep 17 00:00:00 2001 From: Arun Raghavan Date: Fri, 3 Mar 2017 16:01:38 +0530 Subject: [PATCH] audio-resampler: Make SSE* conditionals consistent between C and headers This makes sure that we're checking the same set of flags between declaring and using SSE/SSE2/SSE4.1 functions. We also add the compiler defines (__SSE*__) to the headers so some cases (such as -mno-sse in CFLAGS -- i.e. the compiler specifies SSE support but either the native arch does not, or it has been explicitly disabled) will actually to work. --- gst-libs/gst/audio/audio-resampler-x86-sse.c | 2 +- gst-libs/gst/audio/audio-resampler-x86-sse2.c | 2 +- gst-libs/gst/audio/audio-resampler-x86-sse41.c | 2 +- gst-libs/gst/audio/audio-resampler-x86.h | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/gst-libs/gst/audio/audio-resampler-x86-sse.c b/gst-libs/gst/audio/audio-resampler-x86-sse.c index d100c59..a6fa184 100644 --- a/gst-libs/gst/audio/audio-resampler-x86-sse.c +++ b/gst-libs/gst/audio/audio-resampler-x86-sse.c @@ -23,7 +23,7 @@ #include "audio-resampler-x86-sse.h" -#if defined (HAVE_XMMINTRIN_H) && defined(__SSE__) +#if defined (HAVE_XMMINTRIN_H) && HAVE_SSE && defined(__SSE__) #include static inline void diff --git a/gst-libs/gst/audio/audio-resampler-x86-sse2.c b/gst-libs/gst/audio/audio-resampler-x86-sse2.c index a89fb41..8a0f392 100644 --- a/gst-libs/gst/audio/audio-resampler-x86-sse2.c +++ b/gst-libs/gst/audio/audio-resampler-x86-sse2.c @@ -23,7 +23,7 @@ #include "audio-resampler-x86-sse2.h" -#if defined (HAVE_EMMINTRIN_H) && defined(__SSE2__) +#if defined (HAVE_EMMINTRIN_H) && HAVE_SSE2 && defined(__SSE2__) #include static inline void diff --git a/gst-libs/gst/audio/audio-resampler-x86-sse41.c b/gst-libs/gst/audio/audio-resampler-x86-sse41.c index a14ca10..fb8ba29 100644 --- a/gst-libs/gst/audio/audio-resampler-x86-sse41.c +++ b/gst-libs/gst/audio/audio-resampler-x86-sse41.c @@ -30,7 +30,7 @@ #if defined (__x86_64__) && \ defined (HAVE_SMMINTRIN_H) && defined (HAVE_EMMINTRIN_H) && \ - defined (__SSE4_1__) + HAVE_SSE41 && defined (__SSE4_1__) #include #include diff --git a/gst-libs/gst/audio/audio-resampler-x86.h b/gst-libs/gst/audio/audio-resampler-x86.h index 47bc430..4cd87e6 100644 --- a/gst-libs/gst/audio/audio-resampler-x86.h +++ b/gst-libs/gst/audio/audio-resampler-x86.h @@ -26,7 +26,7 @@ static void audio_resampler_check_x86 (const gchar *option) { if (!strcmp (option, "sse")) { -#if defined (HAVE_XMMINTRIN_H) && HAVE_SSE +#if defined (HAVE_XMMINTRIN_H) && HAVE_SSE && defined (__SSE__) GST_DEBUG ("enable SSE optimisations"); resample_gfloat_full_1 = resample_gfloat_full_1_sse; resample_gfloat_linear_1 = resample_gfloat_linear_1_sse; @@ -38,7 +38,7 @@ audio_resampler_check_x86 (const gchar *option) GST_DEBUG ("SSE optimisations not enabled"); #endif } else if (!strcmp (option, "sse2")) { -#if defined (HAVE_EMMINTRIN_H) && HAVE_SSE2 +#if defined (HAVE_EMMINTRIN_H) && HAVE_SSE2 && defined (__SSE2__) GST_DEBUG ("enable SSE2 optimisations"); resample_gint16_full_1 = resample_gint16_full_1_sse2; resample_gint16_linear_1 = resample_gint16_linear_1_sse2; @@ -59,7 +59,7 @@ audio_resampler_check_x86 (const gchar *option) } else if (!strcmp (option, "sse41")) { #if defined (__x86_64__) && \ defined (HAVE_SMMINTRIN_H) && defined (HAVE_EMMINTRIN_H) && \ - HAVE_SSE41 + HAVE_SSE41 && defined (__SSE4_1__) GST_DEBUG ("enable SSE41 optimisations"); resample_gint32_full_1 = resample_gint32_full_1_sse41; resample_gint32_linear_1 = resample_gint32_linear_1_sse41; -- 2.9.3