Skip to content

Commit

Permalink
Use include_sse2neon.h in gcore/overview functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
rouault committed Mar 17, 2024
1 parent 450da77 commit 4e225a7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
7 changes: 6 additions & 1 deletion gcore/gdalsse_priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,18 @@
#if (defined(__x86_64) || defined(_M_X64) || defined(USE_SSE2)) && \
!defined(USE_SSE2_EMULATION)

#include <string.h>

#ifdef USE_NEON_OPTIMIZATIONS
#include "include_sse2neon.h"
#else
/* Requires SSE2 */
#include <emmintrin.h>
#include <string.h>

#ifdef __SSE4_1__
#include <smmintrin.h>
#endif
#endif

#include "gdal_priv_templates.hpp"

Expand Down
12 changes: 9 additions & 3 deletions gcore/overview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,15 @@
#include "gdal_thread_pool.h"
#include "gdalwarper.h"

#ifdef USE_NEON_OPTIMIZATIONS
#include "include_sse2neon.h"
#define USE_SSE2

#include "gdalsse_priv.h"

// Restrict to 64bit processors because they are guaranteed to have SSE2,
// or if __AVX2__ is defined.
#if defined(__x86_64) || defined(_M_X64) || defined(__AVX2__)
#elif defined(__x86_64) || defined(_M_X64) || defined(__AVX2__)
#define USE_SSE2

#include "gdalsse_priv.h"
Expand Down Expand Up @@ -320,7 +326,7 @@ inline GUInt16 ComputeIntegerRMS_4values<GUInt16, double>(double sumSquares)
/* QuadraticMeanByteSSE2OrAVX2() */
/************************************************************************/

#ifdef __SSE4_1__
#if defined(__SSE4_1__) || defined(USE_NEON_OPTIMIZATIONS)
#define sse2_packus_epi32 _mm_packus_epi32
#else
inline __m128i sse2_packus_epi32(__m128i a, __m128i b)
Expand All @@ -335,7 +341,7 @@ inline __m128i sse2_packus_epi32(__m128i a, __m128i b)
}
#endif

#ifdef __SSSE3__
#if defined(__SSSE3__) || defined(USE_NEON_OPTIMIZATIONS)
#define sse2_hadd_epi16 _mm_hadd_epi16
#else
inline __m128i sse2_hadd_epi16(__m128i a, __m128i b)
Expand Down

0 comments on commit 4e225a7

Please sign in to comment.