diff --git a/LeopardCommon.h b/LeopardCommon.h index a737304..d8b4011 100644 --- a/LeopardCommon.h +++ b/LeopardCommon.h @@ -46,6 +46,8 @@ + Look into using FFT_m instead of FFT_n for decoder */ +#include "leopard.h" + #include @@ -72,6 +74,10 @@ //------------------------------------------------------------------------------ // Platform/Architecture +#ifdef _MSC_VER + #include +#endif + #if defined(ANDROID) || defined(IOS) #define LEO_TARGET_MOBILE #endif // ANDROID @@ -172,10 +178,6 @@ extern bool CpuHasSSSE3; //------------------------------------------------------------------------------ // Portable Intrinsics -#ifdef _MSC_VER -#include -#endif - // Returns highest bit index 0..31 where the first non-zero bit is found // Precondition: x != 0 LEO_FORCE_INLINE unsigned LastNonzeroBit32(unsigned x) diff --git a/LeopardFF16.cpp b/LeopardFF16.cpp index bd5c1cb..76934f4 100644 --- a/LeopardFF16.cpp +++ b/LeopardFF16.cpp @@ -27,6 +27,9 @@ */ #include "LeopardFF16.h" + +#ifdef LEO_HAS_FF16 + #include // Define this to enable the optimized version of FWHT() @@ -1050,3 +1053,5 @@ bool Initialize() }} // namespace leopard::ff16 + +#endif // LEO_HAS_FF16 diff --git a/LeopardFF16.h b/LeopardFF16.h index 981b9a9..b43c7f1 100644 --- a/LeopardFF16.h +++ b/LeopardFF16.h @@ -30,6 +30,8 @@ #include "LeopardCommon.h" +#ifdef LEO_HAS_FF16 + /* 16-bit Finite Field Math @@ -156,3 +158,5 @@ bool Initialize(); }} // namespace leopard::ff16 + +#endif // LEO_HAS_FF16 diff --git a/LeopardFF8.cpp b/LeopardFF8.cpp index 1e7d7cd..ee01299 100644 --- a/LeopardFF8.cpp +++ b/LeopardFF8.cpp @@ -27,6 +27,9 @@ */ #include "LeopardFF8.h" + +#ifdef LEO_HAS_FF8 + #include // Define this to enable the optimized version of FWHT() @@ -934,3 +937,5 @@ bool Initialize() }} // namespace leopard::ff8 + +#endif // LEO_HAS_FF8 \ No newline at end of file diff --git a/LeopardFF8.h b/LeopardFF8.h index 88efa3f..2f11ff4 100644 --- a/LeopardFF8.h +++ b/LeopardFF8.h @@ -30,6 +30,8 @@ #include "LeopardCommon.h" +#ifdef LEO_HAS_FF8 + /* 8-bit Finite Field Math @@ -156,3 +158,5 @@ bool Initialize(); }} // namespace leopard::ff8 + +#endif // LEO_HAS_FF8 diff --git a/leopard.cpp b/leopard.cpp index 51850f9..0df720c 100644 --- a/leopard.cpp +++ b/leopard.cpp @@ -27,8 +27,13 @@ */ #include "leopard.h" -#include "LeopardFF8.h" -#include "LeopardFF16.h" + +#ifdef LEO_HAS_FF8 + #include "LeopardFF8.h" +#endif // LEO_HAS_FF8 +#ifdef LEO_HAS_FF16 + #include "LeopardFF16.h" +#endif // LEO_HAS_FF16 extern "C" { @@ -43,11 +48,15 @@ LEO_EXPORT int leo_init_(int version) if (version != LEO_VERSION) return Leopard_InvalidInput; +#ifdef LEO_HAS_FF8 if (!leopard::ff8::Initialize()) return Leopard_Platform; +#endif // LEO_HAS_FF8 +#ifdef LEO_HAS_FF16 if (!leopard::ff16::Initialize()) return Leopard_Platform; +#endif // LEO_HAS_FF16 m_Initialized = true; return Leopard_Success; @@ -90,6 +99,7 @@ LEO_EXPORT LeopardResult leo_encode( const bool mt = (flags & LeopardFlags_Multithreaded) != 0; +#ifdef LEO_HAS_FF8 if (n <= leopard::ff8::kOrder) { leopard::ff8::Encode( @@ -100,7 +110,10 @@ LEO_EXPORT LeopardResult leo_encode( original_data, work_data); } - else if (n <= leopard::ff16::kOrder) + else +#endif // LEO_HAS_FF8 +#ifdef LEO_HAS_FF16 + if (n <= leopard::ff16::kOrder) { leopard::ff16::Encode( buffer_bytes, @@ -111,6 +124,7 @@ LEO_EXPORT LeopardResult leo_encode( work_data); } else +#endif // LEO_HAS_FF16 return Leopard_TooMuchData; return Leopard_Success; @@ -156,6 +170,7 @@ LEO_EXPORT LeopardResult leo_decode( const bool mt = (flags & LeopardFlags_Multithreaded) != 0; +#ifdef LEO_HAS_FF8 if (n <= leopard::ff8::kOrder) { leopard::ff8::Decode( @@ -168,7 +183,10 @@ LEO_EXPORT LeopardResult leo_decode( recovery_data, work_data); } - else if (n <= leopard::ff16::kOrder) + else +#endif // LEO_HAS_FF8 +#ifdef LEO_HAS_FF16 + if (n <= leopard::ff16::kOrder) { leopard::ff16::Decode( buffer_bytes, @@ -181,6 +199,7 @@ LEO_EXPORT LeopardResult leo_decode( work_data); } else +#endif // LEO_HAS_FF16 return Leopard_TooMuchData; return Leopard_Success; diff --git a/leopard.h b/leopard.h index e8a6b4f..bcfdade 100644 --- a/leopard.h +++ b/leopard.h @@ -41,6 +41,10 @@ // Library version #define LEO_VERSION 1 +// Enable 8-bit or 16-bit fields +#define LEO_HAS_FF8 +//#define LEO_HAS_FF16 + // Tweak if the functions are exported or statically linked //#define LEO_DLL /* Defined when building/linking as DLL */ //#define LEO_BUILDING /* Defined by the library makefile */ diff --git a/proj/Leopard.vcxproj b/proj/Leopard.vcxproj index c5c69b5..4759b19 100644 --- a/proj/Leopard.vcxproj +++ b/proj/Leopard.vcxproj @@ -21,14 +21,14 @@ - + - + {32176592-2F30-4BD5-B645-EB11C8D3453E} diff --git a/proj/Leopard.vcxproj.filters b/proj/Leopard.vcxproj.filters index df7d586..90de3fa 100644 --- a/proj/Leopard.vcxproj.filters +++ b/proj/Leopard.vcxproj.filters @@ -21,10 +21,10 @@ Source Files - + Source Files - + Source Files @@ -35,10 +35,10 @@ Source Files - + Source Files - + Source Files diff --git a/tests/benchmark.cpp b/tests/benchmark.cpp index 2b0719f..1b1b75b 100644 --- a/tests/benchmark.cpp +++ b/tests/benchmark.cpp @@ -9,7 +9,7 @@ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name of Leopard nor the names of its contributors may be + * Neither the name of Leopard-RS nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/tests/experiments.cpp b/tests/experiments.cpp index f2c6a4e..f057147 100644 --- a/tests/experiments.cpp +++ b/tests/experiments.cpp @@ -9,7 +9,7 @@ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name of LHC-RS nor the names of its contributors may be + * Neither the name of Leopard-RS nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. @@ -67,8 +67,6 @@ #endif - - //------------------------------------------------------------------------------ // Field