shithub: mp3dec

Download patch

ref: 892224b72a4fc0180090cc47f5cc7b1eefa7b3c9
parent: 25006952edd463e3121cf39ddc40dc7943158cc9
parent: 62119d124d780294b057c4502de3a1494c3ec69e
author: Lion <lieff@users.noreply.github.com>
date: Sat Feb 17 10:39:14 EST 2018

Merge pull request #13 from manxorist/no-simd
Add MINIMP3_NO_SIMD configuration macro

--- a/README.md
+++ b/README.md
@@ -69,6 +69,7 @@
 ```
 //#define MINIMP3_ONLY_MP3
 //#define MINIMP3_ONLY_SIMD
+//#define MINIMP3_NO_SIMD
 //#define MINIMP3_NONSTANDARD_BUT_LOGICAL
 #define MINIMP3_IMPLEMENTATION
 #include "minimp3.h"
@@ -81,6 +82,7 @@
 You can ``#include`` ``minimp3.h`` in as many files as you like.
 Also you can use ``MINIMP3_ONLY_MP3`` define to strip MP1/MP2 decoding code.
 MINIMP3_ONLY_SIMD define controls generic (non SSE/NEON) code generation (always enabled on x64/arm64 targets).
+In case you do not want any platform-specific SIMD optimizations, you can define ``MINIMP3_NO_SIMD``.
 MINIMP3_NONSTANDARD_BUT_LOGICAL define saves some code bytes, and enforces non-stadnard but logical behaviour of mono-stereo transition (rare case).
 
 Then. we decode the input stream frame-by-frame:
--- a/minimp3.h
+++ b/minimp3.h
@@ -80,6 +80,8 @@
 #define MINIMP3_MIN(a, b)           ((a) > (b) ? (b) : (a))
 #define MINIMP3_MAX(a, b)           ((a) < (b) ? (b) : (a))
 
+#if !defined(MINIMP3_NO_SIMD)
+
 #if !defined(MINIMP3_ONLY_SIMD) && (defined(_M_X64) || defined(_M_ARM64) || defined(__x86_64__) || defined(__aarch64__))
 /* x64 always have SSE2, arm64 always have neon, no need for generic code */
 #define MINIMP3_ONLY_SIMD
@@ -179,6 +181,12 @@
 #ifdef MINIMP3_ONLY_SIMD
 #error MINIMP3_ONLY_SIMD used, but SSE/NEON not enabled
 #endif
+#endif
+
+#else
+
+#define HAVE_SIMD 0
+
 #endif
 
 typedef struct