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 271, Wed Aug 11 15:47:35 2010 UTC revision 272, Wed Aug 11 15:58:39 2010 UTC
# Line 213  Line 213 
213  double h[4][4];         // kernel  double h[4][4];         // kernel
214  const int s = 2;        // kernel support  const int s = 2;        // kernel support
215    
216  double probe (vec3 pos)  double probe (vec3 p)
217  {  {
218      double x[3] = transform(p);   // image-space position
219    double nx, ny, nz, fx, fy, fz;    double nx, ny, nz, fx, fy, fz;
220    
221    fx = modf (x[0], &nx);    fx = modf (x[0], &nx);
# Line 254  Line 255 
255  \label{fig:3d-probe-code-c}  \label{fig:3d-probe-code-c}
256  \end{figure}  \end{figure}
257    
258    \begin{figure}[p]
259    \begin{quote}
260    \lstset{language=C}
261    \begin{lstlisting}
262    double V[][][];         // image data
263    double h[4][4];         // kernel
264    const int s = 2;        // kernel support
265    
266    double probe (double4 p)
267    {
268      double4 x = transform(p);     // image-space position
269      double4 n, f
270    
271      f = modf (x, &n);
272    
273      // compute kernel values for each axis
274      double4 t, hx, hy, hz;
275      t = (double4)(f.x +1, f.x, f.x - 1, f.x - 2);
276      hx = a + t*(b + t*(c + t*d));
277      t = (double4)(f.y +1, f.y, f.y - 1, f.y - 2);
278      hy = a + t*(b + t*(c + t*d));
279      t = (double4)(f.z +1, f.z, f.z - 1, f.z - 2);
280      hz = a + t*(b + t*(c + t*d));
281    
282      double vx = 0.0
283      for (int i = 1-s;  i < s;  i++) {
284        double vy = 0.0
285        for (int j = 1-s;  j < s;  j++) {
286          double4 v = (double4) (
287              V[nx+i][ny+j][nz-1],
288              V[nx+i][ny+j][nz],
289              V[nx+i][ny+j][nz+1],
290              V[nx+i][ny+j][nz+2]);
291          vy += dot(v, hz) * hy[j+s-1];
292        }
293        vx += vx * hx[i+s-1];
294      }
295    
296      return vx;
297    }
298    \end{lstlisting}%
299    \end{quote}%
300    \caption{Computing $F\mkw{@}\vecx$ for a 3D scalar field in OpenCL}
301    \label{fig:3d-probe-code-opencl}
302    \end{figure}
303    
304  \section{Probing a 3D derivative field}  \section{Probing a 3D derivative field}
305  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
306  of $h$.  of $h$.

Legend:
Removed from v.271  
changed lines
  Added in v.272

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