IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
PolynomReg.h
Go to the documentation of this file.
1 // PolynomReg.h:
3 // -------------------
4 //
14 
15 #ifndef __IPSDKUTIL_INSTRUCTIONSET_ARITHMETIC_DETAIL_COMMON_POLYNOMREG_H__
16 #define __IPSDKUTIL_INSTRUCTIONSET_ARITHMETIC_DETAIL_COMMON_POLYNOMREG_H__
17 
19 #include <IPSDKUtil/InstructionSet/Arithmetic/detail/PolynomReg.h>
20 #include <IPSDKUtil/InstructionSet/Arithmetic/detail/FmaddReg.h>
25 
26 #include <boost/preprocessor/repetition/enum_params.hpp>
27 
28 namespace ipsdk {
29 namespace simd {
30  namespace detail {
31 
34 
35 #define DEFINE_POLYNOMREG(N) \
36 template <eInstructionSet::domain IS, eInstructionSet::domain ISFma, typename T> \
37 struct PolynomReg <IS, ISFma, N, T> \
38 { \
39  static IPSDK_FORCEINLINE \
40  typename RegType<IS, T>::Type \
41  act(const typename RegType<IS, T>::Type& in, \
42  BOOST_PP_ENUM_PARAMS(BOOST_PP_INC(N), const T& c)) \
43  { \
44  typename RegType<IS, T>::Type out; \
45  act(in, BOOST_PP_ENUM_PARAMS(BOOST_PP_INC(N), c), out); \
46  return out; \
47  } \
48  \
49  static IPSDK_FORCEINLINE \
50  void \
51  act(const typename RegType<IS, T>::Type& x, \
52  BOOST_PP_ENUM_PARAMS(BOOST_PP_INC(N), const T& c), \
53  typename RegType<IS, T>::Type& out) \
54  { \
55  typedef typename RegType<IS, T>::Type Reg; \
56  Reg tmp; \
57  PolynomReg<IS, ISFma, BOOST_PP_DEC(N), T>::act(x, BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_INC(N), c), tmp); \
58  Reg r0; \
59  AssignReg<IS, T>::act(r0, c0); \
60  FmaddReg<ISFma, T>::act(x, tmp, r0, out); \
61  } \
62 };
63 
64 DEFINE_POLYNOMREG(20)
65 DEFINE_POLYNOMREG(19)
66 DEFINE_POLYNOMREG(18)
67 DEFINE_POLYNOMREG(17)
68 DEFINE_POLYNOMREG(16)
69 DEFINE_POLYNOMREG(15)
70 DEFINE_POLYNOMREG(14)
71 DEFINE_POLYNOMREG(13)
72 DEFINE_POLYNOMREG(12)
73 DEFINE_POLYNOMREG(11)
74 DEFINE_POLYNOMREG(10)
75 DEFINE_POLYNOMREG(9)
76 DEFINE_POLYNOMREG(8)
77 DEFINE_POLYNOMREG(7)
78 DEFINE_POLYNOMREG(6)
79 DEFINE_POLYNOMREG(5)
80 DEFINE_POLYNOMREG(4)
81 DEFINE_POLYNOMREG(3)
82 DEFINE_POLYNOMREG(2)
83 
84 template <eInstructionSet::domain IS, eInstructionSet::domain ISFma, typename T>
85 struct PolynomReg <IS, ISFma, 1, T>
86 {
87  static IPSDK_FORCEINLINE
88  typename RegType<IS, T>::Type
89  act(const typename RegType<IS, T>::Type& in,
90  const T& c0,
91  const T& c1)
92  {
93  typename RegType<IS, T>::Type out;
94  act(in, c0, c1, out);
95  return out;
96  }
97 
98  static IPSDK_FORCEINLINE
99  void
100  act(const typename RegType<IS, T>::Type& x,
101  const T& c0,
102  const T& c1,
103  typename RegType<IS, T>::Type& out)
104  {
105  typedef typename RegType<IS, T>::Type Reg;
106  Reg r0, r1;
107  AssignReg<IS, T>::act(r0, c0);
108  AssignReg<IS, T>::act(r1, c1);
109  FmaddReg<ISFma, T>::act(r1, x, r0, out);
110  }
111 };
112 
115 
116 } // end of namespace detail
117 } // end of namespace simd
118 } // end of namespace ipsdk
119 
120 #endif // __IPSDKUTIL_INSTRUCTIONSET_ARITHMETIC_DETAIL_SSE2_FLOORREG_H__
template structure which is specialized to implement the computation of a polynom of degree 8 applied...
Definition: PolynomReg.h:43
Defines the IPSDK_FORCEINLINE.
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
Definition: FmaddReg.h:37
RegType class.
eInstructionSet
Enumerate for processor instruction set description.
Definition: InstructionSetTypes.h:31
Definition of import/export macro for library.
Definition: RegType.h:29
Definition: AssignRegDecl.h:31