Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Diff of /trunk/doc/probe/paper.tex
ViewVC logotype

Diff of /trunk/doc/probe/paper.tex

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 313, Tue Aug 17 20:38:44 2010 UTC revision 314, Tue Aug 17 21:49:25 2010 UTC
# Line 91  Line 91 
91  Note that the coordinate system of the convolution filter is flipped (negated) from the coordinate system  Note that the coordinate system of the convolution filter is flipped (negated) from the coordinate system
92  of the image; this property is why we evaluate $h(f-i)$ for $V(n+i)$.  of the image; this property is why we evaluate $h(f-i)$ for $V(n+i)$.
93  The convolution $h$ is represented as a symmetric piecewise polynomial formed  The convolution $h$ is represented as a symmetric piecewise polynomial formed
94  from $2s$ polynomials $h_1,\,\ldots,\,h_{2s}$.  from $2s$ polynomials $h_0,\,\ldots,\,h_{2s-1}$.
95  \begin{displaymath}  \begin{displaymath}
96    h(x) = \left\{\begin{array}{ll}    h(x) = \left\{\begin{array}{ll}
97      0 & \text{$x \leq -s$ or $s \leq x$} \\      0 & \text{$x \leq -s$ or $s \leq x$} \\
# Line 196  Line 196 
196    \vecf & = & \vecx - \vecn \qquad \text{\textit{fractional part of position}} \\    \vecf & = & \vecx - \vecn \qquad \text{\textit{fractional part of position}} \\
197    F\mkw{@}\vecp & = & \sum_{i=1-s}^s {\sum_{j=1-s}^s {\sum_{k=1-s}^s {V(\vecn+\VEC{i,j,k}) h(\vecf_x - i) h(\vecf_y - j) h(\vecf_z - k)}}}    F\mkw{@}\vecp & = & \sum_{i=1-s}^s {\sum_{j=1-s}^s {\sum_{k=1-s}^s {V(\vecn+\VEC{i,j,k}) h(\vecf_x - i) h(\vecf_y - j) h(\vecf_z - k)}}}
198  \end{eqnarray*}%  \end{eqnarray*}%
199  We can restructure this equation to highlight the loop-invariant computations.  We can restructure this equation to highlight the loop-invariant computations.\footnote{
200      This restructuring assumes that the $Z$-axis of the data is the ``fastest.''
201    }
202  \begin{displaymath}  \begin{displaymath}
203    F\mkw{@}\vecp =    F\mkw{@}\vecp =
204      \sum_{i=1-s}^s \left({      \sum_{i=1-s}^s \left({
# Line 267  Line 269 
269  \lstset{language=OpenCL}  \lstset{language=OpenCL}
270  \begin{lstlisting}  \begin{lstlisting}
271  double V[][][];         // image data  double V[][][];         // image data
272  double h[4][4];         // kernel  double4 a, b, c, d;     // kernel coefficients
273  const int s = 2;        // kernel support  const int s = 2;        // kernel support
274    
275  double probe (double4 p)  double probe (double4 p)
# Line 313  Line 315 
315  We next consider the case of probing the derivative of a scalar field $F = V\circledast{}h$, where $s$ is the support  We next consider the case of probing the derivative of a scalar field $F = V\circledast{}h$, where $s$ is the support
316  of $h$.  of $h$.
317  The probe $(\nabla F)\mkw{@}\vecp$ produces a vector result as follows:  The probe $(\nabla F)\mkw{@}\vecp$ produces a vector result as follows:
318    \begin{displaymath}
319      (\nabla F)\mkw{@}\vecp  =  \left[\begin{array}{c}
320        \sum_{i=1-s}^s {\sum_{j=1-s}^s {\sum_{k=1-s}^s {V(\vecn+\VEC{i,j,k}) h(\vecf_z - k)  h(\vecf_y - j)  h'(\vecf_x - i)}}} \\
321        \sum_{i=1-s}^s {\sum_{j=1-s}^s {\sum_{k=1-s}^s {V(\vecn+\VEC{i,j,k}) h(\vecf_z - k)  h'(\vecf_y - j) h(\vecf_x - i)}}} \\
322        \sum_{i=1-s}^s {\sum_{j=1-s}^s {\sum_{k=1-s}^s {V(\vecn+\VEC{i,j,k}) h'(\vecf_z - k) h(\vecf_y - j)  h(\vecf_x - i)}}} \\
323      \end{array}\right]
324    \end{displaymath}%
325    where
326  \begin{eqnarray*}  \begin{eqnarray*}
327    \vecx & = & \matM^{-1} \vecp \qquad \text{\textit{transform to image space}} \\    \vecx & = & \matM^{-1} \vecp \qquad \text{\textit{transform to image space}} \\
328    \vecn & = & \FLOOR{\vecx} \qquad \text{\textit{integer part of position}} \\    \vecn & = & \FLOOR{\vecx} \qquad \text{\textit{integer part of position}} \\
329    \vecf & = & \vecx - \vecn \qquad \text{\textit{fractional part of position}} \\    \vecf & = & \vecx - \vecn \qquad \text{\textit{fractional part of position}}
   (\nabla F)\mkw{@}\vecp & = & \left[\begin{array}{c}  
     \sum_{i=1-s}^s {\sum_{j=1-s}^s {\sum_{k=1-s}^s {V(\vecn+\VEC{i,j,k}) h'(\vecf_x - i) h(\vecf_y - j) h(\vecf_z - k)}}} \\  
     \sum_{i=1-s}^s {\sum_{j=1-s}^s {\sum_{k=1-s}^s {V(\vecn+\VEC{i,j,k}) h(\vecf_x - i) h'(\vecf_y - j) h(\vecf_z - k)}}} \\  
     \sum_{i=1-s}^s {\sum_{j=1-s}^s {\sum_{k=1-s}^s {V(\vecn+\VEC{i,j,k}) h(\vecf_x - i) h(\vecf_y - j) h'(\vecf_z - k)}}} \\  
   \end{array}\right]  
330  \end{eqnarray*}%  \end{eqnarray*}%
331    
332  \begin{figure}[p]  \begin{figure}[p]
# Line 334  Line 339 
339    double nxd, nyd, nzd, fx, fy, fz;    double nxd, nyd, nzd, fx, fy, fz;
340    int nx, ny, nz;    int nx, ny, nz;
341    
342    fx = modf (x[0], &nxd); nx = (int)nxd;  fy = modf (x[1], &nyd); ny = (int)nyd;  fz = modf (x[2], &nzd); nz = (int)nzd;    fx = modf (x[0], &nxd); nx = (int)nxd;
343      fy = modf (x[1], &nyd); ny = (int)nyd;
344      fz = modf (x[2], &nzd); nz = (int)nzd;
345    
346    // compute kernel values for each axis    // compute kernel values for each axis
347    double hx[4], dhx[4], hy[4], dhy[4], hz[4], dhz[4];    double hx[4], dhx[4], hy[4], dhy[4], hz[4], dhz[4];

Legend:
Removed from v.313  
changed lines
  Added in v.314

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0