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

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

Definition at line 143 of file FuncBorderOp.h.

References ArrayCH(), ArrayCPB(), ArrayCW(), Impala::Core::Array::Element::E1Cast(), PtrRead(), and PtrWrite().

Referenced by PatSetBorder().

00145 {
00146     typedef typename ArrayT::StorType StorT;
00147     typedef typename ArrayT::ArithType ArithT;
00148 
00149     Int64 cw = ArrayCW(a);
00150     Int64 ch = ArrayCH(a);
00151     Int64 x, y;
00152 
00153     if (numX > 0)
00154     {
00155         // propagate and normalize left and right part
00156         for (y=0 ; y<ch ; y++)
00157         {
00158             StorT* srcPtr = ArrayCPB(a, 0, y);
00159             ArithT v = PtrRead(srcPtr, ArithT()) * Element::E1Cast(normLeft, ArithT());
00160             StorT* dstPtr = ArrayCPB(a, -numX, y);
00161             for (x=0 ; x<numX ; x++)
00162             {
00163                 PtrWrite(dstPtr, v);
00164                 dstPtr += ArrayT::ElemSize();
00165             }
00166 
00167             srcPtr = ArrayCPB(a, cw - 1, y);
00168             //v = PtrRead(srcPtr, ArithT()) * E1Cast(normLeft, ArithT());
00169             // normalization right part is done by the recursive operation itself
00170             v = PtrRead(srcPtr, ArithT());
00171             dstPtr = ArrayCPB(a, cw, y);
00172             for (x=0 ; x<numX ; x++)
00173             {
00174                 PtrWrite(dstPtr, v);
00175                 dstPtr += ArrayT::ElemSize();
00176             }
00177         }
00178     }
00179 
00180     if (numY > 0)
00181     {
00182         // propagate and normalize top and bottom part including left and
00183         // right "corners"
00184         Int64 totalWidth = cw + 2*numX;
00185         for (y=0 ; y<numY ; y++)
00186         {
00187             StorT* srcPtr = ArrayCPB(a, -numX, 0);
00188             StorT* dstPtr = ArrayCPB(a, -numX, -numY + y);
00189             ArithT nT = Element::E1Cast(normTop, ArithT());
00190             for (x=0 ; x<totalWidth ; x++)
00191             {
00192                 PtrWrite(dstPtr, PtrRead(srcPtr, ArithT()) * nT);
00193                 srcPtr += ArrayT::ElemSize();
00194                 dstPtr += ArrayT::ElemSize();
00195             }
00196 
00197             srcPtr = ArrayCPB(a, -numX, ch - 1);
00198             dstPtr = ArrayCPB(a, -numX, ch + y);
00199             //ArithT nB = E1Cast(normBottom, ArithT());
00200             // normalization bottom part is done by the recursive operation itself
00201             ArithT nB = Element::E1Cast(1, ArithT());
00202             for (x=0 ; x<totalWidth ; x++)
00203             {
00204                 PtrWrite(dstPtr, PtrRead(srcPtr, ArithT()) * nB);
00205                 srcPtr += ArrayT::ElemSize();
00206                 dstPtr += ArrayT::ElemSize();
00207             }
00208         }
00209     }
00210 }

Here is the call graph for this function:


Generated on Fri Mar 19 11:00:57 2010 for ImpalaSrc by  doxygen 1.5.1