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

SCM Repository

[diderot] Diff of /branches/vis15/src/compiler/high-to-mid/coord-space-transform.sml
ViewVC logotype

Diff of /branches/vis15/src/compiler/high-to-mid/coord-space-transform.sml

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

revision 3732, Thu Apr 7 20:56:16 2016 UTC revision 3734, Thu Apr 7 22:06:42 2016 UTC
# Line 17  Line 17 
17     * assignments that computes the world-space to -image-space transformation.     * assignments that computes the world-space to -image-space transformation.
18     *)     *)
19      val worldToImage : {      val worldToImage : {
20              avail : AvailRHS.avail,              avail : AvailRHS.t,
21              info : ImageInfo.info,      (* the image info for the image *)              info : ImageInfo.info,      (* the image info for the image *)
22              img : MidIR.var,            (* the variable bound to the image *)              img : MidIR.var,            (* the variable bound to the image *)
23              pos : MidIR.var             (* the variable bound to the world-space position *)              pos : MidIR.var             (* the variable bound to the world-space position *)
24            } -> MidIR.var * MidIR.var            } -> MidIR.var * MidIR.var
25    
26      val worldToIndex : {      val worldToIndex : {
27              avail : AvailRHS.avail,              avail : AvailRHS.t,
28              info : ImageInfo.info,      (* the image info for the image *)              info : ImageInfo.info,      (* the image info for the image *)
29              img : MidIR.var,            (* the variable bound to the image *)              img : MidIR.var,            (* the variable bound to the image *)
30              pos : MidIR.var             (* the variable bound to the world-space position *)              pos : MidIR.var             (* the variable bound to the world-space position *)
# Line 61  Line 61 
61            val (_, fty, pty) = getTys dim            val (_, fty, pty) = getTys dim
62            val mty = Ty.TensorTy pty            val mty = Ty.TensorTy pty
63            val rty = Ty.TensorTy fty            val rty = Ty.TensorTy fty
64            val M = Avail.addAssign (avail, "M", mty, IR.OP(Op.Transform info, [img]))            val M = AvailRHS.addAssign (avail, "M", mty, IR.OP(Op.Transform info, [img]))
65            val T = Avail.addAssign (avail, "T", rty, IR.OP(Op.Translate info, [img]))            val T = AvailRHS.addAssign (avail, "T", rty, IR.OP(Op.Translate info, [img]))
66            val (mulOp, addOp) = if (dim = 1)            val (mulOp, addOp) = if (dim = 1)
67                  then (Mk.mulRR, Mk.addRR)                  then (Mk.mulRR, Mk.addRR)
68                  else (Mk.innerTT([dim, dim], [dim]), Mk.addTT[dim])                  else (Mk.innerTT([dim, dim], [dim]), Mk.addTT[dim])
69            val x0 = Avail.addAssign (avail, "x0", rty, IR.OP(mulOp, [M, pos]))            (*Image-Space position*)            val x0 = AvailRHS.addAssign (avail, "x0", rty, IR.EINAPP(mulOp, [M, pos]))    (*Image-Space position*)
70            val x = Avail.addAssign (avail, "x", rty, IR.OP(addOp, [x0, T]))            val x = AvailRHS.addAssign (avail, "x", rty, IR.EINAPP(addOp, [x0, T]))
71            in            in
72              (M, x)              (M, x)
73            end            end
# Line 82  Line 82 
82            val mty = Ty.TensorTy  pty            val mty = Ty.TensorTy  pty
83            val rty = Ty.TensorTy fty            val rty = Ty.TensorTy fty
84            val (M, x) = worldToImage arg            val (M, x) = worldToImage arg
85            val nd = Avail.addAssign (avail, "nd", rty, IR.OP(Op.Floor dim, [x]))         (* real position *)            val nd = AvailRHS.addAssign (avail, "nd", rty, IR.OP(Op.Floor dim, [x]))      (* real position *)
86            val f = Avail.addAssign (avail, "f", rty, IR.OP(Mk.subTT fty, [x, nd]))       (* fractional *)            val f = AvailRHS.addAssign (avail, "f", rty, IR.EINAPP(Mk.subTT fty, [x, nd])) (* fractional *)
87            val n = Avail.addAssign (avail, "n", ity, IR.OP(Op.RealToInt dim, [nd]))      (* integer position *)            val n = AvailRHS.addAssign (avail, "n", ity, IR.OP(Op.RealToInt dim, [nd]))   (* integer position *)
88            val P = if (dim = 1)            val P = if (dim = 1)
89                  then M                  then M
90                  else Avail.addAssign (avail, "P", mty, IR.OP(Mk.transposeT pty, [M]))                  else AvailRHS.addAssign (avail, "P", mty, IR.EINAPP(Mk.transposeT pty, [M]))
91            in            in
92              (n, f, P)              (n, f, P)
93            end            end

Legend:
Removed from v.3732  
changed lines
  Added in v.3734

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