IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
PatchBasedBilateral3dImgLvl3.h
1 // PatchBasedBilateral3dImgLvl3.h:
3 // -------------------------
4 //
14 
15 #ifndef __IPSDKIPLFILTERING_PATCHBASEDBILATERAL3DIMGLVL3_H__
16 #define __IPSDKIPLFILTERING_PATCHBASEDBILATERAL3DIMGLVL3_H__
17 
21 
22 // Attributes headers
23 #include <IPSDKIPL/IPSDKIPLAttributes/Attribute/Strip/ZStrip3d/OutZStrip3d.h>
24 #include <IPSDKIPL/IPSDKIPLAttributes/Attribute/Strip/ZStrip3d/OutZStrip3d1.h>
25 #include <IPSDKIPL/IPSDKIPLAttributes/Attribute/Strip/ZStrip3d/OutZStrip3d2.h>
26 #include <IPSDKIPL/IPSDKIPLAttributes/Attribute/Strip/ZStrip3dWithKernel/InKnlZStrip3d.h>
27 #include <IPSDKIPL/IPSDKIPLAttributes/Attribute/DataItem/InPatchBasedBilateralParams.h>
28 
29 #include <boost/tuple/tuple.hpp>
30 
31 namespace ipsdk {
32 namespace imaproc {
33 namespace filter {
34 
37 
38 // declare processing algorithm
39 IPSDK_DECLARE_PROCESSING_ALGORITHM(IPSDKIPLFiltering, PatchBasedBilateral3dImg,
40  ipsdk::imaproc::matchSize(_pInKnlZStrip3d, _pOutZStrip3d),
41  (((ipsdk)(imaproc)(attr))(InKnlZStrip3d))
42  (((ipsdk)(imaproc)(attr))(InPatchBasedBilateralParams))
43 
44  (((ipsdk)(imaproc)(attr))(OutZStrip3d1))
45  (((ipsdk)(imaproc)(attr))(OutZStrip3d2))
46  (((ipsdk)(imaproc)(attr))(OutZStrip3d)))
47 
48  // implementation of image processing data identifier retrieval method
49  // for function selector usage
50  IPSDK_DECLARE_ALGORITHM_FUNCTION_SELECTOR(((STRIP)(InKnlZStrip3d))
51  ((STRIP)(OutZStrip3d)));
52 
53  // declaration of parsed data during processing
55 
56 // methods
57 public:
58 
59 protected:
62  void getNoParseInfo(ipUInt64& nbDataByElement,
63  ipUInt64& nbMaxInitData,
64  ipUInt64& nbMaxFinalData) const;
65 
66  template <
67  typename BufInType,
68  typename BufOutType,
69  typename ComputationType,
70  ipsdk::eInstructionSet::domain ISFma,
71  ipsdk::eInstructionSet::domain IS
72  >
73  void genericProcessFunctionForCurProcessingPhasis(
74  std::deque<boost::shared_ptr<YStrip2dData<BufInType> > >& yStrip2dDataColl,
75  ipInt64 outputBufferOffset,
76  ipInt32 kernelRadius,
77  ipInt32 patchHalfSz,
78  ComputationType patchSimilaritySigma,
79  ComputationType spaceSigma,
80  ComputationType twiceNoiseSigmaSq);
81 
82  template <
83  typename BufInType,
84  typename ComputationType,
85  ipsdk::eInstructionSet::domain IS>
86  void computeMeanOfDiffSquaresForEltInKernel(
87  ipInt64 otherIx,
88  ipUInt64 nbTotData,
89  ipInt32 kernelRadius,
90  ipInt32 patchHalfSz,
91  std::deque<boost::shared_ptr<YStrip2dData<BufInType> > > & yStrip2dDataColl);
92 
93  template <typename BufInType,
94  typename BufOutType,
95  typename ComputationType,
96  ipsdk::eInstructionSet::domain ISFma,
97  ipsdk::eInstructionSet::domain IS>
98  void processEltInKernelForCurrentRow(
99  ipInt64 otherIx,
100  ipUInt64 nbTotData,
101  ipUInt64 nbRealData,
102  ipInt32 kernelRadius,
103  ipInt32 patchHalfSz,
104  ComputationType patchSimilaritySigma,
105  ComputationType spaceSigma,
106  ComputationType twiceNoiseSigmaSq,
107  std::deque<boost::shared_ptr<YStrip2dData<BufInType> > >& yStrip2dDataColl);
108 
109  template <
110  typename BufInType,
111  typename BufOutType,
112  typename ComputationType,
113  eDataType::domain eComputationType,
114  ipsdk::eInstructionSet::domain IS>
115  void prepareBuffers(
116  Parser3dInfo<BufInType>& parserInfo,
117  ipInt32 kernelRadius,
118  ipInt32 patchHalfSz,
119  std::deque<boost::shared_ptr<YStrip2dData<BufInType> > > & yStrip2dDataColl);
120 
121  template <
122  typename BufInType,
123  typename BufOutType,
124  typename ComputationType,
125  ipsdk::eInstructionSet::domain IS>
126  void updateBuffers(
127  Parser3dInfo<BufInType>& parserInfo,
128  std::deque<boost::shared_ptr<YStrip2dData<BufInType> > > & yStrip2dDataColl);
129 
131  template <typename BufInType, typename BufOutType,
132  ipsdk::eInstructionSet::domain ISFma,
133  ipsdk::eInstructionSet::domain IS>
134  ipsdk::BoolResult genericProcessFunction(const ipsdk::processor::ProcessingInfo& info);
135 
136  template <typename BufInType>
137  void updateToInitData(
138  std::deque<boost::shared_ptr<YStrip2dData<BufInType> > >& yStrip2dDataColl);
139 
140  template <typename BufInType>
141  void updateToMainData(
142  std::deque<boost::shared_ptr<YStrip2dData<BufInType> > >& yStrip2dDataColl);
143 
144  template <typename BufInType>
145  void updateToFinalData(
146  std::deque<boost::shared_ptr<YStrip2dData<BufInType> > >& yStrip2dDataColl);
147 
148 // attributes
149 protected:
150  std::vector<boost::tuple<ipInt32, ipInt32, ipInt32> > _ptsInKernel;
151 
154  HybridBufferPtr _pInitialSquareDiffs;
155  HybridBufferPtr _pMainSquareDiffs;
156  HybridBufferPtr _pFinalSquareDiffs;
157  HybridBufferPtr _pCurSquareDiffs;
158 
159  FragHybridBufferPtr _pInitialAvgXSquareDiffs;
160  FragHybridBufferPtr _pMainAvgXSquareDiffs;
161  FragHybridBufferPtr _pFinalAvgXSquareDiffs;
162  FragHybridBufferPtr _pCurAvgXSquareDiffs;
163 
164  FragHybridBufferPtr _pInitialAvgXYSquareDiffs;
165  FragHybridBufferPtr _pMainAvgXYSquareDiffs;
166  FragHybridBufferPtr _pFinalAvgXYSquareDiffs;
167  FragHybridBufferPtr _pCurAvgXYSquareDiffs;
168 
169  HybridBufferPtr _pInitialAvgXYZSquareDiffs;
170  HybridBufferPtr _pMainAvgXYZSquareDiffs;
171  HybridBufferPtr _pFinalAvgXYZSquareDiffs;
172  HybridBufferPtr _pCurAvgXYZSquareDiffs;
173 
174  processor::eProcessingPhasis _curProcessingPhasis;
175  ipUInt64 _curRowIdx;
176  ipUInt64 _curPlanIdx;
177 
178  ipUInt64 _nbInitialData;
179  ipUInt64 _nbMainData;
180  ipUInt64 _nbFinalData;
181  ipUInt64 _nbRealFinalData;
182  ipUInt64 _nbCurData;
183  ipUInt64 _nbRealCurData;
185 };
186 
189 
190 } // end of namespace filter
191 } // end of namespace imaproc
192 } // end of namespace ipsdk
193 
194 #endif // __IPSDKIPLFILTERING_PATCHBASEDBILATERAL3DIMGLVL3_H__
#define IPSDK_DECLARE_ALGORITHM_NOPARSED_DATA()
boost::shared_ptr< FragHybridBuffer > FragHybridBufferPtr
uint64_t ipUInt64
int32_t ipInt32
STL namespace.
eInstructionSet
#define IPSDK_DECLARE_PROCESSING_ALGORITHM(libraryName, algoName, RuleString, attributeSeq)
#define IPSDK_DECLARE_ALGORITHM_FUNCTION_SELECTOR(dataTypeSeq)
boost::shared_ptr< HybridBuffer > HybridBufferPtr
int64_t ipInt64
Definition of import/export macro for library.
eProcessingPhasis