# HG changeset patch # User Tuomo Valkonen # Date 1577475712 -7200 # Node ID 62645d05985aa9eec71e5b292d0f40d2c6cb36ad # Parent 0b25d9ef7af91b719fef833ecbf7e5df15ce9591 Potentially optimise a tuple creation away diff -r 0b25d9ef7af9 -r 62645d05985a src/Translate.jl --- a/src/Translate.jl Fri Dec 27 21:40:33 2019 +0200 +++ b/src/Translate.jl Fri Dec 27 21:41:52 2019 +0200 @@ -35,7 +35,7 @@ # Base interpolation routine ############################# -@inline function interpolate2d_quadrants(v, (x, y)) +@inline function interpolate2d_quadrants(v, x, y) (m, n) = size(v) clipx = xʹ -> max(1, min(xʹ, m)) clipy = yʹ -> max(1, min(yʹ, n)) @@ -101,8 +101,7 @@ Threads.@threads for i=1:size(x, 1) @inbounds for j=1:size(x, 2) - pt = (i - u[1, i, j], j - u[2, i, j]) - x[i, j] = interpolate2d_quadrants(z, pt) + x[i, j] = interpolate2d_quadrants(z, i - u[1, i, j], j - u[2, i, j]) end end end @@ -114,7 +113,7 @@ Threads.@threads for i=1:size(x, 1) @inbounds for j=1:size(x, 2) - x[i, j] = interpolate2d_quadrants(z, (i - a, j - b)) + x[i, j] = interpolate2d_quadrants(z, i - a, j - b) end end end @@ -147,7 +146,7 @@ b[i, 1:py-1] .= 0 b[i, qy+1:by] .= 0 for j=py:qy - b[i, j] = interpolate2d_quadrants(im, (i+vxʹ, j+vyʹ)) + b[i, j] = interpolate2d_quadrants(im, i+vxʹ, j+vyʹ) end end end