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

template<class ArrayT, class ValT>
void Impala::Core::Array::Pattern::PxFuncBorderPropagateNormalized2d ( ArrayT *  a,
int  numX,
int  numY,
ValT  normLeft,
ValT  normRight,
ValT  normTop,
ValT  normBottom 
)

Definition at line 178 of file PxFuncBorderOp.h.

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

Referenced by PatSetBorder().

00181 {
00182     typedef typename ArrayT::StorType StorT;
00183     typedef typename ArrayT::ArithType ArithT;
00184 
00185     int cw = ArrayCW(a);
00186     int ch = ArrayCH(a);
00187     int x, y;
00188 
00189     if (numX > 0) {
00190 
00191         PxBorderExchange(a, YZ_PLANE, numX);
00192 
00193         // Propagate and normalize left part
00194 
00195         if (PxIsLeftCPU(PxMyCPU())) {
00196             for (y=0 ; y<ch ; y++) {
00197                 StorT* srcPtr = ArrayCPB(a, 0, y);
00198                 StorT* dstPtr = ArrayCPB(a, -numX, y);
00199                 ArithT v = PtrRead(srcPtr, ArithT()) *
00200                            Element::E1Cast(normLeft, ArithT());
00201                 for (x=0 ; x<numX ; x++) {
00202                     PtrWrite(dstPtr, v);
00203                     dstPtr += ArrayT::ElemSize();
00204                 }
00205             }
00206         }
00207 
00208         // Propagate right part (normalization in recursive operation)
00209 
00210         if (PxIsRightCPU(PxMyCPU())) {
00211             for (y=0 ; y<ch ; y++) {
00212                 StorT* srcPtr = ArrayCPB(a, cw - 1, y);
00213                 StorT* dstPtr = ArrayCPB(a, cw, y);
00214                 ArithT v = PtrRead(srcPtr, ArithT());
00215                 for (x=0 ; x<numX ; x++) {
00216                     PtrWrite(dstPtr, v);
00217                     dstPtr += ArrayT::ElemSize();
00218                 }
00219             }
00220         }
00221     }
00222 
00223     if (numY > 0) {
00224 
00225         PxBorderExchange(a, XZ_PLANE, numY);
00226 
00227         // Propagate & normalize top part incl. left and right "corners"
00228 
00229         int totalWidth = cw + 2*numX;
00230 
00231         if (PxIsTopCPU(PxMyCPU())) {
00232             for (y=0 ; y<numY ; y++) {
00233                 StorT* srcPtr = ArrayCPB(a, -numX, 0);
00234                 StorT* dstPtr = ArrayCPB(a, -numX, -numY + y);
00235                 ArithT nT = Element::E1Cast(normTop, ArithT());
00236                 for (x=0 ; x<totalWidth ; x++) {
00237                     PtrWrite(dstPtr, PtrRead(srcPtr, ArithT())*nT);
00238                     srcPtr += ArrayT::ElemSize();
00239                     dstPtr += ArrayT::ElemSize();
00240                 }
00241             }
00242         }
00243 
00244         // Propagate bottom part incl. left and right "corners"
00245 
00246         if (PxIsBottomCPU(PxMyCPU())) {
00247             for (y=0 ; y<numY ; y++) {
00248                 StorT* srcPtr = ArrayCPB(a, -numX, ch - 1);
00249                 StorT* dstPtr = ArrayCPB(a, -numX, ch + y);
00250                 ArithT nB = Element::E1Cast(1, ArithT());
00251                 for (x=0 ; x<totalWidth ; x++) {
00252                     PtrWrite(dstPtr, PtrRead(srcPtr, ArithT())*nB);
00253                     srcPtr += ArrayT::ElemSize();
00254                     dstPtr += ArrayT::ElemSize();
00255                 }
00256             }
00257         }
00258     }
00259 }

Here is the call graph for this function:


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