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

PatNgbOp2dExtra2.h

Go to the documentation of this file.
00001 #ifndef Impala_Core_Array_Pattern_PatNgbOp2dExtra2_h
00002 #define Impala_Core_Array_Pattern_PatNgbOp2dExtra2_h
00003 
00004 #include "Core/Array/CheckBorderSize.h"
00005 #include "Core/Array/Pattern/PatSetBorder.h"
00006 #include "Core/Array/Pattern/FuncNgbOp2dExtra2.h"
00007 
00008 #ifdef PX_HORUS_USED
00009 #include "Core/Array/Pattern/PxArrayFunc.h"
00010 #include "Core/Array/Pattern/PxStateTrans.h"
00011 #endif
00012 
00013 namespace Impala
00014 {
00015 namespace Core
00016 {
00017 namespace Array
00018 {
00019 namespace Pattern
00020 {
00021 
00022 
00023 template <class DstArrayT, class SrcArrayT, class ExtraArrayT,
00024           class Extra2ArrayT, class NgbT>
00025 inline void
00026 PatNgbOp2dExtra2(DstArrayT*& dst, SrcArrayT* src, ExtraArrayT* xtr,
00027                  Extra2ArrayT* xt2, NgbT& ngb)
00028 {
00029     int numX = ngb.Width() / 2;
00030     int numY = ngb.Height() / 2;
00031     SrcArrayT* checkedSrc = CheckBorderSize(src, numX, numY);
00032     ExtraArrayT* checkedXtr = CheckBorderSize(xtr, numX, numY);
00033     Extra2ArrayT* checkedXt2 = CheckBorderSize(xt2, numX, numY);
00034 
00035     if ((dst == 0) || (dst == (DstArrayT*) checkedSrc))
00036         dst = ArrayClone<DstArrayT>(checkedSrc);
00037 
00038 #ifdef PX_HORUS_USED
00039     if (!PxRunParallel()) {                         // run sequential
00040 #endif
00041         PatSetBorder(checkedSrc, numX, numY);
00042         PatSetBorder(checkedXtr, numX, numY);
00043         PatSetBorder(checkedXt2, numX, numY);
00044         FuncNgbOp2dExtra2Dispatch(dst, checkedSrc,
00045                                   checkedXtr, checkedXt2, ngb);
00046 
00047 #ifdef PX_HORUS_USED
00048     } else {                                        // run parallel
00049         PxArrayPreStateTrans(checkedSrc, PAR_PART, STRONG);
00050         PxArrayPreStateTrans(checkedXtr, PAR_PART, STRONG);
00051         PxArrayPreStateTrans(checkedXt2, PAR_PART, STRONG);
00052         PxArrayPreStateTrans(dst, PAR_PART, WEAK);
00053         PatSetBorder(PxArrayPD(checkedSrc), numX, numY);
00054         PatSetBorder(PxArrayPD(checkedXtr), numX, numY);
00055         PatSetBorder(PxArrayPD(checkedXt2), numX, numY);
00056         FuncNgbOp2dExtra2Dispatch(PxArrayPD(dst),
00057                         PxArrayPD(checkedSrc), PxArrayPD(checkedXtr),
00058                         PxArrayPD(checkedxt2), ngb);
00059         if (PxArrayPD(checkedSrc) != PxArrayPD(src))
00060             PxArrayDeletePD(checkedSrc);
00061         if (PxArrayPD(checkedXtr) != PxArrayPD(xtr))
00062             PxArrayDeletePD(checkedXtr);
00063         if (PxArrayPD(checkedXt2) != PxArrayPD(xt2))
00064             PxArrayDeletePD(checkedXt2);
00065         PxArrayPostStateTrans(dst);
00066 
00067         if (!PxRunLazyParallel()) {
00068             PxArrayForceNonDistributed(src);
00069             PxArrayForceNonDistributed(xtr);
00070             PxArrayForceNonDistributed(xt2);
00071             PxArrayForceNonDistributed(dst);
00072         }
00073     }
00074 #endif
00075 
00076     if (checkedSrc != src)
00077         delete checkedSrc;
00078     if (checkedXtr != xtr)
00079         delete checkedXtr;
00080     if (checkedXt2 != xt2)
00081         delete checkedXt2;
00082 }
00083 
00084 } // namespace Pattern
00085 } // namespace Array
00086 } // namespace Core
00087 } // namespace Impala
00088 
00089 #endif

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