IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
MaxPack.h
Go to the documentation of this file.
1 // MaxPack.h:
3 // -------------------
4 //
14 
15 #ifndef __IPSDKUTIL_INSTRUCTIONSET_REDUCTION_DETAIL_SSE2_MAXPACK_H__
16 #define __IPSDKUTIL_INSTRUCTIONSET_REDUCTION_DETAIL_SSE2_MAXPACK_H__
17 
19 #include <IPSDKUtil/BaseTypes.h>
25 
26 namespace ipsdk {
27 namespace simd {
28 namespace detail {
29 namespace reduction {
30 
33 
36 template <typename T>
38  typename boost::enable_if_c<boost::is_integral<T>::value
39  && sizeof(T) == 1>::type>
40 {
41  static IPSDK_FORCEINLINE
42  T
43  act(const BasePack<ePackType::ePT_Sse, T>& in)
44  {
46  }
47 };
48 
51 template <typename T>
53  typename boost::enable_if_c<boost::is_integral<T>::value
54  && sizeof(T) == 2>::type>
55 {
56  static IPSDK_FORCEINLINE
57  T
58  act(const BasePack<ePackType::ePT_Sse, T>& in)
59  {
60  const typename Sse2Type<T>::Type res =
62  in._val[0], in._val[1]);
64  }
65 };
66 
69 template <typename T>
71  typename boost::enable_if_c<boost::is_integral<T>::value
72  && sizeof(T) == 4>::type>
73 {
74  static IPSDK_FORCEINLINE
75  T
76  act(const BasePack<ePackType::ePT_Sse, T>& in)
77  {
79 
80  const typename Sse2Type<T>::Type res0 =
81  MaxR::act(in._val[0], in._val[1]);
82 
83  const typename Sse2Type<T>::Type res1 =
84  MaxR::act(in._val[2], in._val[3]);
85 
86  const typename Sse2Type<T>::Type res =
87  MaxR::act(res0, res1);
88 
90  }
91 };
92 
95 template <typename T>
97  typename boost::enable_if_c<boost::is_integral<T>::value
98  && sizeof(T) == 8>::type>
99 {
100  static IPSDK_FORCEINLINE
101  T
102  act(const BasePack<ePackType::ePT_Sse, T>& in)
103  {
105 
106  typename Sse2Type<T>::Type res =
107  MaxR::act(in._val[0], in._val[1]);
108 
109  res = MaxR::act(res, in._val[2]);
110  res = MaxR::act(res, in._val[3]);
111  res = MaxR::act(res, in._val[4]);
112  res = MaxR::act(res, in._val[5]);
113  res = MaxR::act(res, in._val[6]);
114  res = MaxR::act(res, in._val[7]);
115 
117  }
118 };
119 
122 template <>
124 {
125  static IPSDK_FORCEINLINE
126  ipReal32
128  {
130 
131  const Sse2Type<ipReal32>::Type res0 = MaxR::act(in._val[0], in._val[1]);
132  const Sse2Type<ipReal32>::Type res1 = MaxR::act(in._val[2], in._val[3]);
133  const Sse2Type<ipReal32>::Type res = MaxR::act(res0, res1);
135  }
136 };
137 
140 template <>
142 {
143  static IPSDK_FORCEINLINE
144  ipReal64
146  {
148 
149  Sse2Type<ipReal64>::Type res = MaxR::act(in._val[0], in._val[1]);
150  res = MaxR::act(res, in._val[2]);
151  res = MaxR::act(res, in._val[3]);
152  res = MaxR::act(res, in._val[4]);
153  res = MaxR::act(res, in._val[5]);
154  res = MaxR::act(res, in._val[6]);
155  res = MaxR::act(res, in._val[7]);
157  }
158 };
159 
162 
163 } // end of namespace reduction
164 } // end of namespace detail
165 } // end of namespace simd
166 } // end of namespace ipsdk
167 
168 #endif // __IPSDKUTIL_INSTRUCTIONSET_REDUCTION_DETAIL_SSE2_MAXREG_H__
Defines the IPSDK_FORCEINLINE.
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
cast function; casts a Pack<instructionSet, TIn> to a Pack<instructionSet, TOut>
template structure, specialized to implement the computation of the maximum of the elements loaded in...
template structure which is specialized to implement the maximum computation on 2 scalars or 2 regist...
double ipReal64
Base types definition.
Definition: BaseTypes.h:57
Base types for multiplatform compatibility.
eInstructionSet
Enumerate for processor instruction set description.
Definition: InstructionSetTypes.h:31
structure MaxPack<eInstructionSet::domain instructionSet, typename T, typename Enable=void> ...
Definition: MaxPack.h:40
Definition: MaxRegDecl.h:29
Definition of import/export macro for library.
unload function; unloads a pack into a memory buffer
Streaming SIMD Extensions 2.
Definition: InstructionSetTypes.h:36
structure used to retrieve SSE2 type associated to a base type
Definition: Sse2Types.h:32
MaxReg template specialization for instruction set SSE2 and for type ipReal32.
Definition: MaxRegDecl.h:99
float ipReal32
Base types definition.
Definition: BaseTypes.h:56
structure containing intrinsic registers used to store vectorized data
Definition: BasePackDecl.h:29