diff options
author | Alexander Harkness <bearbin@gmail.com> | 2013-11-16 19:37:43 +0100 |
---|---|---|
committer | Alexander Harkness <bearbin@gmail.com> | 2013-11-16 19:37:43 +0100 |
commit | d3360051b160cb67115fa0f1d6a9be9424489529 (patch) | |
tree | 76a0081b2a265c7396eace2f052b0b0c44c1cad8 /source/LinearUpscale.h | |
parent | Fixed another unsigned integer comparison. (diff) | |
download | cuberite-d3360051b160cb67115fa0f1d6a9be9424489529.tar cuberite-d3360051b160cb67115fa0f1d6a9be9424489529.tar.gz cuberite-d3360051b160cb67115fa0f1d6a9be9424489529.tar.bz2 cuberite-d3360051b160cb67115fa0f1d6a9be9424489529.tar.lz cuberite-d3360051b160cb67115fa0f1d6a9be9424489529.tar.xz cuberite-d3360051b160cb67115fa0f1d6a9be9424489529.tar.zst cuberite-d3360051b160cb67115fa0f1d6a9be9424489529.zip |
Diffstat (limited to '')
-rw-r--r-- | source/LinearUpscale.h | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/source/LinearUpscale.h b/source/LinearUpscale.h index b7ac84c6a..b337b3219 100644 --- a/source/LinearUpscale.h +++ b/source/LinearUpscale.h @@ -31,7 +31,7 @@ Linearly interpolates values in the array between the equidistant anchor points Works in-place (input is already present at the correct output coords) */ template<typename TYPE> void LinearUpscale2DArrayInPlace( - TYPE * a_Array, + TYPE * a_Array, int a_SizeX, int a_SizeY, // Dimensions of the array int a_AnchorStepX, int a_AnchorStepY // Distances between the anchor points in each direction ) @@ -53,7 +53,7 @@ template<typename TYPE> void LinearUpscale2DArrayInPlace( Idx += a_AnchorStepX; } // for x } // for y - + // Now interpolate in rows, each row has values in the anchor columns int LastXCell = a_SizeX - a_AnchorStepX; for (int y = 0; y < a_SizeY; y++) @@ -92,7 +92,7 @@ template<typename TYPE> void LinearUpscale2DArray( // Feel free to enlarge them if needed, but keep in mind that they're on the stack const int MAX_UPSCALE_X = 128; const int MAX_UPSCALE_Y = 128; - + ASSERT(a_Src != NULL); ASSERT(a_Dst != NULL); ASSERT(a_SrcSizeX > 0); @@ -101,7 +101,7 @@ template<typename TYPE> void LinearUpscale2DArray( ASSERT(a_UpscaleY > 0); ASSERT(a_UpscaleX <= MAX_UPSCALE_X); ASSERT(a_UpscaleY <= MAX_UPSCALE_Y); - + // Pre-calculate the upscaling ratios: TYPE RatioX[MAX_UPSCALE_X]; TYPE RatioY[MAX_UPSCALE_Y]; @@ -113,7 +113,7 @@ template<typename TYPE> void LinearUpscale2DArray( { RatioY[y] = (TYPE)y / a_UpscaleY; } - + // Interpolate each XY cell: int DstSizeX = (a_SrcSizeX - 1) * a_UpscaleX + 1; int DstSizeY = (a_SrcSizeY - 1) * a_UpscaleY + 1; @@ -163,7 +163,7 @@ template<typename TYPE> void LinearUpscale3DArray( const int MAX_UPSCALE_X = 128; const int MAX_UPSCALE_Y = 128; const int MAX_UPSCALE_Z = 128; - + ASSERT(a_Src != NULL); ASSERT(a_Dst != NULL); ASSERT(a_SrcSizeX > 0); @@ -175,11 +175,11 @@ template<typename TYPE> void LinearUpscale3DArray( ASSERT(a_UpscaleX <= MAX_UPSCALE_X); ASSERT(a_UpscaleY <= MAX_UPSCALE_Y); ASSERT(a_UpscaleZ <= MAX_UPSCALE_Z); - + // Pre-calculate the upscaling ratios: TYPE RatioX[MAX_UPSCALE_X]; TYPE RatioY[MAX_UPSCALE_Y]; - TYPE RatioZ[MAX_UPSCALE_Y]; + TYPE RatioZ[MAX_UPSCALE_Z]; for (int x = 0; x <= a_UpscaleX; x++) { RatioX[x] = (TYPE)x / a_UpscaleX; @@ -192,7 +192,7 @@ template<typename TYPE> void LinearUpscale3DArray( { RatioZ[z] = (TYPE)z / a_UpscaleZ; } - + // Interpolate each XYZ cell: int DstSizeX = (a_SrcSizeX - 1) * a_UpscaleX + 1; int DstSizeY = (a_SrcSizeY - 1) * a_UpscaleY + 1; |