IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
PolynomPack.h
Go to the documentation of this file.
1 // PolynomPack.h:
3 // -------------------
4 //
14 
15 #ifndef __IPSDKUTIL_INSTRUCTIONSET_ARITHMETIC_DETAIL_SSE2_POLYNOMPACK_H__
16 #define __IPSDKUTIL_INSTRUCTIONSET_ARITHMETIC_DETAIL_SSE_POLYNOMPACK_H__
17 
20 #include <IPSDKUtil/InstructionSet/Arithmetic/detail/PolynomReg.h>
22 
23 #include <boost/mpl/not_equal_to.hpp>
24 
25 namespace ipsdk {
26 namespace simd {
27 namespace detail {
28 
31 
32 #define DEFINE_POLYNOMPACK_SSE2(N) \
33 template <typename T> \
34 struct PolynomPack<eInstructionSet::eIS_Sse2, eInstructionSet::eIS_Sse2, N, T, typename boost::enable_if_c<boost::mpl::equal_to<boost::mpl::int_<sizeof(T)>, boost::mpl::int_<1> >::value>::type> \
35 { \
36  static IPSDK_FORCEINLINE \
37  BasePack<ePackType::ePT_Sse, T> \
38  act(const BasePack<ePackType::ePT_Sse, T>& in, \
39  BOOST_PP_ENUM_PARAMS(BOOST_PP_INC(N), const T& c)) \
40  { \
41  BasePack<ePackType::ePT_Scalar, T> out; \
42  act(in, BOOST_PP_ENUM_PARAMS(BOOST_PP_INC(N), c), out); \
43  return out; \
44  } \
45  \
46  static IPSDK_FORCEINLINE \
47  void \
48  act(const BasePack<ePackType::ePT_Sse, T>& in, \
49  BOOST_PP_ENUM_PARAMS(BOOST_PP_INC(N), const T& c), \
50  BasePack<ePackType::ePT_Sse, T>& out) \
51  { \
52  PolynomReg<eInstructionSet::eIS_Sse2, eInstructionSet::eIS_Sse2, N, T>::act(in._val[0], BOOST_PP_ENUM_PARAMS(BOOST_PP_INC(N), c), out._val[0]); \
53  } \
54 }; \
55  \
56 template <typename T> \
57 struct PolynomPack<eInstructionSet::eIS_Sse2, eInstructionSet::eIS_Sse2, N, T, typename boost::enable_if_c<boost::mpl::equal_to<boost::mpl::int_<sizeof(T)>, boost::mpl::int_<2> >::value>::type> \
58 { \
59  static IPSDK_FORCEINLINE \
60  BasePack<ePackType::ePT_Sse, T> \
61  act(const BasePack<ePackType::ePT_Sse, T>& in, \
62  BOOST_PP_ENUM_PARAMS(BOOST_PP_INC(N), const T& c)) \
63  { \
64  BasePack<ePackType::ePT_Scalar, T> out; \
65  act(in, BOOST_PP_ENUM_PARAMS(BOOST_PP_INC(N), c), out); \
66  return out; \
67  } \
68  \
69  static IPSDK_FORCEINLINE \
70  void \
71  act(const BasePack<ePackType::ePT_Sse, T>& in, \
72  BOOST_PP_ENUM_PARAMS(BOOST_PP_INC(N), const T& c), \
73  BasePack<ePackType::ePT_Sse, T>& out) \
74  { \
75  PolynomReg<eInstructionSet::eIS_Sse2, eInstructionSet::eIS_Sse2, N, T>::act(in._val[0], BOOST_PP_ENUM_PARAMS(BOOST_PP_INC(N), c), out._val[0]); \
76  PolynomReg<eInstructionSet::eIS_Sse2, eInstructionSet::eIS_Sse2, N, T>::act(in._val[1], BOOST_PP_ENUM_PARAMS(BOOST_PP_INC(N), c), out._val[1]); \
77  } \
78 }; \
79  \
80 template <typename T> \
81 struct PolynomPack<eInstructionSet::eIS_Sse2, eInstructionSet::eIS_Sse2, N, T, typename boost::enable_if_c<boost::mpl::equal_to<boost::mpl::int_<sizeof(T)>, boost::mpl::int_<4> >::value>::type> \
82 { \
83  static IPSDK_FORCEINLINE \
84  BasePack<ePackType::ePT_Sse, T> \
85  act(const BasePack<ePackType::ePT_Sse, T>& in, \
86  BOOST_PP_ENUM_PARAMS(BOOST_PP_INC(N), const T& c)) \
87  { \
88  BasePack<ePackType::ePT_Scalar, T> out; \
89  act(in, BOOST_PP_ENUM_PARAMS(BOOST_PP_INC(N), c), out); \
90  return out; \
91  } \
92  \
93  static IPSDK_FORCEINLINE \
94  void \
95  act(const BasePack<ePackType::ePT_Sse, T>& in, \
96  BOOST_PP_ENUM_PARAMS(BOOST_PP_INC(N), const T& c), \
97  BasePack<ePackType::ePT_Sse, T>& out) \
98  { \
99  PolynomReg<eInstructionSet::eIS_Sse2, eInstructionSet::eIS_Sse2, N, T>::act(in._val[0], BOOST_PP_ENUM_PARAMS(BOOST_PP_INC(N), c), out._val[0]); \
100  PolynomReg<eInstructionSet::eIS_Sse2, eInstructionSet::eIS_Sse2, N, T>::act(in._val[1], BOOST_PP_ENUM_PARAMS(BOOST_PP_INC(N), c), out._val[1]); \
101  PolynomReg<eInstructionSet::eIS_Sse2, eInstructionSet::eIS_Sse2, N, T>::act(in._val[2], BOOST_PP_ENUM_PARAMS(BOOST_PP_INC(N), c), out._val[2]); \
102  PolynomReg<eInstructionSet::eIS_Sse2, eInstructionSet::eIS_Sse2, N, T>::act(in._val[3], BOOST_PP_ENUM_PARAMS(BOOST_PP_INC(N), c), out._val[3]); \
103  } \
104 }; \
105 
106 DEFINE_POLYNOMPACK_SSE2(20)
107 DEFINE_POLYNOMPACK_SSE2(19)
108 DEFINE_POLYNOMPACK_SSE2(18)
109 DEFINE_POLYNOMPACK_SSE2(17)
110 DEFINE_POLYNOMPACK_SSE2(16)
111 DEFINE_POLYNOMPACK_SSE2(15)
112 DEFINE_POLYNOMPACK_SSE2(14)
113 DEFINE_POLYNOMPACK_SSE2(13)
114 DEFINE_POLYNOMPACK_SSE2(12)
115 DEFINE_POLYNOMPACK_SSE2(11)
116 DEFINE_POLYNOMPACK_SSE2(10)
117 DEFINE_POLYNOMPACK_SSE2(9)
118 DEFINE_POLYNOMPACK_SSE2(8)
119 DEFINE_POLYNOMPACK_SSE2(7)
120 DEFINE_POLYNOMPACK_SSE2(6)
121 DEFINE_POLYNOMPACK_SSE2(5)
122 DEFINE_POLYNOMPACK_SSE2(4)
123 DEFINE_POLYNOMPACK_SSE2(3)
124 DEFINE_POLYNOMPACK_SSE2(2)
125 DEFINE_POLYNOMPACK_SSE2(1)
126 
129 
130 } // end of namespace detail
131 } // end of namespace simd
132 } // end of namespace ipsdk
133 
134 #endif // __IPSDKUTIL_INSTRUCTIONSET_ARITHMETIC_DETAIL_SSE2_POLYNOMPACK_H__
Defines the IPSDK_FORCEINLINE.
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
BasePack class; defines a set of scalars (for instruction set "standard") or registers (for all other...
Definition of import/export macro for library.