From 3b64292dd2741b819886f7896fb8f20e356dda1b Mon Sep 17 00:00:00 2001 From: EleonoreMizo Date: Thu, 19 Dec 2019 13:37:23 +0100 Subject: [PATCH] Fixed various issues and a lot of unimportant warnings --- src/AvstpWrapper.cpp | 15 +++- src/conc/AtomicInt.h | 4 +- src/conc/AtomicMem.h | 3 +- src/conc/AtomicMem.hpp | 5 +- src/conc/AtomicPtr.h | 4 +- src/conc/AtomicPtrIntPair.h | 25 ++++-- src/conc/AtomicPtrIntPair.hpp | 16 ++-- src/conc/CellPool.h | 2 +- src/conc/CellPool.hpp | 7 +- src/conc/Interlocked.h | 20 ++--- src/conc/Interlocked.hpp | 8 +- src/conc/LockFreeQueue.hpp | 4 +- src/conc/README.md | 15 ++++ src/conc/def.h | 6 +- src/fmtc/Bitdepth.cpp | 109 +++++++++++++++++--------- src/fmtc/Convert.cpp | 11 +++ src/fmtc/Matrix.cpp | 6 +- src/fmtc/Matrix2020CL.cpp | 7 ++ src/fmtc/NativeToStack16.cpp | 6 ++ src/fmtc/Primaries.cpp | 12 ++- src/fmtc/Primaries.h | 2 +- src/fmtc/Resample.cpp | 17 ++++ src/fmtc/Stack16ToNative.cpp | 6 ++ src/fmtc/Transfer.cpp | 10 +++ src/fmtcl/ArrayMultiType.hpp | 10 +-- src/fmtcl/BitBltConv.cpp | 4 + src/fmtcl/BitBltConv_avx2.cpp | 4 + src/fmtcl/ContFirSnh.cpp | 3 + src/fmtcl/ContFirSpline.cpp | 1 + src/fmtcl/FilterResize.cpp | 4 + src/fmtcl/KernelData.cpp | 3 + src/fmtcl/Matrix2020CLProc.cpp | 28 +++---- src/fmtcl/MatrixProc.cpp | 4 +- src/fmtcl/MatrixProc_avx.cpp | 3 + src/fmtcl/MatrixProc_avx2.cpp | 2 +- src/fmtcl/ProxyRwAvx2.hpp | 5 ++ src/fmtcl/ProxyRwSse2.hpp | 5 ++ src/fmtcl/Scaler.cpp | 3 +- src/fmtcl/ScalerCopy.h | 2 + src/fmtcl/Scaler_avx2.cpp | 2 +- src/fmtcl/VoidAndCluster.cpp | 6 +- src/fstb/AllocAlign.h | 4 +- src/fstb/AllocAlign.hpp | 2 + src/fstb/ArrayAlign.hpp | 3 + src/fstb/CpuId.cpp | 74 ++++++++---------- src/fstb/CpuId.h | 2 +- src/fstb/ToolsSse2.cpp | 10 ++- src/fstb/def.h | 137 +++++++++++++++++++++++++++++---- src/fstb/fnc.cpp | 4 +- src/fstb/fnc.hpp | 61 ++++++++------- src/main.cpp | 11 ++- src/vsutl/ObjRefSPtr.h | 2 +- src/vsutl/ObjRefSPtr.hpp | 20 ++--- src/vsutl/PlaneProcessor.cpp | 2 + src/vsutl/Redirect.hpp | 5 ++ 55 files changed, 528 insertions(+), 218 deletions(-) create mode 100644 src/conc/README.md diff --git a/src/AvstpWrapper.cpp b/src/AvstpWrapper.cpp index 410075a..7aa083d 100644 --- a/src/AvstpWrapper.cpp +++ b/src/AvstpWrapper.cpp @@ -184,6 +184,11 @@ AvstpWrapper::AvstpWrapper () +template +inline void AvstpWrapper_unused (T &&...) { } + + + template void AvstpWrapper::resolve_name (T &fnc_ptr, const char *name_0) { @@ -200,6 +205,8 @@ void AvstpWrapper::resolve_name (T &fnc_ptr, const char *name_0) _dll_hnd = 0; throw std::runtime_error ("Function missing in avstp.dll."); } +#else + AvstpWrapper_unused (fnc_ptr, name_0); #endif } @@ -243,9 +250,15 @@ avstp_TaskDispatcher * AvstpWrapper::fallback_create_dispatcher_ptr () -void AvstpWrapper::fallback_destroy_dispatcher_ptr (avstp_TaskDispatcher *td_ptr) +void AvstpWrapper::fallback_destroy_dispatcher_ptr (avstp_TaskDispatcher * +#if ! defined (NDEBUG) + td_ptr +#endif +) { +#if ! defined (NDEBUG) assert (td_ptr == (avstp_TaskDispatcher *) (&_dummy_dispatcher)); +#endif } diff --git a/src/conc/AtomicInt.h b/src/conc/AtomicInt.h index 2ff1167..2117805 100644 --- a/src/conc/AtomicInt.h +++ b/src/conc/AtomicInt.h @@ -127,10 +127,12 @@ class AtomicInt #else // conc_ARCHI +#if (__cplusplus >= 201703L) static_assert ( - std::atomic ::is_lock_free, + std::atomic ::is_always_lock_free, "Atomic data must be lock-free." ); +#endif std::atomic _val; #endif // conc_ARCHI diff --git a/src/conc/AtomicMem.h b/src/conc/AtomicMem.h index f34dd52..2975666 100644 --- a/src/conc/AtomicMem.h +++ b/src/conc/AtomicMem.h @@ -30,6 +30,7 @@ To Public License, Version 2, as published by Sam Hocevar. See /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ #include "conc/def.h" +#include "conc/Interlocked.h" #if defined (conc_HAS_CAS_128) #include @@ -80,7 +81,7 @@ template <> class AtomicMem <4> { public: - typedef __m128i DataType; + typedef Interlocked::Data128 DataType; conc_TYPEDEF_ALIGN (16, DataType, DataTypeAlign); conc_FORCEINLINE static DataType diff --git a/src/conc/AtomicMem.hpp b/src/conc/AtomicMem.hpp index 46ccab6..e639a6b 100644 --- a/src/conc/AtomicMem.hpp +++ b/src/conc/AtomicMem.hpp @@ -23,7 +23,6 @@ To Public License, Version 2, as published by Sam Hocevar. See /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ #include "conc/def.h" -#include "conc/Interlocked.h" @@ -70,7 +69,7 @@ AtomicMem <3>::DataType AtomicMem <3>::cas (volatile DataType &dest, DataType ex -#if defined (ohm_archi_HAS_CAS_128) +#if defined (fstb_HAS_CAS_128) @@ -109,7 +108,7 @@ AtomicMem <4>::DataType AtomicMem <4>::cas (volatile DataType &dest, DataType ex -#endif // ohm_archi_HAS_CAS_128 +#endif // fstb_HAS_CAS_128 diff --git a/src/conc/AtomicPtr.h b/src/conc/AtomicPtr.h index 26016d9..293431a 100644 --- a/src/conc/AtomicPtr.h +++ b/src/conc/AtomicPtr.h @@ -92,10 +92,12 @@ class AtomicPtr #else // conc_ARCHI +#if (__cplusplus >= 201703L) static_assert ( - std::atomic ::is_lock_free, + std::atomic ::is_always_lock_free, "Atomic data must be lock-free." ); +#endif std::atomic _ptr; diff --git a/src/conc/AtomicPtrIntPair.h b/src/conc/AtomicPtrIntPair.h index 8ef1e00..b466ade 100644 --- a/src/conc/AtomicPtrIntPair.h +++ b/src/conc/AtomicPtrIntPair.h @@ -28,11 +28,15 @@ To Public License, Version 2, as published by Sam Hocevar. See +#define conc_USE_STD_ATOMIC_128BITS 0 + + + /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ #include "conc/def.h" -#if (conc_ARCHI == conc_ARCHI_X86) +#if (conc_ARCHI == conc_ARCHI_X86 || ! conc_USE_STD_ATOMIC_128BITS) #include "conc/Interlocked.h" #else // conc_ARCHI #include @@ -76,16 +80,20 @@ class AtomicPtrIntPair private: -#if (conc_ARCHI == conc_ARCHI_X86) +#if (conc_ARCHI == conc_ARCHI_X86 || ! conc_USE_STD_ATOMIC_128BITS) #if (conc_WORD_SIZE == 64) - typedef Interlocked::Data128 DataType; +#if (! conc_HAS_CAS_128) + #error 128-bit CAS is required for AtomicPtrIntPair on 64-bit architectures +#endif + + typedef typename Interlocked::Data128 DataType; conc_TYPEDEF_ALIGN (16, DataType, DataTypeAlign); #else // conc_WORD_SIZE - typedef int64_t DataType; + typedef int64_t DataType; conc_TYPEDEF_ALIGN (8, DataType, DataTypeAlign); #endif // conc_WORD_SIZE @@ -94,9 +102,10 @@ class AtomicPtrIntPair { public: T * volatile _ptr; - volatile ptrdiff_t + volatile intptr_t _val; }; + static_assert (sizeof (RealContent) <= sizeof (DataType), ""); union Combi { @@ -114,13 +123,15 @@ class AtomicPtrIntPair { public: T * _ptr; - ptrdiff_t _val; + intptr_t _val; }; +#if (__cplusplus >= 201703L) static_assert ( - std::atomic ::is_lock_free, + std::atomic ::is_always_lock_free, "Atomic data must be lock-free." ); +#endif std::atomic _data; diff --git a/src/conc/AtomicPtrIntPair.hpp b/src/conc/AtomicPtrIntPair.hpp index bda95d0..850894d 100644 --- a/src/conc/AtomicPtrIntPair.hpp +++ b/src/conc/AtomicPtrIntPair.hpp @@ -39,10 +39,6 @@ template AtomicPtrIntPair ::AtomicPtrIntPair () : _data () { -#if (conc_ARCHI == conc_ARCHI_X86) - static_assert (sizeof (RealContent) == sizeof (DataType), ""); -#endif // conc_ARCHI - set (0, 0); } @@ -50,7 +46,7 @@ AtomicPtrIntPair ::AtomicPtrIntPair () template void AtomicPtrIntPair ::set (T * ptr, ptrdiff_t val) { -#if (conc_ARCHI == conc_ARCHI_X86) +#if (conc_ARCHI == conc_ARCHI_X86 || ! conc_USE_STD_ATOMIC_128BITS) _data._content._ptr = ptr; _data._content._val = val; @@ -68,7 +64,7 @@ void AtomicPtrIntPair ::set (T * ptr, ptrdiff_t val) template void AtomicPtrIntPair ::get (T * &ptr, ptrdiff_t &val) const { -#if (conc_ARCHI == conc_ARCHI_X86) +#if (conc_ARCHI == conc_ARCHI_X86 || ! conc_USE_STD_ATOMIC_128BITS) Combi res; Combi old; @@ -96,7 +92,7 @@ void AtomicPtrIntPair ::get (T * &ptr, ptrdiff_t &val) const template T * AtomicPtrIntPair ::get_ptr () const { -#if (conc_ARCHI == conc_ARCHI_X86) +#if (conc_ARCHI == conc_ARCHI_X86 || ! conc_USE_STD_ATOMIC_128BITS) return (_data._content._ptr); @@ -114,7 +110,7 @@ T * AtomicPtrIntPair ::get_ptr () const template ptrdiff_t AtomicPtrIntPair ::get_val () const { -#if (conc_ARCHI == conc_ARCHI_X86) +#if (conc_ARCHI == conc_ARCHI_X86 || ! conc_USE_STD_ATOMIC_128BITS) return (_data._content._val); @@ -132,7 +128,7 @@ ptrdiff_t AtomicPtrIntPair ::get_val () const template bool AtomicPtrIntPair ::cas2 (T *new_ptr, ptrdiff_t new_val, T *comp_ptr, ptrdiff_t comp_val) { -#if (conc_ARCHI == conc_ARCHI_X86) +#if (conc_ARCHI == conc_ARCHI_X86 || ! conc_USE_STD_ATOMIC_128BITS) Combi newx; newx._content._ptr = new_ptr; @@ -167,7 +163,7 @@ bool AtomicPtrIntPair ::cas2 (T *new_ptr, ptrdiff_t new_val, T *comp_ptr, ptr -#if (conc_ARCHI == conc_ARCHI_X86) +#if (conc_ARCHI == conc_ARCHI_X86 || ! conc_USE_STD_ATOMIC_128BITS) template void AtomicPtrIntPair ::cas_combi (Combi &old, Combi &dest, const Combi &excg, const Combi &comp) diff --git a/src/conc/CellPool.h b/src/conc/CellPool.h index 587dbd3..ce14cb1 100644 --- a/src/conc/CellPool.h +++ b/src/conc/CellPool.h @@ -104,7 +104,7 @@ class CellPool size_t _nbr_elt; }; - void allocate_zone (int zone_index, size_t cur_size, AtomicPtr & zone_ptr_ref); + void allocate_zone (size_t cur_size, AtomicPtr & zone_ptr_ref); static inline size_t compute_grown_size (size_t prev_size); diff --git a/src/conc/CellPool.hpp b/src/conc/CellPool.hpp index 01312ba..5bd6152 100644 --- a/src/conc/CellPool.hpp +++ b/src/conc/CellPool.hpp @@ -116,7 +116,7 @@ void CellPool ::expand_to (size_t nbr_cells) CellType * zone_ptr = zone_ptr_ref; if (zone_ptr == 0) { - allocate_zone (zone_index, cur_size, zone_ptr_ref); + allocate_zone (cur_size, zone_ptr_ref); } total_size += cur_size; @@ -180,11 +180,8 @@ void CellPool ::return_cell (CellType &cell) template -void CellPool ::allocate_zone (int zone_index, size_t cur_size, AtomicPtr & zone_ptr_ref) +void CellPool ::allocate_zone (size_t cur_size, AtomicPtr & zone_ptr_ref) { - assert (zone_index >= 0); - assert (zone_index < MAX_NBR_ZONES); - std::lock_guard lock (_alloc_mutex); CellType * zone_ptr = alloc_cells (cur_size); diff --git a/src/conc/Interlocked.h b/src/conc/Interlocked.h index d61c530..1ad2d0a 100644 --- a/src/conc/Interlocked.h +++ b/src/conc/Interlocked.h @@ -57,7 +57,11 @@ class Interlocked #if defined (conc_HAS_CAS_128) - #if defined (_MSC_VER) + #if defined (__GNUC__) + + typedef unsigned __int128 Data128; + + #elif defined (_MSC_VER) class Data128 { @@ -66,14 +70,14 @@ class Interlocked operator == (const Data128 & other) const; conc_FORCEINLINE bool operator != (const Data128 & other) const; - - uint64_t _data [2]; + + int64_t _data [2]; }; static_assert ((sizeof (Data128) == 16), ""); #else - typedef __uint128_t Data128; + typedef __uint128_t Data128; #endif @@ -101,12 +105,8 @@ class Interlocked private: -#if (conc_WORD_SIZE == 64) - typedef int64_t IntPtr; -#else - typedef int32_t IntPtr; -#endif - static_assert ((sizeof (IntPtr) == sizeof (void *)), ""); + typedef intptr_t IntPtr; + static_assert ((sizeof (IntPtr) >= sizeof (void *)), ""); diff --git a/src/conc/Interlocked.hpp b/src/conc/Interlocked.hpp index 5aba2af..957e933 100644 --- a/src/conc/Interlocked.hpp +++ b/src/conc/Interlocked.hpp @@ -280,8 +280,8 @@ void Interlocked::cas (Data128 &old, volatile Data128 &dest, const Data128 &excg #elif defined (_MSC_VER) - const int64_t excg_lo = ((const int64_t *) &excg) [0]; - const int64_t excg_hi = ((const int64_t *) &excg) [1]; + const int64_t excg_lo = excg._data [0]; + const int64_t excg_hi = excg._data [1]; old = comp; @@ -292,6 +292,10 @@ void Interlocked::cas (Data128 &old, volatile Data128 &dest, const Data128 &excg reinterpret_cast (&old) ); + #elif defined (__GNUC__) + + old = __sync_val_compare_and_swap (&dest, comp, excg); + #else ::InterlockedCompareExchange128 ( diff --git a/src/conc/LockFreeQueue.hpp b/src/conc/LockFreeQueue.hpp index f9dade1..c84b538 100644 --- a/src/conc/LockFreeQueue.hpp +++ b/src/conc/LockFreeQueue.hpp @@ -49,8 +49,6 @@ LockFreeQueue ::LockFreeQueue () template void LockFreeQueue ::enqueue (CellType &cell) { - assert (&cell != 0); - cell._next_ptr = 0; // set the cell next pointer to NULL CellType * tail_ptr; @@ -127,7 +125,7 @@ typename LockFreeQueue ::CellType * LockFreeQueue ::dequeue () head_ptr = dequeue (); // and pop a cell again } - return (head_ptr); + return head_ptr; } diff --git a/src/conc/README.md b/src/conc/README.md new file mode 100644 index 0000000..d6f8302 --- /dev/null +++ b/src/conc/README.md @@ -0,0 +1,15 @@ +# Conc + +A library for lock-free inter-thread communications. It enables easy inter-tread communication and avoids locking critical threads with mutexes or other synchronisation objects. + +Here are the main utility classes, from a user’s point of view: + +- **`LockFreeCell`**: A template class to wrap a message object and use it in `LockFreeStack`, `LockFreeQueue` or `CellPool`. +- **`LockFreeStack`**: Lock-free stack (LIFO), completely thread-safe. +- **`LockFreeQueue`**: Lock-free queue (FIFO). Concurrent N to M threads access. It’s your main communication building block. +- **`CellPool`**: thread-safe storage for unused or recycled `LockFreeCell` objects. +- **`ObjPool`**: Like `CellPool`, but for any kind of object, providing additional control over creation. + +These classes rely on atomic primitives (using Compare-And-Swap instructions). The **`Atomic*`** classes provide basic data storage, with `AtomicPtrIntPair` being the cornerstone of the previous data structures. **`AtomicIntOp`** is a helper wrapping a user-functor into a CAS loop to execute synchronized operations. There are some functor examples in the **`Aio*`** classes. + +Some of these classes are probably less useful since the introduction of the `` header in C++11, anyway the **`Interlocked`** class probably offers stronger lock-free guaranties, especially for 128-bit CAS required by `AtomicPtrIntPair` on 64-bit systems. \ No newline at end of file diff --git a/src/conc/def.h b/src/conc/def.h index 747b70e..58d54ad 100644 --- a/src/conc/def.h +++ b/src/conc/def.h @@ -39,7 +39,7 @@ namespace conc #if defined (__i386__) || defined (_M_IX86) || defined (_X86_) || defined (_M_X64) || defined (__x86_64__) || defined (__INTEL__) #define conc_ARCHI conc_ARCHI_X86 -#elif defined (__arm__) || defined (_M_ARM) || defined (__aarch64__) +#elif defined (__arm__) || defined (__arm) || defined (__arm64__) || defined (__arm64) || defined (_M_ARM) || defined (__aarch64__) #define conc_ARCHI conc_ARCHI_ARM #else #error @@ -48,7 +48,7 @@ namespace conc // Native word size, in power of 2 bits -#if defined (_WIN64) || defined (__64BIT__) || defined (__amd64__) || defined (__x86_64__) +#if defined (_WIN64) || defined (__64BIT__) || defined (__amd64__) || defined (__x86_64__) || defined (__aarch64__) || defined (__arm64__) || defined (__arm64) #define conc_WORD_SIZE_L2 6 #define conc_WORD_SIZE 64 #define conc_WORD_SIZE_BYTE 8 @@ -61,7 +61,7 @@ namespace conc // 128-bit compare and swap -#if (conc_WORD_SIZE_L2 >= 6) && (conc_ARCHI == conc_ARCHI_X86) +#if (conc_WORD_SIZE_L2 >= 6) && (conc_ARCHI == conc_ARCHI_X86 || conc_ARCHI == conc_ARCHI_ARM) #define conc_HAS_CAS_128 1 #endif diff --git a/src/fmtc/Bitdepth.cpp b/src/fmtc/Bitdepth.cpp index 0e6d3da..78f284a 100644 --- a/src/fmtc/Bitdepth.cpp +++ b/src/fmtc/Bitdepth.cpp @@ -24,13 +24,13 @@ To Public License, Version 2, as published by Sam Hocevar. See /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ -#include "fstb/def.h" #include "fmtc/Bitdepth.h" #include "fmtc/SplFmtUtl.h" #if (fstb_ARCHI == fstb_ARCHI_X86) #include "fmtcl/ProxyRwSse2.h" #endif #include "fmtcl/VoidAndCluster.h" +#include "fstb/def.h" #include "fstb/fnc.h" #include "vsutl/CpuOpt.h" #include "vsutl/fnc.h" @@ -55,7 +55,14 @@ Bitdepth::Bitdepth (const ::VSMap &in, ::VSMap &out, void *user_data_ptr, ::VSCo , _clip_src_sptr (vsapi.propGetNode (&in, "clip", 0, 0), vsapi) , _vi_in (*_vsapi.getVideoInfo (_clip_src_sptr.get ())) , _vi_out (_vi_in) +#if defined (_MSC_VER) +#pragma warning (push) +#pragma warning (disable : 4355) +#endif // 'this': used in base member initializer list , _plane_processor (vsapi, *this, "bitdepth", true) +#if defined (_MSC_VER) +#pragma warning (pop) +#endif , _splfmt_src (fmtcl::SplFmt_ILLEGAL) , _splfmt_dst (fmtcl::SplFmt_ILLEGAL) , _scale_info_arr () @@ -82,6 +89,8 @@ Bitdepth::Bitdepth (const ::VSMap &in, ::VSMap &out, void *user_data_ptr, ::VSCo , _process_seg_int_int_ptr (0) , _process_seg_flt_int_ptr (0) { + fstb::unused (user_data_ptr); + vsutl::CpuOpt cpu_opt (*this, in, out); _sse2_flag = cpu_opt.has_sse2 (); _avx2_flag = cpu_opt.has_avx2 (); @@ -265,6 +274,8 @@ Bitdepth::Bitdepth (const ::VSMap &in, ::VSMap &out, void *user_data_ptr, ::VSCo void Bitdepth::init_filter (::VSMap &in, ::VSMap &out, ::VSNode &node, ::VSCore &core) { + fstb::unused (core); + _vsapi.setVideoInfo (&_vi_out, 1, &node); _plane_processor.set_filter (in, out, _vi_out, true); } @@ -316,6 +327,7 @@ const ::VSFrameRef * Bitdepth::get_frame (int n, int activation_reason, void * & int Bitdepth::do_process_plane (::VSFrameRef &dst, int n, int plane_index, void *frame_data_ptr, ::VSFrameContext &frame_ctx, ::VSCore &core, const vsutl::NodeRefSPtr &src_node1_sptr, const vsutl::NodeRefSPtr &src_node2_sptr, const vsutl::NodeRefSPtr &src_node3_sptr) { + fstb::unused (frame_data_ptr, core, src_node2_sptr, src_node3_sptr); assert (src_node1_sptr.get () != 0); int ret_val = 0; @@ -927,6 +939,7 @@ void Bitdepth::init_fnc_errdiff () void Bitdepth::dither_plane (fmtcl::SplFmt dst_fmt, int dst_res, uint8_t *dst_ptr, int dst_stride, fmtcl::SplFmt src_fmt, int src_res, const uint8_t *src_ptr, int src_stride, int w, int h, const fmtcl::BitBltConv::ScaleInfo &scale_info, const PatData &pattern, uint32_t rnd_state) { + fstb::unused (dst_fmt); assert (dst_fmt >= 0); assert (dst_fmt < fmtcl::SplFmt_NBR_ELT); assert (dst_res >= 8); @@ -1280,8 +1293,8 @@ void Bitdepth::process_seg_ord_int_int_sse2 (uint8_t *dst_ptr, const uint8_t *sr const __m128i rcst = _mm_set1_epi16 (1 << (DIF_BITS - 1)); const __m128i vmax = _mm_set1_epi16 ((1 << DST_BITS) - 1); - const __m128i ampo_i = _mm_set1_epi16 (_ampo_i); // 8 ?16 [0 ; 255] - const __m128i ampn_i = _mm_set1_epi16 (_ampn_i); // 8 ?16 [0 ; 255] + const __m128i ampo_i = _mm_set1_epi16 (int16_t (_ampo_i)); // 8 ?16 [0 ; 255] + const __m128i ampn_i = _mm_set1_epi16 (int16_t (_ampn_i)); // 8 ?16 [0 ; 255] for (int pos = 0; pos < w; pos += 8) { @@ -1385,8 +1398,8 @@ void Bitdepth::process_seg_ord_flt_int_sse2 (uint8_t *dst_ptr, const uint8_t *sr const __m128i mask_lsb = _mm_set1_epi16 (0x00FF); const __m128i sign_bit = _mm_set1_epi16 (-0x8000); - const __m128i ampo_i = _mm_set1_epi16 (_ampo_i); // 8 ?16 [0 ; 255] - const __m128i ampn_i = _mm_set1_epi16 (_ampn_i); // 8 ?16 [0 ; 255] + const __m128i ampo_i = _mm_set1_epi16 (int16_t (_ampo_i)); // 8 ?16 [0 ; 255] + const __m128i ampn_i = _mm_set1_epi16 (int16_t (_ampn_i)); // 8 ?16 [0 ; 255] for (int pos = 0; pos < w; pos += 8) { @@ -1531,8 +1544,8 @@ void Bitdepth::process_seg_errdif_int_int_cpp (uint8_t *dst_ptr, const uint8_t * ERRDIF::prepare_next_line (err1_ptr - 1); } - ed_buf.use_mem (0) = err_nxt0; - ed_buf.use_mem (1) = err_nxt1; + ed_buf.use_mem (0) = int16_t (err_nxt0); + ed_buf.use_mem (1) = int16_t (err_nxt1); if (! S_FLAG) { @@ -1715,11 +1728,15 @@ void Bitdepth::quantize_pix_int (DST_TYPE *dst_ptr, const SRC_TYPE *src_ptr, SRC template static inline SRC_TYPE Bitdepth_extract_src (SRC_TYPE src_read, float src) { + fstb::unused (src); + return (src_read); } static inline float Bitdepth_extract_src (float src_read, float src) { + fstb::unused (src_read); + return (src); } @@ -1770,6 +1787,8 @@ template template void Bitdepth::DiffuseFloydSteinberg ::diffuse (int err, int &err_nxt0, int &err_nxt1, int16_t *err0_ptr, int16_t *err1_ptr, SRC_TYPE src_raw) { + fstb::unused (err_nxt1, err1_ptr, src_raw); + #if defined (fmtc_Bitdepth_FS_OPTIMIZED_SERPENTINE_COEF) const int e1 = 0; const int e3 = (err * 4 + 8) >> 4; @@ -1786,6 +1805,8 @@ template template void Bitdepth::DiffuseFloydSteinberg ::diffuse (float err, float &err_nxt0, float &err_nxt1, float *err0_ptr, float *err1_ptr, SRC_TYPE src_raw) { + fstb::unused (err_nxt1, err1_ptr, src_raw); + #if defined (fmtc_Bitdepth_FS_OPTIMIZED_SERPENTINE_COEF) const float e1 = 0; const float e3 = err * (4.0f / 16); @@ -1803,16 +1824,17 @@ template void Bitdepth::DiffuseFloydSteinberg ::prepare_next_line (EB *err_ptr) { // Nothing + fstb::unused (err_ptr); } template template void Bitdepth::DiffuseFloydSteinberg ::spread_error (ET e1, ET e3, ET e5, ET e7, ET &err_nxt0, EB *err0_ptr) { - err_nxt0 = err0_ptr [DIR]; - err0_ptr [-DIR] += e3; - err0_ptr [ 0] += e5; - err0_ptr [ DIR] = e1; + err_nxt0 = err0_ptr [DIR]; + err0_ptr [-DIR] += EB (e3); + err0_ptr [ 0] += EB (e5); + err0_ptr [ DIR] = EB (e1); err_nxt0 += e7; } @@ -1822,6 +1844,8 @@ template template void Bitdepth::DiffuseFilterLite ::diffuse (int err, int &err_nxt0, int &err_nxt1, int16_t *err0_ptr, int16_t *err1_ptr, SRC_TYPE src_raw) { + fstb::unused (err_nxt1, err1_ptr, src_raw); + const int e1 = (err + 2) >> 2; const int e2 = err - 2 * e1; spread_error (e1, e2, err_nxt0, err0_ptr); @@ -1831,6 +1855,8 @@ template template void Bitdepth::DiffuseFilterLite ::diffuse (float err, float &err_nxt0, float &err_nxt1, float *err0_ptr, float *err1_ptr, SRC_TYPE src_raw) { + fstb::unused (err_nxt1, err1_ptr, src_raw); + const float e1 = err * (1.0f / 4); const float e2 = err * (2.0f / 4); spread_error (e1, e2, err_nxt0, err0_ptr); @@ -1847,9 +1873,9 @@ template template void Bitdepth::DiffuseFilterLite ::spread_error (ET e1, ET e2, ET &err_nxt0, EB *err0_ptr) { - err_nxt0 = err0_ptr [DIR]; - err0_ptr [-DIR] += e1; - err0_ptr [ 0] = e1; + err_nxt0 = err0_ptr [DIR]; + err0_ptr [-DIR] += EB (e1); + err0_ptr [ 0] = EB (e1); err_nxt0 += e2; } @@ -1859,6 +1885,8 @@ template template void Bitdepth::DiffuseStucki ::diffuse (int err, int &err_nxt0, int &err_nxt1, int16_t *err0_ptr, int16_t *err1_ptr, SRC_TYPE src_raw) { + fstb::unused (src_raw); + const int m = (err << 4) / 42; const int e1 = (m + 8) >> 4; const int e2 = (m + 4) >> 3; @@ -1873,6 +1901,8 @@ template template void Bitdepth::DiffuseStucki ::diffuse (float err, float &err_nxt0, float &err_nxt1, float *err0_ptr, float *err1_ptr, SRC_TYPE src_raw) { + fstb::unused (src_raw); + const float e1 = err * (1.0f / 42); const float e2 = err * (2.0f / 42); const float e4 = err * (4.0f / 42); @@ -1885,24 +1915,25 @@ template void Bitdepth::DiffuseStucki ::prepare_next_line (EB *err_ptr) { // Nothing + fstb::unused (err_ptr); } template template void Bitdepth::DiffuseStucki ::spread_error (ET e1, ET e2, ET e4, ET e8, ET &err_nxt0, ET &err_nxt1, EB *err0_ptr, EB *err1_ptr) { - err_nxt0 = err_nxt1 + e8; - err_nxt1 = err1_ptr [DIR * 2] + e4; - err0_ptr [-DIR * 2] += e2; - err0_ptr [-DIR ] += e4; - err0_ptr [ 0 ] += e8; - err0_ptr [ DIR ] += e4; - err0_ptr [ DIR * 2] += e2; - err1_ptr [-DIR * 2] += e1; - err1_ptr [-DIR ] += e2; - err1_ptr [ 0 ] += e4; - err1_ptr [ DIR ] += e2; - err1_ptr [ DIR * 2] = e1; + err_nxt0 = err_nxt1 + e8; + err_nxt1 = err1_ptr [DIR * 2] + e4; + err0_ptr [-DIR * 2] += EB (e2); + err0_ptr [-DIR ] += EB (e4); + err0_ptr [ 0 ] += EB (e8); + err0_ptr [ DIR ] += EB (e4); + err0_ptr [ DIR * 2] += EB (e2); + err1_ptr [-DIR * 2] += EB (e1); + err1_ptr [-DIR ] += EB (e2); + err1_ptr [ 0 ] += EB (e4); + err1_ptr [ DIR ] += EB (e2); + err1_ptr [ DIR * 2] = EB (e1); } @@ -1911,6 +1942,8 @@ template template void Bitdepth::DiffuseAtkinson ::diffuse (int err, int &err_nxt0, int &err_nxt1, int16_t *err0_ptr, int16_t *err1_ptr, SRC_TYPE src_raw) { + fstb::unused (src_raw); + const int e1 = (err + 4) >> 3; spread_error (e1, err_nxt0, err_nxt1, err0_ptr, err1_ptr); } @@ -1919,6 +1952,8 @@ template template void Bitdepth::DiffuseAtkinson ::diffuse (float err, float &err_nxt0, float &err_nxt1, float *err0_ptr, float *err1_ptr, SRC_TYPE src_raw) { + fstb::unused (src_raw); + const float e1 = err * (1.0f / 8); spread_error (e1, err_nxt0, err_nxt1, err0_ptr, err1_ptr); } @@ -1934,12 +1969,12 @@ template template void Bitdepth::DiffuseAtkinson ::spread_error (ET e1, ET &err_nxt0, ET &err_nxt1, EB *err0_ptr, EB *err1_ptr) { - err_nxt0 = err_nxt1 + e1; - err_nxt1 = err1_ptr [2 * DIR] + e1; - err0_ptr [-DIR] += e1; - err0_ptr [ 0] += e1; - err0_ptr [+DIR] += e1; - err1_ptr [ 0] = e1; + err_nxt0 = err_nxt1 + e1; + err_nxt1 = err1_ptr [2 * DIR] + e1; + err0_ptr [-DIR] += EB (e1); + err0_ptr [ 0] += EB (e1); + err0_ptr [+DIR] += EB (e1); + err1_ptr [ 0] = EB (e1); } @@ -1953,6 +1988,8 @@ template template void Bitdepth::DiffuseOstromoukhov ::diffuse (int err, int &err_nxt0, int &err_nxt1, int16_t *err0_ptr, int16_t *err1_ptr, SRC_TYPE src_raw) { + fstb::unused (err_nxt1, err1_ptr); + enum { DIF_BITS = SRC_BITS - DST_BITS }; const int index = fstb::sshift_l < @@ -1993,6 +2030,8 @@ template template void Bitdepth::DiffuseOstromoukhov ::diffuse (float err, float &err_nxt0, float &err_nxt1, float *err0_ptr, float *err1_ptr, SRC_TYPE src_raw) { + fstb::unused (err_nxt1, err1_ptr); + const int index = DiffuseOstromoukhov::get_index (src_raw); const typename DiffuseOstromoukhov ::TableEntry & te = DiffuseOstromoukhov ::_table [index]; @@ -2016,9 +2055,9 @@ template template void Bitdepth::DiffuseOstromoukhov ::spread_error (ET e1, ET e2, ET e3, ET &err_nxt0, EB *err0_ptr) { - err_nxt0 = err0_ptr [DIR]; - err0_ptr [-DIR] += e2; - err0_ptr [ 0] = e3; + err_nxt0 = err0_ptr [DIR]; + err0_ptr [-DIR] += EB (e2); + err0_ptr [ 0] = EB (e3); err_nxt0 += e1; } diff --git a/src/fmtc/Convert.cpp b/src/fmtc/Convert.cpp index f109193..ee43bf1 100644 --- a/src/fmtc/Convert.cpp +++ b/src/fmtc/Convert.cpp @@ -32,6 +32,7 @@ To Public License, Version 2, as published by Sam Hocevar. See #include "fmtc/Matrix.h" #include "fmtc/Resample.h" #include "fmtc/version.h" +#include "fstb/def.h" #include "vsutl/fnc.h" #include @@ -66,6 +67,8 @@ Convert::Convert (const ::VSMap &in, ::VSMap &out, void *user_data_ptr, ::VSCore , _gcors (get_arg_flt (in, out, "gcors", 1)) , _gcord (get_arg_flt (in, out, "gcord", 1)) { + fstb::unused (user_data_ptr); + const ::VSFormat & fmt_src = *(_vi_in.format); retrieve_output_colorspace (in, out, core, fmt_src); const ::VSFormat & fmt_dst = *(_vi_out.format); @@ -124,6 +127,8 @@ Convert::Convert (const ::VSMap &in, ::VSMap &out, void *user_data_ptr, ::VSCore void Convert::init_filter (::VSMap &in, ::VSMap &out, ::VSNode &node, ::VSCore &core) { + fstb::unused (in, out, core); + _vsapi.setVideoInfo (&_vi_out, 1, &node); } @@ -131,6 +136,8 @@ void Convert::init_filter (::VSMap &in, ::VSMap &out, ::VSNode &node, ::VSCore & const ::VSFrameRef * Convert::get_frame (int n, int activation_reason, void * &frame_data_ptr, ::VSFrameContext &frame_ctx, ::VSCore &core) { + fstb::unused (frame_data_ptr, core); + assert (n >= 0); ::VSFrameRef * dst_ptr = 0; @@ -286,6 +293,8 @@ ConvStep::Range Convert::retrieve_range (const ::VSFormat &fmt, const ::VSMap &i fmtcl::TransCurve Convert::retrieve_tcurve (const ::VSFormat &fmt, const ::VSMap &in, ::VSMap &out, const char arg_0 [], const char def_0 []) { + fstb::unused (fmt); + fmtcl::TransCurve tcurve = fmtcl::TransCurve_UNDEF; bool curve_flag = false; @@ -365,6 +374,8 @@ fmtcl::TransCurve Convert::retrieve_tcurve (const ::VSFormat &fmt, const ::VSMap void Convert::find_conversion_steps (const ::VSMap &in, ::VSMap &out) { + fstb::unused (in, out); + _step_list.clear (); // - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/fmtc/Matrix.cpp b/src/fmtc/Matrix.cpp index 72409e7..2ec329d 100644 --- a/src/fmtc/Matrix.cpp +++ b/src/fmtc/Matrix.cpp @@ -29,10 +29,10 @@ To Public License, Version 2, as published by Sam Hocevar. See /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ -#include "fstb/def.h" #include "fmtc/Matrix.h" #include "fmtc/fnc.h" #include "fmtcl/Mat4.h" +#include "fstb/def.h" #include "fstb/fnc.h" #include "vsutl/CpuOpt.h" #include "vsutl/fnc.h" @@ -286,6 +286,8 @@ Matrix::Matrix (const ::VSMap &in, ::VSMap &out, void * /*user_data_ptr*/, ::VSC void Matrix::init_filter (::VSMap &in, ::VSMap &out, ::VSNode &node, ::VSCore &core) { + fstb::unused (in, out, core); + _vsapi.setVideoInfo (&_vi_out, 1, &node); } @@ -293,6 +295,8 @@ void Matrix::init_filter (::VSMap &in, ::VSMap &out, ::VSNode &node, ::VSCore &c const ::VSFrameRef * Matrix::get_frame (int n, int activation_reason, void * &frame_data_ptr, ::VSFrameContext &frame_ctx, ::VSCore &core) { + fstb::unused (frame_data_ptr); + assert (n >= 0); ::VSFrameRef * dst_ptr = 0; diff --git a/src/fmtc/Matrix2020CL.cpp b/src/fmtc/Matrix2020CL.cpp index e34c9b7..54c88d3 100644 --- a/src/fmtc/Matrix2020CL.cpp +++ b/src/fmtc/Matrix2020CL.cpp @@ -27,6 +27,7 @@ To Public License, Version 2, as published by Sam Hocevar. See #include "fmtcl/ColorSpaceH265.h" #include "fmtc/fnc.h" #include "fmtc/Matrix2020CL.h" +#include "fstb/def.h" #include "fstb/fnc.h" #include "vsutl/CpuOpt.h" #include "vsutl/fnc.h" @@ -57,6 +58,8 @@ Matrix2020CL::Matrix2020CL (const ::VSMap &in, ::VSMap &out, void *user_data_ptr , _to_yuv_flag (false) , _proc_uptr () { + fstb::unused (user_data_ptr); + vsutl::CpuOpt cpu_opt (*this, in, out); const bool sse2_flag = cpu_opt.has_sse2 (); const bool avx2_flag = cpu_opt.has_avx2 (); @@ -184,6 +187,8 @@ Matrix2020CL::Matrix2020CL (const ::VSMap &in, ::VSMap &out, void *user_data_ptr void Matrix2020CL::init_filter (::VSMap &in, ::VSMap &out, ::VSNode &node, ::VSCore &core) { + fstb::unused (in, out, core); + _vsapi.setVideoInfo (&_vi_out, 1, &node); } @@ -191,6 +196,8 @@ void Matrix2020CL::init_filter (::VSMap &in, ::VSMap &out, ::VSNode &node, ::VSC const ::VSFrameRef * Matrix2020CL::get_frame (int n, int activation_reason, void * &frame_data_ptr, ::VSFrameContext &frame_ctx, ::VSCore &core) { + fstb::unused (frame_data_ptr); + assert (n >= 0); ::VSFrameRef * dst_ptr = 0; diff --git a/src/fmtc/NativeToStack16.cpp b/src/fmtc/NativeToStack16.cpp index 2d1593d..2bbda29 100644 --- a/src/fmtc/NativeToStack16.cpp +++ b/src/fmtc/NativeToStack16.cpp @@ -25,6 +25,7 @@ To Public License, Version 2, as published by Sam Hocevar. See /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ #include "fmtc/NativeToStack16.h" +#include "fstb/def.h" #include "vsutl/FrameRefSPtr.h" #include @@ -49,6 +50,8 @@ NativeToStack16::NativeToStack16 (const ::VSMap &in, ::VSMap &out, void *user_da , _vi_in (*_vsapi.getVideoInfo (_clip_src_sptr.get ())) , _vi_out (_vi_in) { + fstb::unused (out, user_data_ptr); + // Checks the input clip if (_vi_in.format == 0) { @@ -80,6 +83,8 @@ NativeToStack16::NativeToStack16 (const ::VSMap &in, ::VSMap &out, void *user_da void NativeToStack16::init_filter (::VSMap &in, ::VSMap &out, ::VSNode &node, ::VSCore &core) { + fstb::unused (in, out, core); + _vsapi.setVideoInfo (&_vi_out, 1, &node); } @@ -87,6 +92,7 @@ void NativeToStack16::init_filter (::VSMap &in, ::VSMap &out, ::VSNode &node, :: const ::VSFrameRef * NativeToStack16::get_frame (int n, int activation_reason, void * &frame_data_ptr, ::VSFrameContext &frame_ctx, ::VSCore &core) { + fstb::unused (frame_data_ptr); assert (n >= 0); ::VSFrameRef * dst_ptr = 0; diff --git a/src/fmtc/Primaries.cpp b/src/fmtc/Primaries.cpp index 7834cb9..dd793bf 100644 --- a/src/fmtc/Primaries.cpp +++ b/src/fmtc/Primaries.cpp @@ -27,6 +27,7 @@ To Public License, Version 2, as published by Sam Hocevar. See #include "fmtc/fnc.h" #include "fmtc/Primaries.h" #include "fmtcl/Mat3.h" +#include "fstb/def.h" #include "fstb/fnc.h" #include "vsutl/CpuOpt.h" #include "vsutl/FrameRefSPtr.h" @@ -59,6 +60,8 @@ Primaries::Primaries (const ::VSMap &in, ::VSMap &out, void *user_data_ptr, ::VS , _mat_main () , _proc_uptr () { + fstb::unused (user_data_ptr, core); + vsutl::CpuOpt cpu_opt (*this, in, out); _sse_flag = cpu_opt.has_sse (); _sse2_flag = cpu_opt.has_sse2 (); @@ -119,6 +122,8 @@ Primaries::Primaries (const ::VSMap &in, ::VSMap &out, void *user_data_ptr, ::VS void Primaries::init_filter (::VSMap &in, ::VSMap &out, ::VSNode &node, ::VSCore &core) { + fstb::unused (in, out, core); + _vsapi.setVideoInfo (&_vi_out, 1, &node); } @@ -126,6 +131,7 @@ void Primaries::init_filter (::VSMap &in, ::VSMap &out, ::VSNode &node, ::VSCore const ::VSFrameRef * Primaries::get_frame (int n, int activation_reason, void * &frame_data_ptr, ::VSFrameContext &frame_ctx, ::VSCore &core) { + fstb::unused (frame_data_ptr); assert (n >= 0); ::VSFrameRef * dst_ptr = 0; @@ -213,7 +219,7 @@ void Primaries::RgbSystem::init (const vsutl::FilterBase &filter, const ::VSMap std::string preset_str = filter.get_arg_str (in, out, preset_0, ""); fstb::conv_to_lower_case (preset_str); - _preset = conv_string_to_primaries (preset_str, preset_0); + _preset = conv_string_to_primaries (preset_str); if (_preset >= 0) { set (_preset); @@ -439,10 +445,8 @@ fmtcl::Vec3 Primaries::conv_xy_to_xyz (const RgbSystem::Vec2 &xy) // str should be already converted to lower case -fmtcl::PrimariesPreset Primaries::conv_string_to_primaries (const std::string &str, const char *name_0) +fmtcl::PrimariesPreset Primaries::conv_string_to_primaries (const std::string &str) { - assert (name_0 != 0); - fmtcl::PrimariesPreset preset = fmtcl::PrimariesPreset_UNDEF; if ( str == "709" diff --git a/src/fmtc/Primaries.h b/src/fmtc/Primaries.h index 512e61a..5a3546b 100644 --- a/src/fmtc/Primaries.h +++ b/src/fmtc/Primaries.h @@ -91,7 +91,7 @@ class Primaries static fmtcl::Vec3 conv_xy_to_xyz (const RgbSystem::Vec2 &xy); static fmtcl::PrimariesPreset - conv_string_to_primaries (const std::string &preset, const char *name_0); + conv_string_to_primaries (const std::string &preset); vsutl::NodeRefSPtr _clip_src_sptr; diff --git a/src/fmtc/Resample.cpp b/src/fmtc/Resample.cpp index cc7421d..db7a62d 100644 --- a/src/fmtc/Resample.cpp +++ b/src/fmtc/Resample.cpp @@ -26,6 +26,7 @@ To Public License, Version 2, as published by Sam Hocevar. See #include "fmtc/Resample.h" #include "fmtc/SplFmtUtl.h" +#include "fstb/def.h" #include "vsutl/CpuOpt.h" #include "vsutl/fnc.h" #include "vsutl/FrameRefSPtr.h" @@ -85,11 +86,20 @@ Resample::Resample (const ::VSMap &in, ::VSMap &out, void *user_data_ptr, ::VSCo , _cplace_d (fmtcl::ChromaPlacement_MPEG2) , _sse2_flag (false) , _avx2_flag (false) +#if defined (_MSC_VER) +#pragma warning (push) +#pragma warning (disable : 4355) +#endif // 'this': used in base member initializer list , _plane_processor (vsapi, *this, "resample", true) +#if defined (_MSC_VER) +#pragma warning (pop) +#endif , _filter_mutex () , _filter_uptr_map () , _plane_data_arr () { + fstb::unused (user_data_ptr); + vsutl::CpuOpt cpu_opt (*this, in, out); _sse2_flag = cpu_opt.has_sse2 (); _avx2_flag = cpu_opt.has_avx2 (); @@ -427,6 +437,8 @@ Resample::Resample (const ::VSMap &in, ::VSMap &out, void *user_data_ptr, ::VSCo void Resample::init_filter (::VSMap &in, ::VSMap &out, ::VSNode &node, ::VSCore &core) { + fstb::unused (core); + _vsapi.setVideoInfo (&_vi_out, 1, &node); _plane_processor.set_filter (in, out, _vi_out); } @@ -594,6 +606,7 @@ void Resample::conv_str_to_chroma_subspl (const vsutl::FilterBase &flt, int &ssh int Resample::do_process_plane (::VSFrameRef &dst, int n, int plane_index, void *frame_data_ptr, ::VSFrameContext &frame_ctx, ::VSCore &core, const vsutl::NodeRefSPtr &src_node1_sptr, const vsutl::NodeRefSPtr &src_node2_sptr, const vsutl::NodeRefSPtr &src_node3_sptr) { + fstb::unused (src_node2_sptr, src_node3_sptr); assert (src_node1_sptr.get () != 0); assert (frame_data_ptr != 0); @@ -779,6 +792,8 @@ void Resample::get_interlacing_param (bool &itl_flag, bool &top_flag, int field_ int Resample::process_plane_proc (::VSFrameRef &dst, int n, int plane_index, void *frame_data_ptr, ::VSFrameContext &frame_ctx, ::VSCore &core, const vsutl::NodeRefSPtr &src_node1_sptr) { + fstb::unused (core); + int ret_val = 0; vsutl::FrameRefSPtr src_sptr ( @@ -837,6 +852,8 @@ int Resample::process_plane_proc (::VSFrameRef &dst, int n, int plane_index, voi int Resample::process_plane_copy (::VSFrameRef &dst, int n, int plane_index, void *frame_data_ptr, ::VSFrameContext &frame_ctx, ::VSCore &core, const vsutl::NodeRefSPtr &src_node1_sptr) { + fstb::unused (frame_data_ptr, core); + int ret_val = 0; vsutl::FrameRefSPtr src_sptr ( diff --git a/src/fmtc/Stack16ToNative.cpp b/src/fmtc/Stack16ToNative.cpp index 338f817..f46e76f 100644 --- a/src/fmtc/Stack16ToNative.cpp +++ b/src/fmtc/Stack16ToNative.cpp @@ -25,6 +25,7 @@ To Public License, Version 2, as published by Sam Hocevar. See /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ #include "fmtc/Stack16ToNative.h" +#include "fstb/def.h" #include "vsutl/FrameRefSPtr.h" #include @@ -49,6 +50,8 @@ Stack16ToNative::Stack16ToNative (const ::VSMap &in, ::VSMap &out, void *user_da , _vi_in (*_vsapi.getVideoInfo (_clip_src_sptr.get ())) , _vi_out (_vi_in) { + fstb::unused (out, user_data_ptr); + // Checks the input clip if (_vi_in.format == 0) { @@ -87,6 +90,8 @@ Stack16ToNative::Stack16ToNative (const ::VSMap &in, ::VSMap &out, void *user_da void Stack16ToNative::init_filter (::VSMap &in, ::VSMap &out, ::VSNode &node, ::VSCore &core) { + fstb::unused (in, out, core); + _vsapi.setVideoInfo (&_vi_out, 1, &node); } @@ -94,6 +99,7 @@ void Stack16ToNative::init_filter (::VSMap &in, ::VSMap &out, ::VSNode &node, :: const ::VSFrameRef * Stack16ToNative::get_frame (int n, int activation_reason, void * &frame_data_ptr, ::VSFrameContext &frame_ctx, ::VSCore &core) { + fstb::unused (frame_data_ptr); assert (n >= 0); ::VSFrameRef * dst_ptr = 0; diff --git a/src/fmtc/Transfer.cpp b/src/fmtc/Transfer.cpp index 933cd0e..8dc5b8d 100644 --- a/src/fmtc/Transfer.cpp +++ b/src/fmtc/Transfer.cpp @@ -81,7 +81,14 @@ Transfer::Transfer (const ::VSMap &in, ::VSMap &out, void * /*user_data_ptr*/, : , _curve_s (fmtcl::TransCurve_UNDEF) , _curve_d (fmtcl::TransCurve_UNDEF) , _loglut_flag (false) +#if defined (_MSC_VER) +#pragma warning (push) +#pragma warning (disable : 4355) +#endif // 'this': used in base member initializer list , _plane_processor (vsapi, *this, "transfer", true) +#if defined (_MSC_VER) +#pragma warning (pop) +#endif , _lut_uptr () { fstb::conv_to_lower_case (_transs); @@ -135,6 +142,8 @@ Transfer::Transfer (const ::VSMap &in, ::VSMap &out, void * /*user_data_ptr*/, : void Transfer::init_filter (::VSMap &in, ::VSMap &out, ::VSNode &node, ::VSCore &core) { + fstb::unused (core); + _vsapi.setVideoInfo (&_vi_out, 1, &node); _plane_processor.set_filter (in, out, _vi_out); } @@ -203,6 +212,7 @@ const ::VSFrameRef * Transfer::get_frame (int n, int activation_reason, void * & int Transfer::do_process_plane (::VSFrameRef &dst, int n, int plane_index, void *frame_data_ptr, ::VSFrameContext &frame_ctx, ::VSCore &core, const vsutl::NodeRefSPtr &src_node1_sptr, const vsutl::NodeRefSPtr &src_node2_sptr, const vsutl::NodeRefSPtr &src_node3_sptr) { + fstb::unused (frame_data_ptr, core, src_node2_sptr, src_node3_sptr); assert (src_node1_sptr.get () != 0); int ret_val = 0; diff --git a/src/fmtcl/ArrayMultiType.hpp b/src/fmtcl/ArrayMultiType.hpp index 209b09a..07c745a 100644 --- a/src/fmtcl/ArrayMultiType.hpp +++ b/src/fmtcl/ArrayMultiType.hpp @@ -56,7 +56,7 @@ T & ArrayMultiType::use (int pos) assert (pos >= 0); assert (pos < int (_length)); - return ((reinterpret_cast < T *> (&_arr [0])) [pos]); + return (reinterpret_cast < T *> (&_arr [0])) [pos]; } @@ -67,9 +67,9 @@ const T & ArrayMultiType::use (int pos) const assert (_data_len > 0); assert (sizeof (T) == _data_len); assert (pos >= 0); - assert (pos < _length); + assert (pos < int (_length)); - return ((reinterpret_cast (&_arr [0])) [pos]); + return (reinterpret_cast (&_arr [0])) [pos]; } @@ -78,8 +78,8 @@ size_t ArrayMultiType::get_size () const { assert (_data_len >= 0); - return (_length); -}; + return _length; +} diff --git a/src/fmtcl/BitBltConv.cpp b/src/fmtcl/BitBltConv.cpp index 55b7e7c..6abd934 100644 --- a/src/fmtcl/BitBltConv.cpp +++ b/src/fmtcl/BitBltConv.cpp @@ -255,6 +255,8 @@ void BitBltConv::bitblt_int_to_flt (uint8_t *dst_ptr, int dst_stride, fmtcl::Spl void BitBltConv::bitblt_flt_to_int (fmtcl::SplFmt dst_fmt, int dst_res, uint8_t *dst_ptr, uint8_t *dst_lsb_ptr, int dst_stride, const uint8_t *src_ptr, int src_stride, int w, int h, const ScaleInfo *scale_info_ptr) { + fstb::unused (dst_res); + const Proxy::PtrStack16::Type dst_s16_ptr (dst_ptr, dst_lsb_ptr); const Proxy::PtrInt16::Type dst_i16_ptr ( reinterpret_cast (dst_ptr) @@ -299,6 +301,8 @@ void BitBltConv::bitblt_flt_to_int (fmtcl::SplFmt dst_fmt, int dst_res, uint8_t void BitBltConv::bitblt_int_to_int (fmtcl::SplFmt dst_fmt, int dst_res, uint8_t *dst_ptr, uint8_t *dst_lsb_ptr, int dst_stride, fmtcl::SplFmt src_fmt, int src_res, const uint8_t *src_ptr, const uint8_t *src_lsb_ptr, int src_stride, int w, int h, const ScaleInfo *scale_info_ptr) { + fstb::unused (scale_info_ptr); + const uint8_t * src_i08_ptr (src_ptr); const Proxy::PtrStack16Const::Type src_s16_ptr (src_ptr, src_lsb_ptr); const Proxy::PtrInt16Const::Type src_i16_ptr ( diff --git a/src/fmtcl/BitBltConv_avx2.cpp b/src/fmtcl/BitBltConv_avx2.cpp index 41f97bc..570a690 100644 --- a/src/fmtcl/BitBltConv_avx2.cpp +++ b/src/fmtcl/BitBltConv_avx2.cpp @@ -102,6 +102,8 @@ void BitBltConv::bitblt_int_to_flt_avx2_switch (uint8_t *dst_ptr, int dst_stride void BitBltConv::bitblt_flt_to_int_avx2_switch (fmtcl::SplFmt dst_fmt, int dst_res, uint8_t *dst_ptr, uint8_t *dst_lsb_ptr, int dst_stride, const uint8_t *src_ptr, int src_stride, int w, int h, const ScaleInfo *scale_info_ptr) { + fstb::unused (dst_res); + const Proxy::PtrStack16::Type dst_s16_ptr (dst_ptr, dst_lsb_ptr); const Proxy::PtrInt16::Type dst_i16_ptr ( reinterpret_cast (dst_ptr) @@ -138,6 +140,8 @@ void BitBltConv::bitblt_flt_to_int_avx2_switch (fmtcl::SplFmt dst_fmt, int dst_r void BitBltConv::bitblt_int_to_int_avx2_switch (fmtcl::SplFmt dst_fmt, int dst_res, uint8_t *dst_ptr, uint8_t *dst_lsb_ptr, int dst_stride, fmtcl::SplFmt src_fmt, int src_res, const uint8_t *src_ptr, const uint8_t *src_lsb_ptr, int src_stride, int w, int h, const ScaleInfo *scale_info_ptr) { + fstb::unused (scale_info_ptr); + const uint8_t * src_i08_ptr (src_ptr); const Proxy::PtrStack16Const::Type src_s16_ptr (src_ptr, src_lsb_ptr); const Proxy::PtrInt16Const::Type src_i16_ptr ( diff --git a/src/fmtcl/ContFirSnh.cpp b/src/fmtcl/ContFirSnh.cpp index ec85fe6..e5a76b1 100644 --- a/src/fmtcl/ContFirSnh.cpp +++ b/src/fmtcl/ContFirSnh.cpp @@ -24,6 +24,7 @@ To Public License, Version 2, as published by Sam Hocevar. See /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ +#include "fstb/def.h" #include "fmtcl/ContFirSnh.h" @@ -50,6 +51,8 @@ double ContFirSnh::do_get_support () const double ContFirSnh::do_get_val (double pos) const { + fstb::unused (pos); + return (1); } diff --git a/src/fmtcl/ContFirSpline.cpp b/src/fmtcl/ContFirSpline.cpp index 75c497a..fd95f04 100644 --- a/src/fmtcl/ContFirSpline.cpp +++ b/src/fmtcl/ContFirSpline.cpp @@ -3,6 +3,7 @@ ContFirSpline.cpp Author: Laurent de Soras, 2012 +Natural cubic splines Coefficient calculation taken from SplineResize 0.2 by Wilbert Dijkhof --- Legal stuff --- diff --git a/src/fmtcl/FilterResize.cpp b/src/fmtcl/FilterResize.cpp index f2236ca..e79dde1 100644 --- a/src/fmtcl/FilterResize.cpp +++ b/src/fmtcl/FilterResize.cpp @@ -470,6 +470,8 @@ void FilterResize::process_plane (uint8_t *dst_msb_ptr, uint8_t *dst_lsb_ptr, co void FilterResize::process_plane_bypass (uint8_t *dst_msb_ptr, uint8_t *dst_lsb_ptr, const uint8_t *src_msb_ptr, const uint8_t *src_lsb_ptr, int stride_dst, int stride_src, bool chroma_flag) { + fstb::unused (chroma_flag); + assert (_nbr_passes <= 0); assert (dst_msb_ptr != 0); assert (src_msb_ptr != 0); @@ -1366,6 +1368,8 @@ void FilterResize::compute_req_src_tile_size (int &tw, int &th, int dw, int dh) void FilterResize::redirect_task_resize (avstp_TaskDispatcher *dispatcher_ptr, void *data_ptr) { + fstb::unused (dispatcher_ptr); + TaskRszCell * trc_ptr = reinterpret_cast (data_ptr); FilterResize * this_ptr = trc_ptr->_val._glob_data_ptr->_this_ptr; diff --git a/src/fmtcl/KernelData.cpp b/src/fmtcl/KernelData.cpp index 6db3f84..bdeb7da 100644 --- a/src/fmtcl/KernelData.cpp +++ b/src/fmtcl/KernelData.cpp @@ -41,6 +41,7 @@ To Public License, Version 2, as published by Sam Hocevar. See #include "fmtcl/ContFirSpline36.h" #include "fmtcl/ContFirSpline64.h" #include "fmtcl/DiscreteFirCustom.h" +#include "fstb/def.h" #include "fstb/fnc.h" #include @@ -92,6 +93,8 @@ void KernelData::create_kernel (std::string kernel_fnc, std::vector &co void KernelData::create_kernel_base (std::string kernel_fnc, std::vector &coef_arr, int taps, bool a1_flag, double a1, bool a2_flag, double a2, bool a3_flag, double a3, int kovrspl) { + fstb::unused (a3, a3_flag); + fstb::conv_to_lower_case (kernel_fnc); const std::string::size_type name_end = kernel_fnc.find (' '); const std::string name = kernel_fnc.substr (0, name_end); diff --git a/src/fmtcl/Matrix2020CLProc.cpp b/src/fmtcl/Matrix2020CLProc.cpp index c262267..aa70589 100644 --- a/src/fmtcl/Matrix2020CLProc.cpp +++ b/src/fmtcl/Matrix2020CLProc.cpp @@ -264,13 +264,13 @@ Matrix2020CLProc::Err Matrix2020CLProc::setup_rgb_2_ycbcr () const double coef_a_cr0 = coef_a_c / _coef_cr_pos; const double coef_a_cr1 = coef_a_c / _coef_cr_neg; const double coef_b_c = ofs_grey + cst_r; - _coef_yg_a_int = fstb::round_int (coef_a_y ); - _coef_yg_b_int = fstb::round_int (coef_b_y ); - _coef_cb_a_int [0] = fstb::round_int (coef_a_cb0); - _coef_cb_a_int [1] = fstb::round_int (coef_a_cb1); - _coef_cr_a_int [0] = fstb::round_int (coef_a_cr0); - _coef_cr_a_int [1] = fstb::round_int (coef_a_cr1); - _coef_cbcr_b_int = fstb::round_int (coef_b_c ); + _coef_yg_a_int = uint16_t (fstb::round_int (coef_a_y )); + _coef_yg_b_int = int32_t ( fstb::round_int (coef_b_y )); + _coef_cb_a_int [0] = uint16_t (fstb::round_int (coef_a_cb0)); + _coef_cb_a_int [1] = uint16_t (fstb::round_int (coef_a_cb1)); + _coef_cr_a_int [0] = uint16_t (fstb::round_int (coef_a_cr0)); + _coef_cr_a_int [1] = uint16_t (fstb::round_int (coef_a_cr1)); + _coef_cbcr_b_int = int32_t ( fstb::round_int (coef_b_c )); } return (ret_val); @@ -379,13 +379,13 @@ Matrix2020CLProc::Err Matrix2020CLProc::setup_ycbcr_2_rgb () const double coef_a_cr0 = coef_a_c * _coef_cr_pos; const double coef_a_cr1 = coef_a_c * _coef_cr_neg; const double coef_b_c = cst_r; - _coef_yg_a_int = fstb::round_int (coef_a_y ); - _coef_yg_b_int = fstb::round_int (coef_b_y ); - _coef_cb_a_int [0] = fstb::round_int (coef_a_cb0); - _coef_cb_a_int [1] = fstb::round_int (coef_a_cb1); - _coef_cr_a_int [0] = fstb::round_int (coef_a_cr0); - _coef_cr_a_int [1] = fstb::round_int (coef_a_cr1); - _coef_cbcr_b_int = fstb::round_int (coef_b_c ); + _coef_yg_a_int = uint16_t (fstb::round_int (coef_a_y )); + _coef_yg_b_int = int32_t ( fstb::round_int (coef_b_y )); + _coef_cb_a_int [0] = uint16_t (fstb::round_int (coef_a_cb0)); + _coef_cb_a_int [1] = uint16_t (fstb::round_int (coef_a_cb1)); + _coef_cr_a_int [0] = uint16_t (fstb::round_int (coef_a_cr0)); + _coef_cr_a_int [1] = uint16_t (fstb::round_int (coef_a_cr1)); + _coef_cbcr_b_int = int32_t ( fstb::round_int (coef_b_c )); } return (ret_val); diff --git a/src/fmtcl/MatrixProc.cpp b/src/fmtcl/MatrixProc.cpp index 630ce38..fe616b1 100644 --- a/src/fmtcl/MatrixProc.cpp +++ b/src/fmtcl/MatrixProc.cpp @@ -367,6 +367,8 @@ MatrixProc::Err MatrixProc::set_matrix_int (const Mat4 &m, int plane_out, int sr void MatrixProc::setup_fnc_sse (bool int_proc_flag, SplFmt src_fmt, int src_bits, SplFmt dst_fmt, int dst_bits, bool single_plane_flag) { + fstb::unused (src_fmt, src_bits, dst_fmt, dst_bits); + if (! int_proc_flag) { if (single_plane_flag) @@ -727,7 +729,7 @@ void MatrixProc::process_n_int_sse2 (uint8_t * const dst_ptr_arr [NBR_PLANES], c const __m128i zero = _mm_setzero_si128 (); const __m128i mask_lsb = _mm_set1_epi16 (0x00FF); const __m128i sign_bit = _mm_set1_epi16 (-0x8000); - const __m128i ma = _mm_set1_epi16 (int16_t ((1 << DB) - 1)); + const __m128i ma = _mm_set1_epi16 (int16_t (uint16_t ((1 << DB) - 1))); const __m128i* coef_ptr = reinterpret_cast ( _coef_simd_arr.use_vect_sse2 (0) diff --git a/src/fmtcl/MatrixProc_avx.cpp b/src/fmtcl/MatrixProc_avx.cpp index e3294cf..fb81745 100644 --- a/src/fmtcl/MatrixProc_avx.cpp +++ b/src/fmtcl/MatrixProc_avx.cpp @@ -28,6 +28,7 @@ To Public License, Version 2, as published by Sam Hocevar. See /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ #include "fmtcl/MatrixProc.h" +#include "fstb/def.h" #include @@ -52,6 +53,8 @@ namespace fmtcl void MatrixProc::setup_fnc_avx (bool int_proc_flag, SplFmt src_fmt, int src_bits, SplFmt dst_fmt, int dst_bits, bool single_plane_flag) { + fstb::unused (src_fmt, src_bits, dst_fmt, dst_bits); + if (! int_proc_flag) { if (single_plane_flag) diff --git a/src/fmtcl/MatrixProc_avx2.cpp b/src/fmtcl/MatrixProc_avx2.cpp index c590b2b..40a604a 100644 --- a/src/fmtcl/MatrixProc_avx2.cpp +++ b/src/fmtcl/MatrixProc_avx2.cpp @@ -120,7 +120,7 @@ void MatrixProc::process_n_int_avx2 (uint8_t * const dst_ptr_arr [NBR_PLANES], c const __m256i zero = _mm256_setzero_si256 (); const __m256i mask_lsb = _mm256_set1_epi16 (0x00FF); const __m256i sign_bit = _mm256_set1_epi16 (-0x8000); - const __m256i ma = _mm256_set1_epi16 (int16_t ((1 << DB) - 1)); + const __m256i ma = _mm256_set1_epi16 (int16_t (uint16_t ((1 << DB) - 1))); const __m256i* coef_ptr = reinterpret_cast ( _coef_simd_arr.use_vect_avx2 (0) diff --git a/src/fmtcl/ProxyRwAvx2.hpp b/src/fmtcl/ProxyRwAvx2.hpp index df1bbdb..70d3ee5 100644 --- a/src/fmtcl/ProxyRwAvx2.hpp +++ b/src/fmtcl/ProxyRwAvx2.hpp @@ -22,6 +22,7 @@ To Public License, Version 2, as published by Sam Hocevar. See /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ +#include "fstb/def.h" #include "fstb/ToolsAvx2.h" @@ -155,6 +156,8 @@ void ProxyRwAvx2 ::write_i16_partial (const Ptr::Type &ptr, const _ template __m256i ProxyRwAvx2 ::S16 ::read (const PtrConst::Type &ptr, const __m256i &zero, const __m256i &sign_bit) { + fstb::unused (zero, sign_bit); + return (fstb::ToolsAvx2::load_16_16l (ptr)); } @@ -162,6 +165,8 @@ __m256i ProxyRwAvx2 ::S16 ::read (const PtrCo template __m256i ProxyRwAvx2 ::S16 ::read_partial (const PtrConst::Type &ptr, const __m256i &zero, const __m256i &sign_bit, int len) { + fstb::unused (zero, sign_bit); + return (fstb::ToolsAvx2::load_16_16l_partial (ptr, len)); } diff --git a/src/fmtcl/ProxyRwSse2.hpp b/src/fmtcl/ProxyRwSse2.hpp index 1de03a6..b55e3ee 100644 --- a/src/fmtcl/ProxyRwSse2.hpp +++ b/src/fmtcl/ProxyRwSse2.hpp @@ -22,6 +22,7 @@ To Public License, Version 2, as published by Sam Hocevar. See /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ +#include "fstb/def.h" #include "fstb/ToolsSse2.h" @@ -145,6 +146,8 @@ void ProxyRwSse2 ::write_i16_partial (const Ptr::Type &ptr, const _ template __m128i ProxyRwSse2 ::S16 ::read (const PtrConst::Type &ptr, const __m128i &zero, const __m128i &sign_bit) { + fstb::unused (sign_bit); + return (fstb::ToolsSse2::load_8_16l (ptr, zero)); } @@ -152,6 +155,8 @@ __m128i ProxyRwSse2 ::S16 ::read (const PtrCo template __m128i ProxyRwSse2 ::S16 ::read_partial (const PtrConst::Type &ptr, const __m128i &zero, const __m128i &sign_bit, int len) { + fstb::unused (sign_bit); + return (fstb::ToolsSse2::load_8_16l_partial (ptr, zero, len)); } diff --git a/src/fmtcl/Scaler.cpp b/src/fmtcl/Scaler.cpp index 1a5b7f9..87b1a37 100644 --- a/src/fmtcl/Scaler.cpp +++ b/src/fmtcl/Scaler.cpp @@ -688,7 +688,7 @@ void Scaler::process_plane_int_sse2 (typename DST::Ptr::Type dst_ptr, typename S const __m128i zero = _mm_setzero_si128 (); const __m128i mask_lsb = _mm_set1_epi16 (0x00FF); const __m128i sign_bit = _mm_set1_epi16 (-0x8000); - const __m128i ma = _mm_set1_epi16 (int16_t ((1 << DB) - 1)); + const __m128i ma = _mm_set1_epi16 (int16_t (uint16_t ((1 << DB) - 1))); #if defined (fmtcl_Scaler_SSE2_16BITS) const __m128i add_cst = _mm_set1_epi16 (_add_cst_int + s_cst ); #else @@ -965,6 +965,7 @@ void Scaler::push_back_int_coef (double coef) Scaler::BasicInfo::BasicInfo (int src_height, int dst_height, double win_top, double win_height, ContFirInterface &kernel_fnc, double kernel_scale, double center_pos_src, double center_pos_dst) { + fstb::unused (src_height); assert (src_height > 0); assert (dst_height > 0); assert (win_height > 0); diff --git a/src/fmtcl/ScalerCopy.h b/src/fmtcl/ScalerCopy.h index e0c2311..40ecfe1 100644 --- a/src/fmtcl/ScalerCopy.h +++ b/src/fmtcl/ScalerCopy.h @@ -42,10 +42,12 @@ class ScalerCopy public: static fstb_FORCEINLINE bool can_copy (bool copy_flag) { + fstb::unused (copy_flag); return (false); } static fstb_FORCEINLINE void copy (typename DST::Ptr::Type dst_ptr, typename SRC::PtrConst::Type src_ptr, int width) { + fstb::unused (dst_ptr, src_ptr, width); assert (false); } }; diff --git a/src/fmtcl/Scaler_avx2.cpp b/src/fmtcl/Scaler_avx2.cpp index c291026..3371fb4 100644 --- a/src/fmtcl/Scaler_avx2.cpp +++ b/src/fmtcl/Scaler_avx2.cpp @@ -254,7 +254,7 @@ void Scaler::process_plane_int_avx2 (typename DST::Ptr::Type dst_ptr, typename S const __m256i zero = _mm256_setzero_si256 (); const __m256i mask_lsb = _mm256_set1_epi16 (0x00FF); const __m256i sign_bit = _mm256_set1_epi16 (-0x8000); - const __m256i ma = _mm256_set1_epi16 (int16_t ((1 << DB) - 1)); + const __m256i ma = _mm256_set1_epi16 (int16_t (uint16_t ((1 << DB) - 1))); const __m256i add_cst = _mm256_set1_epi32 (_add_cst_int + s_cst + r_cst); const int w16 = width & -16; diff --git a/src/fmtcl/VoidAndCluster.cpp b/src/fmtcl/VoidAndCluster.cpp index 1b4e1d7..c510b97 100644 --- a/src/fmtcl/VoidAndCluster.cpp +++ b/src/fmtcl/VoidAndCluster.cpp @@ -65,7 +65,7 @@ void VoidAndCluster::create_matrix (MatrixWrap &vnc) const int x = c_arr [0].first; const int y = c_arr [0].second; mat (x, y) = 0; - vnc (x, y) = rank; + vnc (x, y) = uint16_t (rank); } } @@ -79,7 +79,7 @@ void VoidAndCluster::create_matrix (MatrixWrap &vnc) const int x = v_arr [0].first; const int y = v_arr [0].second; mat (x, y) = 1; - vnc (x, y) = rank; + vnc (x, y) = uint16_t (rank); ++ rank; } } @@ -217,7 +217,7 @@ void VoidAndCluster::generate_initial_mat (MatrixWrap &m) const double val = thr + err; const int qnt = fstb::round_int (val); assert (qnt >= 0 && qnt <= 1); - m (x, y) = qnt; + m (x, y) = uint16_t (qnt); err = val - double (qnt); // Filter-Lite error diffusion const double e2 = err * 0.5; diff --git a/src/fstb/AllocAlign.h b/src/fstb/AllocAlign.h index 23ffe83..ce54cfe 100644 --- a/src/fstb/AllocAlign.h +++ b/src/fstb/AllocAlign.h @@ -46,7 +46,7 @@ class AllocAlign public: - enum { ALIGNMENT = ALIG }; + static const long ALIGNMENT = ALIG; typedef T value_type; typedef value_type * pointer; @@ -59,7 +59,7 @@ class AllocAlign AllocAlign () = default; AllocAlign (AllocAlign const &other) = default; template - AllocAlign (AllocAlign const &other) {} + AllocAlign (AllocAlign const &/*other*/) {} ~AllocAlign () = default; // Address diff --git a/src/fstb/AllocAlign.hpp b/src/fstb/AllocAlign.hpp index cb03e33..67538e9 100644 --- a/src/fstb/AllocAlign.hpp +++ b/src/fstb/AllocAlign.hpp @@ -173,6 +173,8 @@ void AllocAlign ::destroy (pointer ptr) template bool AllocAlign ::operator == (AllocAlign const &other) { + fstb::unused (other); + return (true); } diff --git a/src/fstb/ArrayAlign.hpp b/src/fstb/ArrayAlign.hpp index 28abf26..350f455 100644 --- a/src/fstb/ArrayAlign.hpp +++ b/src/fstb/ArrayAlign.hpp @@ -22,6 +22,8 @@ To Public License, Version 2, as published by Sam Hocevar. See /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ +#include "fstb/def.h" + #include #include @@ -55,6 +57,7 @@ class DestroyAux destroy_elt (T *ptr) { // Nothing + fstb::unused (ptr); } }; diff --git a/src/fstb/CpuId.cpp b/src/fstb/CpuId.cpp index 11bfb9a..8e0de55 100644 --- a/src/fstb/CpuId.cpp +++ b/src/fstb/CpuId.cpp @@ -25,9 +25,14 @@ To Public License, Version 2, as published by Sam Hocevar. See /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ #include "fstb/CpuId.h" +#include "fstb/def.h" -#if defined (_MSC_VER) - #include +#if (fstb_ARCHI == fstb_ARCHI_X86) + #if defined (__GNUC__) + #include + #elif defined (_MSC_VER) + #include + #endif #endif #include @@ -43,6 +48,7 @@ namespace fstb +// https://en.wikipedia.org/wiki/CPUID CpuId::CpuId () { #if (fstb_ARCHI == fstb_ARCHI_X86) @@ -52,8 +58,12 @@ CpuId::CpuId () unsigned int ecx; unsigned int edx; - // Basic features - call_cpuid (0x00000001, eax, ebx, ecx, edx); + // Highest function available + call_cpuid (0x00000000, 0, eax, ebx, ecx, edx); + const unsigned int hf_basic = eax; + + // Processor Info and Feature Bits + call_cpuid (0x00000001, 0, eax, ebx, ecx, edx); _mmx_flag = ((edx & (1L << 23)) != 0); _sse_flag = ((edx & (1L << 25)) != 0); @@ -67,15 +77,20 @@ CpuId::CpuId () _avx_flag = ((ecx & (1L << 28)) != 0); _f16c_flag = ((ecx & (1L << 29)) != 0); - call_cpuid (0x00000007, eax, ebx, ecx, edx); - _avx2_flag = ((ebx & (1L << 5)) != 0); - _avx512f_flag = ((ebx & (1L << 16)) != 0); + if (hf_basic >= 0x00000007) + { + // Extended Features + call_cpuid (0x00000007, 0, eax, ebx, ecx, edx); + _avx2_flag = ((ebx & (1L << 5)) != 0); + _avx512f_flag = ((ebx & (1L << 16)) != 0); + } - // Extended features - call_cpuid (0x80000000, eax, ebx, ecx, edx); - if (eax >= 0x80000001) + // Extended Processor Info and Feature Bits + call_cpuid (0x80000000, 0, eax, ebx, ecx, edx); + const unsigned int hf_ext = eax; + if (hf_ext >= 0x80000001) { - call_cpuid (0x80000001, eax, ebx, ecx, edx); + call_cpuid (0x80000001, 0, eax, ebx, ecx, edx); _isse_flag = ((edx & (1L << 22)) != 0) || _sse_flag; _sse4a_flag = ((ecx & (1L << 6)) != 0); _fma4_flag = ((ecx & (1L << 16)) != 0); @@ -88,48 +103,21 @@ CpuId::CpuId () #if (fstb_ARCHI == fstb_ARCHI_X86) -void CpuId::call_cpuid (unsigned int fnc_nbr, unsigned int &v_eax, unsigned int &v_ebx, unsigned int &v_ecx, unsigned int &v_edx) +void CpuId::call_cpuid (unsigned int fnc_nbr, unsigned int subfnc_nbr, unsigned int &v_eax, unsigned int &v_ebx, unsigned int &v_ecx, unsigned int &v_edx) { #if defined (__GNUC__) - long r_eax; - long r_ebx; - long r_ecx; - long r_edx; - #if defined (__x86_64__) - - __asm__ ( - "push %%rbx \n\t" /* save %rbx */ - "cpuid \n\t" - "mov %%rbx, %1 \n\t" /* save what cpuid just put in %rbx */ - "pop %%rbx \n\t" /* restore the old %rbx */ - : "=a"(r_eax), "=r"(r_ebx), "=c"(r_ecx), "=d"(r_edx) - : "a"(fnc_nbr) - : "cc"); - + __cpuid_count (fnc_nbr, subfnc_nbr, v_eax, v_ebx, v_ecx, v_edx); #else - - __asm__ ( - "pushl %%ebx \n\t" /* save %ebx */ - "cpuid \n\t" - "movl %%ebx, %1 \n\t" /* save what cpuid just put in %ebx */ - "popl %%ebx \n\t" /* restore the old %ebx */ - : "=a"(r_eax), "=r"(r_ebx), "=c"(r_ecx), "=d"(r_edx) - : "a"(fnc_nbr) - : "cc"); - + fstb::unused (subfnc_nbr); + __cpuid (fnc_nbr, v_eax, v_ebx, v_ecx, v_edx); #endif - v_eax = r_eax; - v_ebx = r_ebx; - v_ecx = r_ecx; - v_edx = r_edx; - #elif (_MSC_VER) int cpu_info [4]; - __cpuid (cpu_info, fnc_nbr); + __cpuidex (cpu_info, fnc_nbr, subfnc_nbr); v_eax = cpu_info [0]; v_ebx = cpu_info [1]; v_ecx = cpu_info [2]; diff --git a/src/fstb/CpuId.h b/src/fstb/CpuId.h index 2f6a9c7..1150591 100644 --- a/src/fstb/CpuId.h +++ b/src/fstb/CpuId.h @@ -50,7 +50,7 @@ class CpuId CpuId & operator = (const CpuId &other) = default; #if (fstb_ARCHI == fstb_ARCHI_X86) - static void call_cpuid (unsigned int fnc_nbr, unsigned int &v_eax, unsigned int &v_ebx, unsigned int &v_ecx, unsigned int &v_edx); + static void call_cpuid (unsigned int fnc_nbr, unsigned int subfnc_nbr, unsigned int &v_eax, unsigned int &v_ebx, unsigned int &v_ecx, unsigned int &v_edx); #endif bool _mmx_flag = false; diff --git a/src/fstb/ToolsSse2.cpp b/src/fstb/ToolsSse2.cpp index dec8840..3c3d5df 100644 --- a/src/fstb/ToolsSse2.cpp +++ b/src/fstb/ToolsSse2.cpp @@ -1,7 +1,15 @@ /***************************************************************************** ToolsSse2.cpp - Copyright (c) 2013 Ohm Force + Author: Laurent de Soras, 2016 + +--- Legal stuff --- + +This program is free software. It comes without any warranty, to +the extent permitted by applicable law. You can redistribute it +and/or modify it under the terms of the Do What The Fuck You Want +To Public License, Version 2, as published by Sam Hocevar. See +http://sam.zoy.org/wtfpl/COPYING for more details. *Tab=3***********************************************************************/ diff --git a/src/fstb/def.h b/src/fstb/def.h index e36a34c..61250e7 100644 --- a/src/fstb/def.h +++ b/src/fstb/def.h @@ -34,12 +34,14 @@ namespace fstb -#define fstb_ARCHI_X86 1 -#define fstb_ARCHI_ARM 2 +#define fstb_IS(prop, val) (defined (fstb_##prop##_##val) && (fstb_##prop) == (fstb_##prop##_##val)) + +#define fstb_ARCHI_X86 (1) +#define fstb_ARCHI_ARM (2) #if defined (__i386__) || defined (_M_IX86) || defined (_X86_) || defined (_M_X64) || defined (__x86_64__) || defined (__INTEL__) #define fstb_ARCHI fstb_ARCHI_X86 -#elif defined (__arm__) || defined (_M_ARM) || defined (__aarch64__) +#elif defined (__arm__) || defined (__arm) || defined (__arm64__) || defined (__arm64) || defined (_M_ARM) || defined (__aarch64__) #define fstb_ARCHI fstb_ARCHI_ARM #else #error @@ -48,14 +50,79 @@ namespace fstb // Native word size, in power of 2 bits -#if defined (_WIN64) || defined (__64BIT__) || defined (__amd64__) || defined (__x86_64__) - #define fstb_WORD_SIZE_L2 6 - #define fstb_WORD_SIZE 64 - #define fstb_WORD_SIZE_BYTE 8 +#if defined (_WIN64) || defined (__64BIT__) || defined (__amd64__) || defined (__x86_64__) || defined (__aarch64__) || defined (__arm64__) || defined (__arm64) + #define fstb_WORD_SIZE_L2 (6) + #define fstb_WORD_SIZE (64) + #define fstb_WORD_SIZE_BYTE (8) +#else + #define fstb_WORD_SIZE_L2 (5) + #define fstb_WORD_SIZE (32) + #define fstb_WORD_SIZE_BYTE (4) +#endif + + + +// Endianness +#define fstb_ENDIAN_BIG (1) +#define fstb_ENDIAN_LITTLE (2) + +#if (fstb_ARCHI == fstb_ARCHI_X86) + #define fstb_ENDIAN fstb_ENDIAN_LITTLE +#elif (fstb_ARCHI == fstb_ARCHI_ARM) + #if defined (__ARMEL__) || defined (__LITTLE_ENDIAN__) + #define fstb_ENDIAN fstb_ENDIAN_LITTLE + #else + #define fstb_ENDIAN fstb_ENDIAN_BIG + #endif +#else + #error +#endif + + + +// 64-bit and 128-bit Compare-And-Swap +#define fstb_HAS_CAS_64 1 + +#if fstb_WORD_SIZE == 64 + // We just ignore the early AMD 64-bit CPU without CMPXCHG16B + #if (fstb_ARCHI == fstb_ARCHI_X86) + #define fstb_HAS_CAS_128 1 + + #elif (fstb_ARCHI == fstb_ARCHI_ARM) + #define fstb_HAS_CAS_128 1 + + #endif +#endif + + + +// System +#define fstb_SYS_UNDEF (1) +#define fstb_SYS_WIN (2) +#define fstb_SYS_LINUX (3) +#define fstb_SYS_MACOS (4) +#if defined (linux) || defined (__linux) || defined (__linux__) + #define fstb_SYS fstb_SYS_LINUX +#elif defined (_WIN32) || defined (WIN32) || defined (__WIN32__) || defined (__CYGWIN__) || defined (__CYGWIN32__) + #define fstb_SYS fstb_SYS_WIN +#elif defined (macintosh) || defined (__APPLE__) || defined (__APPLE_CC__) + #define fstb_SYS fstb_SYS_MACOS +#else + #define fstb_SYS fstb_SYS_UNDEF +#endif + + + +// Compiler +#define fstb_COMPILER_GCC (1) +#define fstb_COMPILER_MSVC (2) + +#if defined (__GNUC__) + #define fstb_COMPILER fstb_COMPILER_GCC +#elif defined (_MSC_VER) + #define fstb_COMPILER fstb_COMPILER_MSVC #else - #define fstb_WORD_SIZE_L2 5 - #define fstb_WORD_SIZE 32 - #define fstb_WORD_SIZE_BYTE 4 + #error #endif @@ -71,21 +138,63 @@ namespace fstb +// Alignment #if defined (_MSC_VER) #define fstb_TYPEDEF_ALIGN( alignsize, srctype, dsttype) \ typedef __declspec (align (alignsize)) srctype dsttype #elif defined (__GNUC__) #define fstb_TYPEDEF_ALIGN( alignsize, srctype, dsttype) \ - typedef srctype __attribute__ ((aligned (alignsize))) dsttype + typedef srctype dsttype __attribute__ ((aligned (alignsize))) #else #error Undefined for this compiler #endif -const long double PI = 3.1415926535897932384626433832795L; -const long double LN2 = 0.69314718055994530941723212145818L; -const long double EXP1 = 2.7182818284590452353602874713527L; +// Restrict for pointers +#define fstb_RESTRICT __restrict + + + +// Calling conventions and export functions +#if defined (_WIN32) && ! defined (_WIN64) + #define fstb_CDECL __cdecl +#else + #define fstb_CDECL +#endif +#if fstb_IS (SYS, WIN) + #if defined (__GNUC__) + #define fstb_EXPORT(f) extern "C" __attribute__((dllexport)) f + #else + #define fstb_EXPORT(f) extern "C" __declspec(dllexport) f + #endif +#else + #define fstb_EXPORT(f) extern "C" __attribute__((visibility("default"))) f +#endif + + + +// Convenient helper to declare unused function parameters +template inline void unused (T &&...) {} + + + + +const double PI = 3.1415926535897932384626433832795; +const double LN2 = 0.69314718055994530941723212145818; +const double LN10 = 2.3025850929940456840179914546844; +const double LOG10_2 = 0.30102999566398119521373889472449; +const double LOG2_E = 1.0 / LN2; +const double LOG2_10 = LN10 / LN2; +const double EXP1 = 2.7182818284590452353602874713527; +const double SQRT2 = 1.4142135623730950488016887242097; +const double TWOP32 = 256.0 * 256 * 256 * 256; +const double TWOPM32 = 1.0 / TWOP32; + +const float ANTI_DENORMAL_F32 = 1e-20f; +const double ANTI_DENORMAL_F64 = 1e-290; +const float ANTI_DENORMAL_F32_CUB = 1e-10f; // Anti-denormal for float numbers aimed to be raised to the power of 2 or 3. +const double ANTI_DENORMAL_F64_CUB = 1e-100; diff --git a/src/fstb/fnc.cpp b/src/fstb/fnc.cpp index 6eb2f6c..0667267 100644 --- a/src/fstb/fnc.cpp +++ b/src/fstb/fnc.cpp @@ -46,7 +46,7 @@ void conv_to_lower_case (std::string &str) { for (std::string::size_type p = 0; p < str.length (); ++p) { - str [p] = tolower (str [p]); + str [p] = char (tolower (str [p])); } } @@ -71,7 +71,7 @@ int snprintf4all (char *out_0, size_t size, const char *format_0, ...) #else - cnt = snprintf (out_0, size, format_0, ap); + cnt = vsnprintf (out_0, size, format_0, ap); #endif diff --git a/src/fstb/fnc.hpp b/src/fstb/fnc.hpp index 91d8da8..1ed1791 100644 --- a/src/fstb/fnc.hpp +++ b/src/fstb/fnc.hpp @@ -22,7 +22,7 @@ To Public License, Version 2, as published by Sam Hocevar. See /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ -#include "def.h" +#include "fstb/def.h" #include @@ -409,13 +409,24 @@ bool is_eq_rel (T v1, T v2, T tol) +/* +============================================================================== +Name: get_prev_pow2 +Description: + Computes the exponent of the power of two equal to or immediately lower + than the parameter. It is the base-2 log rounded toward minus infinity. +Input parameters: + - x: Number which we want to compute the base-2 log. +Returns: The exponent +Throws: Nothing +============================================================================== +*/ + int get_prev_pow_2 (uint32_t x) { assert (x > 0); -#if (fstb_ARCHI == fstb_ARCHI_X86) - - #if defined (_MSC_VER) +#if (fstb_ARCHI == fstb_ARCHI_X86) && defined (_MSC_VER) #if ((_MSC_VER / 100) < 14) @@ -434,33 +445,29 @@ int get_prev_pow_2 (uint32_t x) #endif - return (int (p)); - - #endif +#else -#endif + int p = -1; + while ((x & ~(uint32_t (0xFFFF))) != 0) { - int p = -1; - - while ((x & ~(uint32_t (0xFFFF))) != 0) - { - p += 16; - x >>= 16; - } - while ((x & ~(uint32_t (0xF))) != 0) - { - p += 4; - x >>= 4; - } - while (x > 0) - { - ++p; - x >>= 1; - } - - return (int (p)); + p += 16; + x >>= 16; } + while ((x & ~(uint32_t (0xF))) != 0) + { + p += 4; + x >>= 4; + } + while (x > 0) + { + ++p; + x >>= 1; + } + +#endif + + return (int (p)); } diff --git a/src/main.cpp b/src/main.cpp index 799887a..09179fc 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -27,6 +27,7 @@ To Public License, Version 2, as published by Sam Hocevar. See #include "fmtc/Stack16ToNative.h" #include "fmtc/Transfer.h" #include "fmtc/version.h" +#include "fstb/def.h" #include "vsutl/Redirect.h" #include "VapourSynth.h" @@ -66,6 +67,8 @@ class TmpHistLuma , _full_flag (get_arg_int (in, out, "full", 0) != 0) , _amp (std::max (get_arg_int (in, out, "amp", 16), 1)) { + fstb::unused (user_data_ptr, core); + if (! vsutl::is_constant_format (_vi_in)) { throw_inval_arg ("only constant formats are supported."); @@ -85,11 +88,15 @@ class TmpHistLuma // vsutl::FilterBase virtual void init_filter (::VSMap &in, ::VSMap &out, ::VSNode &node, ::VSCore &core) { + fstb::unused (in, out, core); + _vsapi.setVideoInfo (&_vi_out, 1, &node); } virtual const ::VSFrameRef * get_frame (int n, int activation_reason, void * &frame_data_ptr, ::VSFrameContext &frame_ctx, ::VSCore &core) { + fstb::unused (frame_data_ptr); + ::VSFrameRef * dst_ptr = 0; ::VSNodeRef & node = *_clip_src_sptr; @@ -130,7 +137,7 @@ class TmpHistLuma { int v = reinterpret_cast (data_src_ptr) [x]; v = mi + (rpa - std::abs ((v - mi_in) % (rpa * 2) - rpa)) * _amp; - reinterpret_cast (data_dst_ptr) [x] = v; + reinterpret_cast (data_dst_ptr) [x] = uint16_t (v); } } else @@ -139,7 +146,7 @@ class TmpHistLuma { int v = data_src_ptr [x]; v = mi + (rpa - std::abs ((v - mi_in) % (rpa * 2) - rpa)) * _amp; - data_dst_ptr [x] = v; + data_dst_ptr [x] = uint8_t (v); } } diff --git a/src/vsutl/ObjRefSPtr.h b/src/vsutl/ObjRefSPtr.h index 5cb089b..63b1d08 100644 --- a/src/vsutl/ObjRefSPtr.h +++ b/src/vsutl/ObjRefSPtr.h @@ -45,7 +45,7 @@ namespace vsutl -template +template class ObjRefSPtr { diff --git a/src/vsutl/ObjRefSPtr.hpp b/src/vsutl/ObjRefSPtr.hpp index 6f7f6be..979b605 100644 --- a/src/vsutl/ObjRefSPtr.hpp +++ b/src/vsutl/ObjRefSPtr.hpp @@ -40,7 +40,7 @@ namespace vsutl // Does not increase the reference count. -template +template ObjRefSPtr ::ObjRefSPtr (T *ptr, const ::VSAPI &vsapi) : _obj_ptr (ptr) , _vsapi_ptr (&vsapi) @@ -50,7 +50,7 @@ ObjRefSPtr ::ObjRefSPtr (T *ptr, const ::VSAPI &vsapi) -template +template ObjRefSPtr ::ObjRefSPtr (const ObjRefSPtr &other) : _obj_ptr (0) , _vsapi_ptr (other._vsapi_ptr) @@ -67,7 +67,7 @@ ObjRefSPtr ::ObjRefSPtr (const ObjRefSPtr &other) -template +template ObjRefSPtr ::~ObjRefSPtr () { release_resource (); @@ -75,7 +75,7 @@ ObjRefSPtr ::~ObjRefSPtr () -template +template ObjRefSPtr & ObjRefSPtr ::operator = (const ObjRefSPtr &other) { if (other._obj_ptr != _obj_ptr) @@ -107,7 +107,7 @@ ObjRefSPtr & ObjRefSPtr ::operator = (const ObjRefSPtr +template T * ObjRefSPtr ::operator -> () const { return (_obj_ptr); @@ -115,7 +115,7 @@ T * ObjRefSPtr ::operator -> () const -template +template T & ObjRefSPtr ::operator * () const { return (*_obj_ptr); @@ -123,7 +123,7 @@ T & ObjRefSPtr ::operator * () const -template +template T * ObjRefSPtr ::get () const { return (_obj_ptr); @@ -131,7 +131,7 @@ T * ObjRefSPtr ::get () const -template +template T * ObjRefSPtr ::dup () const { assert (_obj_ptr != 0); @@ -144,7 +144,7 @@ T * ObjRefSPtr ::dup () const -template +template void ObjRefSPtr ::clear () { release_resource (); @@ -160,7 +160,7 @@ void ObjRefSPtr ::clear () -template +template void ObjRefSPtr ::release_resource () { if (_obj_ptr != 0) diff --git a/src/vsutl/PlaneProcessor.cpp b/src/vsutl/PlaneProcessor.cpp index fc31522..cb027be 100644 --- a/src/vsutl/PlaneProcessor.cpp +++ b/src/vsutl/PlaneProcessor.cpp @@ -24,6 +24,7 @@ To Public License, Version 2, as published by Sam Hocevar. See /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ +#include "fstb/def.h" #include "fstb/fnc.h" #include "vsutl/PlaneProcCbInterface.h" #include "vsutl/PlaneProcessor.h" @@ -70,6 +71,7 @@ PlaneProcessor::PlaneProcessor (const ::VSAPI &vsapi, PlaneProcCbInterface &cb, // Don't forget to check "out" to see if an error occured. void PlaneProcessor::set_filter (const ::VSMap &in, ::VSMap &out, const ::VSVideoInfo &vi_out, bool simple_flag, int max_def_planes, const char *prop_name_0, const char *clip_name_0) { + fstb::unused (clip_name_0); assert (max_def_planes > 0); assert (prop_name_0 != 0); assert (clip_name_0 != 0); diff --git a/src/vsutl/Redirect.hpp b/src/vsutl/Redirect.hpp index 4da9ee6..1fa2141 100644 --- a/src/vsutl/Redirect.hpp +++ b/src/vsutl/Redirect.hpp @@ -22,6 +22,8 @@ To Public License, Version 2, as published by Sam Hocevar. See /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ +#include "fstb/def.h" + #include #include @@ -101,6 +103,7 @@ void VS_CC Redirect ::create (const ::VSMap *in, ::VSMap *out, void *userData template void VS_CC Redirect ::init_filter (::VSMap *in, ::VSMap *out, void **instanceData, ::VSNode *node, ::VSCore *core, const ::VSAPI *vsapi) { + fstb::unused (vsapi); assert (in != 0); assert (out != 0); assert (instanceData != 0); @@ -118,6 +121,7 @@ void VS_CC Redirect ::init_filter (::VSMap *in, ::VSMap *out, void **instance template const ::VSFrameRef * VS_CC Redirect ::get_frame (int n, int activationReason, void **instanceData, void **frameData, ::VSFrameContext *frameCtx, ::VSCore *core, const ::VSAPI *vsapi) { + fstb::unused (vsapi); assert (n >= 0); assert (instanceData != 0); assert (*instanceData != 0); @@ -143,6 +147,7 @@ const ::VSFrameRef * VS_CC Redirect ::get_frame (int n, int activationReason, template void VS_CC Redirect ::free_filter (void *instanceData, ::VSCore *core, const ::VSAPI *vsapi) { + fstb::unused (core, vsapi); assert (instanceData != 0); assert (core != 0); assert (vsapi != 0);