IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
MaxReg.h
Go to the documentation of this file.
1 // MaxReg.h:
3 // -------------------
4 //
14 
15 #ifndef __IPSDKUTIL_INSTRUCTIONSET_REDUCTION_DETAIL_SSE2_MAXREG_H__
16 #define __IPSDKUTIL_INSTRUCTIONSET_REDUCTION_DETAIL_SSE2_MAXREG_H__
17 
22 
23 namespace ipsdk {
24 namespace simd {
25 namespace detail {
26 namespace reduction {
27 
30 
33 template <typename T>
35  typename boost::enable_if_c<sizeof(T) == 1>::type>
36 {
37  static IPSDK_FORCEINLINE
38  T
39  act(const typename Sse2Type<T>::Type& in)
40  {
41  T unloaded[16];
43  T tmax = unloaded[0];
44  for(int i=1; i<16; ++i) {
45  tmax = (unloaded[i] > tmax ? unloaded[i] : tmax);
46  }
47  return tmax;
48  }
49 };
50 
53 template <typename T>
55  typename boost::enable_if_c<sizeof(T) == 2>::type>
56 {
57  static IPSDK_FORCEINLINE
58  T
59  act(const typename Sse2Type<T>::Type& in)
60  {
61  T unloaded[8];
63  T tmax = unloaded[0];
64  for(int i=1; i<8; ++i) {
65  tmax = (unloaded[i] > tmax ? unloaded[i] : tmax);
66  }
67  return tmax;
68  }
69 };
70 
73 template <typename T>
75  typename boost::enable_if_c<sizeof(T) == 4>::type>
76 {
77  static IPSDK_FORCEINLINE
78  T
79  act(const typename Sse2Type<T>::Type& in)
80  {
81  T unloaded[4];
83  T tmax = unloaded[0];
84  for(int i=1; i<4; ++i) {
85  tmax = (unloaded[i] > tmax ? unloaded[i] : tmax);
86  }
87  return tmax;
88  }
89 };
90 
93 template <typename T>
95  typename boost::enable_if_c<sizeof(T) == 8>::type>
96 {
97  static IPSDK_FORCEINLINE
98  T
99  act(const typename Sse2Type<T>::Type& in)
100  {
101  T unloaded[2];
103  T tmax = unloaded[0];
104  if(unloaded[1] > tmax)
105  tmax = unloaded[1];
106  return tmax;
107  }
108 };
109 
112 
113 } // end of namespace reduction
114 } // end of namespace detail
115 } // end of namespace simd
116 } // end of namespace ipsdk
117 
118 #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>
eInstructionSet
Enumerate for processor instruction set description.
Definition: InstructionSetTypes.h:31
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
Definition: UnloadReg.h:30