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_AVX2_MAXREG_H__
16 #define __IPSDKUTIL_INSTRUCTIONSET_REDUCTION_DETAIL_AVX2_MAXREG_H__
17 
21 
22 namespace ipsdk {
23 namespace simd {
24 namespace detail {
25 namespace reduction {
26 
29 
32 template <typename T>
34  typename boost::enable_if_c<sizeof(T) == 1>::type>
35 {
36  static IPSDK_FORCEINLINE
37  T
38  act(const typename AvxType<T>::Type& in)
39  {
40  T unloaded[32];
42  T tmax = unloaded[0];
43  for(int i=1; i<32; ++i) {
44  tmax = (unloaded[i] > tmax ? unloaded[i] : tmax);
45  }
46  return tmax;
47  }
48 };
49 
52 template <typename T>
54  typename boost::enable_if_c<sizeof(T) == 2>::type>
55 {
56  static IPSDK_FORCEINLINE
57  T
58  act(const typename AvxType<T>::Type& in)
59  {
60  T unloaded[16];
62  T tmax = unloaded[0];
63  for(int i=1; i<16; ++i) {
64  tmax = (unloaded[i] > tmax ? unloaded[i] : tmax);
65  }
66  return tmax;
67  }
68 };
69 
72 template <typename T>
74  typename boost::enable_if_c<sizeof(T) == 4>::type>
75 {
76  static IPSDK_FORCEINLINE
77  T
78  act(const typename AvxType<T>::Type& in)
79  {
80  T unloaded[8];
82  T tmax = unloaded[0];
83  for(int i=1; i<8; ++i) {
84  tmax = (unloaded[i] > tmax ? unloaded[i] : tmax);
85  }
86  return tmax;
87  }
88 };
89 
92 template <typename T>
94  typename boost::enable_if_c<sizeof(T) == 8>::type>
95 {
96  static IPSDK_FORCEINLINE
97  T
98  act(const typename AvxType<T>::Type& in)
99  {
100  T unloaded[4];
102  T tmax = unloaded[0];
103  for(int i=1; i<4; ++i) {
104  tmax = (unloaded[i] > tmax ? unloaded[i] : tmax);
105  }
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_AVX2_MAXREGIMPL_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
Advanced Vector Extensions 2.
Definition: InstructionSetTypes.h:48
Definition of import/export macro for library.
structure used to retrieve AVX type associated to a base type
Definition: AvxTypes.h:33
Definition: UnloadReg.h:30