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

template<class ArrayT, class ValT>
void Impala::Core::Array::Pattern::PxFuncBorderConstant2d ( ArrayT *  a,
int  numX,
int  numY,
ValT  value 
)

Definition at line 104 of file PxFuncBorderOp.h.

References ArrayCH(), ArrayCPB(), ArrayCW(), Impala::Core::Array::Element::E1Cast(), PtrWrite(), PxBorderExchange(), PxIsBottomCPU(), PxIsLeftCPU(), PxIsRightCPU(), PxIsTopCPU(), PxMyCPU(), XZ_PLANE, and YZ_PLANE.

Referenced by PatSetBorder().

00105 {
00106     typedef typename ArrayT::StorType StorT;
00107     typedef typename ArrayT::ArithType ArithT;
00108 
00109     int cw = ArrayCW(a);
00110     int ch = ArrayCH(a);
00111     int x, y;
00112     ArithT v = Element::E1Cast(value, ArithT());
00113 
00114     if (numX > 0) {
00115 
00116         PxBorderExchange(a, YZ_PLANE, numX);
00117 
00118         // Set left part NOT including upper and lower "corners"
00119 
00120         if (PxIsLeftCPU(PxMyCPU())) {
00121             for (y=0 ; y<ch ; y++) {
00122                 StorT* dstPtr = ArrayCPB(a, -numX, y);
00123                 for (x=0 ; x<numX ; x++) {
00124                     PtrWrite(dstPtr, v);
00125                     dstPtr += ArrayT::ElemSize();
00126                 }
00127             }
00128         }
00129 
00130         // Set right part NOT including upper and lower "corners"
00131 
00132         if (PxIsRightCPU(PxMyCPU())) {
00133             for (y=0 ; y<ch ; y++) {
00134                 StorT* dstPtr = ArrayCPB(a, cw, y);
00135                 for (x=0 ; x<numX ; x++) {
00136                     PtrWrite(dstPtr, v);
00137                     dstPtr += ArrayT::ElemSize();
00138                 }
00139             }
00140         }
00141     }
00142 
00143     if (numY > 0) {
00144 
00145         PxBorderExchange(a, XZ_PLANE, numY);
00146 
00147         // Set top part including left and right "corners"
00148 
00149         int totalWidth = cw + 2*numX;
00150 
00151         if (PxIsTopCPU(PxMyCPU())) {
00152             for (y=0 ; y<numY ; y++) {
00153                 StorT* dstPtr = ArrayCPB(a, -numX, -numY + y);
00154                 for (x=0 ; x<totalWidth ; x++) {
00155                     PtrWrite(dstPtr, v);
00156                     dstPtr += ArrayT::ElemSize();
00157                 }
00158             }
00159         }
00160 
00161         // Set bottom part including left and right "corners"
00162 
00163         if (PxIsBottomCPU(PxMyCPU())) {
00164             for (y=0 ; y<numY ; y++) {
00165                 StorT* dstPtr = ArrayCPB(a, -numX, ch + y);
00166                 for (x=0 ; x<totalWidth ; x++) {
00167                     PtrWrite(dstPtr, v);
00168                     dstPtr += ArrayT::ElemSize();
00169                 }
00170             }
00171         }
00172     }
00173 }

Here is the call graph for this function:


Generated on Fri Mar 19 11:02:51 2010 for ImpalaSrc by  doxygen 1.5.1