Home || Architecture || Video Search || Visual Search || Scripts || Applications || Important Messages || OGL || Src

FuncBpo.h

Go to the documentation of this file.
00001 #ifndef Impala_Core_Array_Pattern_FuncBpo_h
00002 #define Impala_Core_Array_Pattern_FuncBpo_h
00003 
00004 #include "Core/Array/Pattern/Categories.h"
00005 #include "Core/Array/Pattern/ArrayFunc.h"
00006 #include "Core/Array/Pattern/PtrFunc.h"
00007 
00008 namespace Impala
00009 {
00010 namespace Core
00011 {
00012 namespace Array
00013 {
00014 namespace Pattern
00015 {
00016 
00017 
00020 template <class DstArrayT, class Src1ArrayT, class Src2ArrayT, class BpoT>
00021 void
00022 FuncBpo(DstArrayT* dst, Src1ArrayT* src1, Src2ArrayT* src2, BpoT& bpo,
00023         TagTransInVar dummy, TagCallPointer dummy2)
00024 {
00025     typedef typename DstArrayT::StorType DstStorT;
00026     typedef typename Src1ArrayT::StorType Src1StorT;
00027     typedef typename Src2ArrayT::StorType Src2StorT;
00028 
00029     int width = ArrayCW(dst);
00030     int height = ArrayCH(dst);
00031     for (int y=0 ; y<height ; y++)
00032     {
00033         Src1StorT* s1Ptr = ArrayCPB(src1, 0, y);
00034         Src2StorT* s2Ptr = ArrayCPB(src2, 0, y);
00035         DstStorT* dPtr = ArrayCPB(dst, 0, y);
00036         for (int x=0 ; x<width ; x++)
00037         {
00038             bpo.DoIt(dPtr, s1Ptr, s2Ptr);
00039             dPtr += DstArrayT::ElemSize();
00040             s1Ptr += Src1ArrayT::ElemSize();
00041             s2Ptr += Src2ArrayT::ElemSize();
00042         }
00043     }
00044 }
00045 
00048 template <class DstArrayT, class Src1ArrayT, class Src2ArrayT, class BpoT>
00049 void
00050 FuncBpo(DstArrayT* dst, Src1ArrayT* src1, Src2ArrayT* src2, BpoT& bpo,
00051         TagTransVar dummy, TagCallPointer dummy2)
00052 {
00053     typedef typename DstArrayT::StorType DstStorT;
00054     typedef typename Src1ArrayT::StorType Src1StorT;
00055     typedef typename Src2ArrayT::StorType Src2StorT;
00056 
00057     int width = ArrayCW(dst);
00058     int height = ArrayCH(dst);
00059     for (int y=0 ; y<height ; y++)
00060     {
00061         Src1StorT* s1Ptr = ArrayCPB(src1, 0, y);
00062         Src2StorT* s2Ptr = ArrayCPB(src2, 0, y);
00063         DstStorT* dPtr = ArrayCPB(dst, 0, y);
00064         for (int x=0 ; x<width ; x++) 
00065         {
00066             bpo.DoIt(dPtr, s1Ptr, s2Ptr, x, y);
00067             dPtr += DstArrayT::ElemSize();
00068             s1Ptr += Src1ArrayT::ElemSize();
00069             s2Ptr += Src2ArrayT::ElemSize();
00070         }
00071     }
00072 }
00073 
00076 template <class DstArrayT, class Src1ArrayT, class Src2ArrayT, class BpoT>
00077 void
00078 FuncBpo(DstArrayT* dst, Src1ArrayT* src1, Src2ArrayT* src2, BpoT& bpo,
00079         TagTransInVar dummy, TagCallValue dummy2)
00080 {
00081     typedef typename DstArrayT::StorType DstStorT;
00082     typedef typename DstArrayT::ArithType DstArithT;
00083     typedef typename Src1ArrayT::StorType Src1StorT;
00084     typedef typename Src1ArrayT::ArithType Src1ArithT;
00085     typedef typename Src2ArrayT::StorType Src2StorT;
00086     typedef typename Src2ArrayT::ArithType Src2ArithT;
00087 
00088     int width = ArrayCW(dst);
00089     int height = ArrayCH(dst);
00090     for (int y=0 ; y<height ; y++)
00091     {
00092         Src1StorT* s1Ptr = ArrayCPB(src1, 0, y);
00093         Src2StorT* s2Ptr = ArrayCPB(src2, 0, y);
00094         DstStorT* dPtr = ArrayCPB(dst, 0, y);
00095         for (int x=0 ; x<width ; x++)
00096         {
00097             PtrWrite(dPtr, bpo.DoIt(PtrRead(s1Ptr, Src1ArithT()),
00098                                       PtrRead(s2Ptr, Src2ArithT())));
00099             dPtr += DstArrayT::ElemSize();
00100             s1Ptr += Src1ArrayT::ElemSize();
00101             s2Ptr += Src2ArrayT::ElemSize();
00102         }
00103     }
00104 }
00105 
00108 template <class DstArrayT, class Src1ArrayT, class Src2ArrayT, class BpoT>
00109 void
00110 FuncBpo(DstArrayT* dst, Src1ArrayT* src1, Src2ArrayT* src2, BpoT& bpo,
00111         TagTransVar dummy, TagCallValue dummy2)
00112 {
00113     typedef typename DstArrayT::StorType DstStorT;
00114     typedef typename DstArrayT::ArithType DstArithT;
00115     typedef typename Src1ArrayT::StorType Src1StorT;
00116     typedef typename Src1ArrayT::ArithType Src1ArithT;
00117     typedef typename Src2ArrayT::StorType Src2StorT;
00118     typedef typename Src2ArrayT::ArithType Src2ArithT;
00119 
00120     int width = ArrayCW(dst);
00121     int height = ArrayCH(dst);
00122     for (int y=0 ; y<height ; y++)
00123     {
00124         Src1StorT* s1Ptr = ArrayCPB(src1, 0, y);
00125         Src2StorT* s2Ptr = ArrayCPB(src2, 0, y);
00126         DstStorT* dPtr = ArrayCPB(dst, 0, y);
00127         for (int x=0 ; x<width ; x++)
00128         {
00129             PtrWrite(dPtr, bpo.DoIt(PtrRead(s1Ptr, Src1ArithT()),
00130                                       PtrRead(s2Ptr, Src2ArithT()),x,y));
00131             dPtr += DstArrayT::ElemSize();
00132             s1Ptr += Src1ArrayT::ElemSize();
00133             s2Ptr += Src2ArrayT::ElemSize();
00134         }
00135     }
00136 /* old:
00137     for (int z=0 ; z<dstSize.z() ; z++) {
00138         for (int y=0 ; y<dstSize.y() ; y++) {
00139             for (int x=0 ; x<dstSize.x() ; x++) {
00140                 dstPtr.writeIncX(
00141                     bpo.DoIt(src1Ptr.readIncX(), src2Ptr.readIncX(), x, y, z));
00142             }
00143         }
00144     }
00145 */
00146 }
00147 
00150 template <class DstArrayT, class Src1ArrayT, class Src2ArrayT, class BpoT>
00151 void
00152 FuncBpoDispatch(DstArrayT* dst, Src1ArrayT* src1, Src2ArrayT* src2, BpoT& bpo)
00153 {
00154     FuncBpo(dst, src1, src2, bpo, typename BpoT::TransVarianceCategory(),
00155             typename BpoT::CallCategory());
00156 }
00157 
00158 } // namespace Pattern
00159 } // namespace Array
00160 } // namespace Core
00161 } // namespace Impala
00162 
00163 #endif

Generated on Fri Mar 19 09:30:49 2010 for ImpalaSrc by  doxygen 1.5.1