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

SCM Repository

[diderot] Diff of /trunk/test/probe/probe.cl
ViewVC logotype

Diff of /trunk/test/probe/probe.cl

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

revision 276, Wed Aug 11 21:19:44 2010 UTC revision 277, Wed Aug 11 21:33:44 2010 UTC
# Line 19  Line 19 
19          float4 f, imgPt,nf,v, hx, hy, hz, h_tx, h_ty, hMult;          float4 f, imgPt,nf,v, hx, hy, hz, h_tx, h_ty, hMult;
20          int4 n1;          int4 n1;
21    
22          float4 d = (float4) (h0[0],h1[0],h2[0],h3[0]);          float4 d = (float4) (h3[0],h2[0],h1[0],h0[0]);
23          float4 c = (float4) (h0[1],h1[1],h2[1],h3[1]);          float4 c = (float4) (h3[1],h2[1],h1[1],h0[1]);
24          float4 b = (float4) (h0[2],h1[2],h2[2],h3[2]);          float4 b = (float4) (h3[2],h2[2],h1[2],h0[2]);
25          float4 a = (float4) (h0[3],h1[3],h2[3],h3[3]);          float4 a = (float4) (h3[3],h2[3],h1[3],h0[3]);
26    
27          // Transform the value to image space position.          // Transform the value to image space position.
28         imgPt = (float4) (dot(pos,transformMatrix.s0123),         imgPt = (float4) (dot(pos,transformMatrix.s0123),
# Line 35  Line 35 
35          f = imgPt - nf;          f = imgPt - nf;
36          n1 = convert_int4(nf);          n1 = convert_int4(nf);
37    
38          /* //Debugging          float4 t;
39          if(location == 1)          int s = 2;
40          {  
41              printf("\n============\nImage Point: (%f, %f, %f)\n",imgPt.x,imgPt.y,imgPt.z);          t = (float4) (f.x + 1, f.x, f.x -1, f.x - 2);
42              printf("N: (%d,%d,%d,%d)\n",n1.x,n1.y,n1.z,n1.w);          hx = a + t * (b + t * (c + t*d));
43              printf("f: (%f,%f,%f,%f)\n",f.x,f.y,f.z,f.w);          t = (float4) (f.y + 1, f.y, f.y - 1, f.y - 2);
44            hy = a + t * (b + t * (c + t*d));
45            t = (float4) (f.z + 1, f.z, f.z - 1, f.z -2);
46            hz = a + t * (b + t * (c + t*d));
47    
48            float vy[4], vz[4];
49    
50            for(int i = 1-s; i <= s; i++) {
51             for(int j = 1-s;  j <= s; j++) {
52                float4 v = (float4) (
53                         img[ (n1.x+i) * ySize * zSize + (n1.y+j) * zSize + n1.z-1],
54                         img[ (n1.x+i) * ySize * zSize + (n1.y+j) * zSize + n1.z],
55                         img[ (n1.x+i) * ySize * zSize + (n1.y+j) * zSize + n1.z+1],
56                         img[ (n1.x+i) * ySize * zSize + (n1.y+j) * zSize + n1.z+2]);
57                vz[j+s-1] += dot(v,hz);
58             }
59                    vy[i+s-1] = dot ((float4) (vz[0],vz[1],vz[2],vz[3]),hy);
60          }          }
61          */  
62            probedVal = dot((float4) (vy[0],vy[1],vy[2],vy[3]),hx);
63    
64            printf("Probed @Pos(%.2f,%.2f,%.2f): %f\n",pos.x,pos.y,pos.z,probedVal);
65    
66            out[location] = probedVal;
67    
68            /*** ===== Previous Verison ======
69    
70          // the t value for h(fx - i)          // the t value for h(fx - i)
71          float4 t_i = (float4) (f.x + 1.0, f.x, f.x - 1.0, f.x - 2.0);          float4 t_i = (float4) (f.x + 1.0, f.x, f.x - 1.0, f.x - 2.0);
# Line 53  Line 76 
76          float4 t_k = (float4) (f.z + 1.0, f.z, f.z - 1.0, f.z - 2.0);          float4 t_k = (float4) (f.z + 1.0, f.z, f.z - 1.0, f.z - 2.0);
77          float4 h_k = d + t_k * (c + t_k * (b + t_k * a));          float4 h_k = d + t_k * (c + t_k * (b + t_k * a));
78          float tx[4], ty[4];          float tx[4], ty[4];
79    
80          for (int i = -1;  i <= 2;  i++) {          for (int i = -1;  i <= 2;  i++) {
81                  for (int j = -1;  j <= 2;  j++) {                  for (int j = -1;  j <= 2;  j++) {
82                      // compute z axis using vectors                      // compute z axis using vectors
# Line 68  Line 92 
92          }          }
93          probedVal = dot((float4)(tx[0],tx[1],tx[2],tx[3]), d + t_i * (c + t_i * (b + t_i * a)));          probedVal = dot((float4)(tx[0],tx[1],tx[2],tx[3]), d + t_i * (c + t_i * (b + t_i * a)));
94    
95          out[location] = probedVal;          === End of Previous Verison === */
96    
97  }  }

Legend:
Removed from v.276  
changed lines
  Added in v.277

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