IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
DivReg.h
Go to the documentation of this file.
1 // DivReg.h:
3 // -------------------
4 //
14 
15 #ifndef __IPSDKUTIL_INSTRUCTIONSET_ARITHMETIC_DETAIL_COMMON_DIVREG_H__
16 #define __IPSDKUTIL_INSTRUCTIONSET_ARITHMETIC_DETAIL_COMMON_DIVREG_H__
17 
23 
24 #include <boost/mpl/and.hpp>
25 #include <boost/mpl/equal_to.hpp>
26 #include <boost/mpl/or.hpp>
27 #include <boost/mpl/not_equal_to.hpp>
28 #include <boost/mpl/sizeof.hpp>
29 
30 namespace ipsdk {
31 namespace simd {
32 namespace detail {
33 
36 
38 template <eInstructionSet::domain IS, typename T>
39 struct DivReg<
40  IS,
41  T,
42  typename boost::enable_if<
43  typename boost::mpl::and_<
44  typename boost::mpl::not_equal_to<
45  boost::mpl::int_<IS>,
46  boost::mpl::int_<eInstructionSet::eIS_Standard>
47  >::type,
48  typename boost::mpl::and_<
49  typename boost::is_integral<T>::type,
50  typename boost::mpl::equal_to<
51  boost::mpl::sizeof_<T>,
52  boost::mpl::int_<1>
53  >::type
54  >::type
55  >::type
56  >::type
57 >
58 {
59  static IPSDK_FORCEINLINE
60  typename RegType<IS, T>::Type
61  act(const typename RegType<IS, T>::Type& in1,
62  const typename RegType<IS, T>::Type& in2)
63  {
64  typename RegType<IS, T>::Type out;
65  act(in1, in2, out);
66  return out;
67  }
68 
69  static IPSDK_FORCEINLINE
70  void
71  act(const typename RegType<IS, T>::Type& in1,
72  const typename RegType<IS, T>::Type& in2,
73  typename RegType<IS, T>::Type& out)
74  {
75  typename RegType<IS, ipInt16>::Type in1I16_1, in1I16_2;
76  typename RegType<IS, ipInt16>::Type in2I16_1, in2I16_2;
77  typename RegType<IS, ipReal32>::Type in1f1, in1f2, in1f3, in1f4;
78  typename RegType<IS, ipReal32>::Type in2f1, in2f2, in2f3, in2f4;
79  typename RegType<IS, ipReal32>::Type outf1, outf2, outf3, outf4;
80 
81  CastReg<IS, T, ipInt16>::act(in1, in1I16_1, in1I16_2);
82  CastReg<IS, T, ipInt16>::act(in2, in2I16_1, in2I16_2);
83  CastReg<IS, ipInt16, ipReal32>::act(in1I16_1, in1f1, in1f2);
84  CastReg<IS, ipInt16, ipReal32>::act(in1I16_2, in1f3, in1f4);
85  CastReg<IS, ipInt16, ipReal32>::act(in2I16_1, in2f1, in2f2);
86  CastReg<IS, ipInt16, ipReal32>::act(in2I16_2, in2f3, in2f4);
87 
88  DivReg<IS, ipReal32>::act(in1f1, in2f1, outf1);
89  DivReg<IS, ipReal32>::act(in1f2, in2f2, outf2);
90  DivReg<IS, ipReal32>::act(in1f3, in2f3, outf3);
91  DivReg<IS, ipReal32>::act(in1f4, in2f4, outf4);
92 
93  CastReg<IS, ipReal32, ipInt16>::act(outf1, outf2, in1I16_1);
94  CastReg<IS, ipReal32, ipInt16>::act(outf3, outf4, in1I16_2);
95  CastReg<IS, ipInt16, T>::act(in1I16_1, in1I16_2, out);
96  }
97 };
98 
100 template <eInstructionSet::domain IS, typename T>
101 struct DivReg<
102  IS,
103  T,
104  typename boost::enable_if<
105  typename boost::mpl::and_<
106  typename boost::mpl::not_equal_to<
107  boost::mpl::int_<IS>,
108  boost::mpl::int_<eInstructionSet::eIS_Standard>
109  >::type,
110  typename boost::mpl::and_<
111  typename boost::is_integral<T>::type,
112  typename boost::mpl::equal_to<
113  boost::mpl::sizeof_<T>,
114  boost::mpl::int_<2>
115  >::type
116  >::type
117  >::type
118  >::type
119 >
120 {
121  static IPSDK_FORCEINLINE
122  typename RegType<IS, T>::Type
123  act(const typename RegType<IS, T>::Type& in1,
124  const typename RegType<IS, T>::Type& in2)
125  {
126  typename RegType<IS, T>::Type out;
127  act(in1, in2, out);
128  return out;
129  }
130 
131  static IPSDK_FORCEINLINE
132  void
133  act(const typename RegType<IS, T>::Type& in1,
134  const typename RegType<IS, T>::Type& in2,
135  typename RegType<IS, T>::Type& out)
136  {
137  typename RegType<IS, ipReal32>::Type in1f1, in1f2, in2f1, in2f2, outf1, outf2;
138  CastReg<IS, T, ipReal32>::act(in1, in1f1, in1f2);
139  CastReg<IS, T, ipReal32>::act(in2, in2f1, in2f2);
140  DivReg<IS, ipReal32>::act(in1f1, in2f1, outf1);
141  DivReg<IS, ipReal32>::act(in1f2, in2f2, outf2);
142  CastReg<IS, ipReal32, T>::act(outf1, outf2, out);
143  }
144 };
145 
147 template <eInstructionSet::domain IS, typename T>
148 struct DivReg<
149  IS,
150  T,
151  typename boost::enable_if<
152  typename boost::mpl::and_<
153  typename boost::mpl::not_equal_to<
154  boost::mpl::int_<IS>,
155  boost::mpl::int_<eInstructionSet::eIS_Standard>
156  >::type,
157  typename boost::mpl::and_<
158  typename boost::is_integral<T>::type,
159  typename boost::mpl::equal_to<
160  boost::mpl::sizeof_<T>,
161  boost::mpl::int_<4>
162  >::type
163  >::type
164  >::type
165  >::type
166 >
167 {
168  static IPSDK_FORCEINLINE
169  typename RegType<IS, T>::Type
170  act(const typename RegType<IS, T>::Type& in1,
171  const typename RegType<IS, T>::Type& in2)
172  {
173  typename RegType<IS, T>::Type out;
174  act(in1, in2, out);
175  return out;
176  }
177 
178  static IPSDK_FORCEINLINE
179  void
180  act(const typename RegType<IS, T>::Type& in1,
181  const typename RegType<IS, T>::Type& in2,
182  typename RegType<IS, T>::Type& out)
183  {
184  typename RegType<IS, ipReal32>::Type in1f, in2f, outf;
187  DivReg<IS, ipReal32>::act(in1f, in2f, outf);
189  }
190 };
191 
194 
195 } // end of namespace detail
196 } // end of namespace simd
197 } // end of namespace ipsdk
198 
199 #endif // __IPSDKUTIL_INSTRUCTIONSET_ARITHMETIC_DETAIL_COMMON_DIVREG_H__
Defines the IPSDK_FORCEINLINE.
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
Definition: DivReg.h:39
Definition: CastReg.h:30
Definition: DataItemNodeHdrMacrosDetails.h:48
RegType class.
Definition of import/export macro for library.
Definition: RegType.h:29