09.08.2013 Views

Implementing a Fast Cartesian-Polar Matrix Interpolator - MIT

Implementing a Fast Cartesian-Polar Matrix Interpolator - MIT

Implementing a Fast Cartesian-Polar Matrix Interpolator - MIT

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

outperformed the hardware implementation. We attribute this<br />

difference to the superior memory systems of modern general<br />

purpose processors.<br />

A. Improving the Algorithm<br />

As in hardware, using fixed point values for computation<br />

resulted in a substantial speedup. To further improve performance,<br />

we need to reduce the number of trigonometric functions.<br />

This is accomplished by leveraging the sum-to-product<br />

formulas for cosine and sine to derive a fast computation for<br />

generating the sine-cosine pair for one ray from the sine-cosine<br />

pair of the previous ray.<br />

cos(θ + ∆θ) = cos(θ) cos(∆θ) − sin(θ) sin(∆θ)<br />

sin(θ + ∆θ) = sin(θ) cos(∆θ) + sin(θ) cos(∆θ)<br />

Since we scale cosine and sine by dx and dy we need to<br />

rescale sin(∆θ) by dy<br />

dx to obtain the correct results. Our final<br />

single-threaded version can be found in Figure 7.<br />

N1=N-1; RN=R*N1;<br />

dx=((R+1)-(R*cos(theta)))/N1;<br />

dy=((R+1)*sin(theta))/N1;<br />

xoffset=R*cos(theta)/dx;<br />

sin_dt_dy_dx=sin(theta/N1)*dy/dx;<br />

sin_dt_dx_dy=sin(theta/N1)*dx/dy;<br />

cos_dt=cos(theta/N1);<br />

scaledcos_t=(1.0/(R+1 - (R*cos(theta));<br />

scaledsin_t=0.0;<br />

for(t=0;t

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!