diff options
author | Sven Gothel <[email protected]> | 2014-07-03 16:21:36 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-07-03 16:21:36 +0200 |
commit | 556d92b63555a085b25e32b1cd55afce24edd07a (patch) | |
tree | 6be2b02c62a77d5aba81ffbe34c46960608be163 /src/jogl/classes/jogamp/opengl/glu/mipmap/HalveImage.java | |
parent | a90f4a51dffec3247278e3c683ed4462b1dd9ab5 (diff) |
Code Clean-Up based on our Recommended Settings (jogamp-scripting c47bc86ae2ee268a1f38c5580d11f93d7f8d6e74)
- Change non static accesses to static members using declaring type
- Change indirect accesses to static members to direct accesses (accesses through subtypes)
- Add final modifier to private fields
- Add final modifier to method parameters
- Add final modifier to local variables
- Remove unnecessary casts
- Remove unnecessary '$NON-NLS$' tags
- Remove trailing white spaces on all lines
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/glu/mipmap/HalveImage.java')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/glu/mipmap/HalveImage.java | 311 |
1 files changed, 158 insertions, 153 deletions
diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/HalveImage.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/HalveImage.java index 184c5fda8..100c6ba1f 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/HalveImage.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/HalveImage.java @@ -57,8 +57,8 @@ public class HalveImage { private static final int BOX4 = 4; private static final int BOX8 = 8; - public static void halveImage( int components, int width, int height, - ShortBuffer datain, ShortBuffer dataout ) { + public static void halveImage( final int components, final int width, final int height, + final ShortBuffer datain, final ShortBuffer dataout ) { int i, j, k; int newwidth, newheight; int delta; @@ -92,9 +92,9 @@ public class HalveImage { } } - public static void halveImage_ubyte( int components, int width, int height, - ByteBuffer datain, ByteBuffer dataout, - int element_size, int ysize, int group_size ) { + public static void halveImage_ubyte( final int components, final int width, final int height, + final ByteBuffer datain, final ByteBuffer dataout, + final int element_size, final int ysize, final int group_size ) { int i, j, k; int newwidth, newheight; int s; @@ -134,9 +134,9 @@ public class HalveImage { } } - public static void halve1Dimage_ubyte( int components, int width, int height, - ByteBuffer datain, ByteBuffer dataout, - int element_size, int ysize, int group_size ) { + public static void halve1Dimage_ubyte( final int components, final int width, final int height, + final ByteBuffer datain, final ByteBuffer dataout, + final int element_size, final int ysize, final int group_size ) { int halfWidth = width / 2; int halfHeight = height / 2; int src = 0; @@ -170,10 +170,10 @@ public class HalveImage { } src += group_size; // skip to next 2 } - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); src += padBytes; // for assertion only } else if( width == 1 ) { // 1 column - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); assert( height != 1 ); halfWidth = 1; // one vertical column with possible pad bytes per row @@ -203,12 +203,12 @@ public class HalveImage { assert( dest == components * element_size * halfWidth * halfHeight ); } - public static void halveImage_byte( int components, int width, int height, - ByteBuffer datain, ByteBuffer dataout, int element_size, - int ysize, int group_size ) { + public static void halveImage_byte( final int components, final int width, final int height, + final ByteBuffer datain, final ByteBuffer dataout, final int element_size, + final int ysize, final int group_size ) { int i, j, k; int newwidth, newheight; - int s = 0; + final int s = 0; int t = 0; byte temp = (byte)0; @@ -245,9 +245,9 @@ public class HalveImage { } } - public static void halve1Dimage_byte( int components, int width, int height, - ByteBuffer datain, ByteBuffer dataout, - int element_size, int ysize, int group_size ) { + public static void halve1Dimage_byte( final int components, final int width, final int height, + final ByteBuffer datain, final ByteBuffer dataout, + final int element_size, final int ysize, final int group_size ) { int halfWidth = width / 2; int halfHeight = width / 2; int src = 0; @@ -276,10 +276,10 @@ public class HalveImage { } src += group_size; // skip to next 2 } - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); src += padBytes; // for assert only } else if( width == 1 ) { // 1 column - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); assert( height != 1 ); // widthxheight can't be 1 halfWidth = 1; // one vertical column with possible pad bytes per row @@ -304,12 +304,13 @@ public class HalveImage { assert( dest == components * element_size * halfWidth * halfHeight ); } - public static void halveImage_ushort( int components, int width, int height, - ByteBuffer datain, ShortBuffer dataout, int element_size, - int ysize, int group_size, boolean myswap_bytes ) { - int i, j, k, l; + public static void halveImage_ushort( final int components, final int width, final int height, + final ByteBuffer datain, final ShortBuffer dataout, final int element_size, + final int ysize, final int group_size, final boolean myswap_bytes ) { + int i, j, k; + final int l; int newwidth, newheight; - int s = 0; + final int s = 0; int t = 0; int temp = 0; // handle case where there is only 1 column/row @@ -365,9 +366,9 @@ public class HalveImage { } } - public static void halve1Dimage_ushort( int components, int width, int height, - ByteBuffer datain, ShortBuffer dataout, int element_size, - int ysize, int group_size, boolean myswap_bytes ) { + public static void halve1Dimage_ushort( final int components, final int width, final int height, + final ByteBuffer datain, final ShortBuffer dataout, final int element_size, + final int ysize, final int group_size, final boolean myswap_bytes ) { int halfWidth = width / 2; int halfHeight = height / 2; int src = 0; @@ -384,7 +385,7 @@ public class HalveImage { for( jj = 0; jj < halfWidth; jj++ ) { int kk; for( kk = 0; kk < halfHeight; kk++ ) { - int[] ushort = new int[BOX2]; + final int[] ushort = new int[BOX2]; if( myswap_bytes ) { datain.position( src ); ushort[0] = ( 0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ) ); @@ -402,10 +403,10 @@ public class HalveImage { } src += group_size; // skip to next 2 } - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); src += padBytes; // for assertion only } else if( width == 1 ) { // 1 column - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); assert( height != 1 ); // widthxheight can't be 1 halfWidth = 1; // one vertical column with possible pad bytes per row @@ -414,7 +415,7 @@ public class HalveImage { for( jj = 0; jj < halfHeight; jj++ ) { int kk; for( kk = 0; kk < components; kk++ ) { - int[] ushort = new int[BOX2]; + final int[] ushort = new int[BOX2]; if( myswap_bytes ) { datain.position( src ); ushort[0] = ( 0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ) ); @@ -438,12 +439,13 @@ public class HalveImage { assert( dest == components * element_size * halfWidth * halfHeight ); } - public static void halveImage_short( int components, int width, int height, - ByteBuffer datain, ShortBuffer dataout, int element_size, - int ysize, int group_size, boolean myswap_bytes ) { - int i, j, k, l; + public static void halveImage_short( final int components, final int width, final int height, + final ByteBuffer datain, final ShortBuffer dataout, final int element_size, + final int ysize, final int group_size, final boolean myswap_bytes ) { + int i, j, k; + final int l; int newwidth, newheight; - int s = 0; + final int s = 0; int t = 0; short temp = (short)0; // handle case where there is only 1 column/row @@ -472,7 +474,7 @@ public class HalveImage { temp += datain.getShort(); temp += 2; temp /= 4; - dataout.put( (short)temp ); + dataout.put( temp ); t += element_size; } t += group_size; @@ -483,8 +485,8 @@ public class HalveImage { for( i = 0; i < newheight; i++ ) { for( j = 0; j < newwidth; j++ ) { for( k = 0; k < components; k++ ) { - short b; - int buf; + final short b; + final int buf; datain.position( t ); temp = Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ); datain.position( t + group_size ); @@ -505,9 +507,9 @@ public class HalveImage { } } - public static void halve1Dimage_short( int components, int width, int height, - ByteBuffer datain, ShortBuffer dataout, int element_size, int ysize, - int group_size, boolean myswap_bytes ) { + public static void halve1Dimage_short( final int components, final int width, final int height, + final ByteBuffer datain, final ShortBuffer dataout, final int element_size, final int ysize, + final int group_size, final boolean myswap_bytes ) { int halfWidth = width / 2; int halfHeight = height / 2; int src = 0; @@ -524,7 +526,7 @@ public class HalveImage { for( jj = 0; jj < halfWidth; jj++ ) { int kk; for( kk = 0; kk < components; kk++ ) { - short[] sshort = new short[BOX2]; + final short[] sshort = new short[BOX2]; if( myswap_bytes ) { datain.position( src ); sshort[0] = Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ); @@ -542,10 +544,10 @@ public class HalveImage { } src += group_size; // skip to next 2 } - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); src += padBytes; // for assertion only } else if( width == 1 ) { - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); assert( height != 1 ); halfWidth = 1; // one vertical column with possible pad bytes per row @@ -554,7 +556,7 @@ public class HalveImage { for( jj = 0; jj < halfHeight; jj++ ) { int kk; for( kk = 0; kk < components; kk++ ) { - short[] sshort = new short[BOX2]; + final short[] sshort = new short[BOX2]; if( myswap_bytes ) { datain.position( src ); sshort[0] = Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ); @@ -578,12 +580,13 @@ public class HalveImage { assert( dest == ( components * element_size * halfWidth * halfHeight ) ); } - public static void halveImage_uint( int components, int width, int height, - ByteBuffer datain, IntBuffer dataout, int element_size, - int ysize, int group_size, boolean myswap_bytes ) { - int i, j, k, l; + public static void halveImage_uint( final int components, final int width, final int height, + final ByteBuffer datain, final IntBuffer dataout, final int element_size, + final int ysize, final int group_size, final boolean myswap_bytes ) { + int i, j, k; + final int l; int newwidth, newheight; - int s = 0; + final int s = 0; int t = 0; double temp = 0; @@ -644,9 +647,9 @@ public class HalveImage { } } - public static void halve1Dimage_uint( int components, int width, int height, - ByteBuffer datain, IntBuffer dataout, int element_size, int ysize, - int group_size, boolean myswap_bytes ) { + public static void halve1Dimage_uint( final int components, final int width, final int height, + final ByteBuffer datain, final IntBuffer dataout, final int element_size, final int ysize, + final int group_size, final boolean myswap_bytes ) { int halfWidth = width / 2; int halfHeight = height / 2; int src = 0; @@ -663,7 +666,7 @@ public class HalveImage { for( jj = 0; jj < halfWidth; jj++ ) { int kk; for( kk = 0; kk < halfHeight; kk++ ) { - long[] uint = new long[BOX2]; + final long[] uint = new long[BOX2]; if( myswap_bytes ) { datain.position( src ); uint[0] = ( 0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ) ); @@ -681,10 +684,10 @@ public class HalveImage { } src += group_size; // skip to next 2 } - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); src += padBytes; // for assertion only } else if( width == 1 ) { // 1 column - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); assert( height != 1 ); // widthxheight can't be 1 halfWidth = 1; // one vertical column with possible pad bytes per row @@ -693,7 +696,7 @@ public class HalveImage { for( jj = 0; jj < halfHeight; jj++ ) { int kk; for( kk = 0; kk < components; kk++ ) { - long[] uint = new long[BOX2]; + final long[] uint = new long[BOX2]; if( myswap_bytes ) { datain.position( src ); uint[0] = ( 0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ) ); @@ -717,12 +720,13 @@ public class HalveImage { assert( dest == components * element_size * halfWidth * halfHeight ); } - public static void halveImage_int( int components, int width, int height, - ByteBuffer datain, IntBuffer dataout, int element_size, - int ysize, int group_size, boolean myswap_bytes ) { - int i, j, k, l; + public static void halveImage_int( final int components, final int width, final int height, + final ByteBuffer datain, final IntBuffer dataout, final int element_size, + final int ysize, final int group_size, final boolean myswap_bytes ) { + int i, j, k; + final int l; int newwidth, newheight; - int s = 0; + final int s = 0; int t = 0; int temp = 0; @@ -786,9 +790,9 @@ public class HalveImage { } } - public static void halve1Dimage_int( int components, int width, int height, - ByteBuffer datain, IntBuffer dataout, int element_size, int ysize, - int group_size, boolean myswap_bytes ) { + public static void halve1Dimage_int( final int components, final int width, final int height, + final ByteBuffer datain, final IntBuffer dataout, final int element_size, final int ysize, + final int group_size, final boolean myswap_bytes ) { int halfWidth = width / 2; int halfHeight = height / 2; int src = 0; @@ -805,7 +809,7 @@ public class HalveImage { for( jj = 0; jj < halfWidth; jj++ ) { int kk; for( kk = 0; kk < components; kk++ ) { - long[] uint = new long[BOX2]; + final long[] uint = new long[BOX2]; if( myswap_bytes ) { datain.position( src ); uint[0] = ( 0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ) ); @@ -823,10 +827,10 @@ public class HalveImage { } src += group_size; // skip to next 2 } - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); src += padBytes; // for assertion only } else if( width == 1 ) { - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); assert( height != 1 ); halfWidth = 1; // one vertical column with possible pad bytes per row @@ -835,7 +839,7 @@ public class HalveImage { for( jj = 0; jj < halfHeight; jj++ ) { int kk; for( kk = 0; kk < components; kk++ ) { - long[] uint = new long[BOX2]; + final long[] uint = new long[BOX2]; if( myswap_bytes ) { datain.position( src ); uint[0] = ( 0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ) ); @@ -859,12 +863,13 @@ public class HalveImage { assert( dest == ( components * element_size * halfWidth * halfHeight ) ); } - public static void halveImage_float( int components, int width, int height, - ByteBuffer datain, FloatBuffer dataout, int element_size, - int ysize, int group_size, boolean myswap_bytes ) { - int i, j, k, l; + public static void halveImage_float( final int components, final int width, final int height, + final ByteBuffer datain, final FloatBuffer dataout, final int element_size, + final int ysize, final int group_size, final boolean myswap_bytes ) { + int i, j, k; + final int l; int newwidth, newheight; - int s = 0; + final int s = 0; int t = 0; float temp = 0.0f; // handle case where there is only 1 column/row @@ -921,9 +926,9 @@ public class HalveImage { } } - public static void halve1Dimage_float( int components, int width, int height, - ByteBuffer datain, FloatBuffer dataout, int element_size, int ysize, - int group_size, boolean myswap_bytes ) { + public static void halve1Dimage_float( final int components, final int width, final int height, + final ByteBuffer datain, final FloatBuffer dataout, final int element_size, final int ysize, + final int group_size, final boolean myswap_bytes ) { int halfWidth = width / 2; int halfHeight = height / 2; int src = 0; @@ -940,7 +945,7 @@ public class HalveImage { for( jj = 0; jj < halfWidth; jj++ ) { int kk; for( kk = 0; kk < components; kk++ ) { - float[] sfloat = new float[BOX2]; + final float[] sfloat = new float[BOX2]; if( myswap_bytes ) { datain.position( src ); sfloat[0] = Mipmap.GLU_SWAP_4_BYTES( datain.getFloat() ); @@ -958,10 +963,10 @@ public class HalveImage { } src += group_size; // skip to next 2 } - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); src += padBytes; // for assertion only } else if( width == 1 ) { - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); assert( height != 1 ); halfWidth = 1; // one vertical column with possible pad bytes per row @@ -970,7 +975,7 @@ public class HalveImage { for( jj = 0; jj < halfHeight; jj++ ) { int kk; for( kk = 0; kk < components; kk++ ) { - float[] sfloat = new float[BOX2]; + final float[] sfloat = new float[BOX2]; if( myswap_bytes ) { datain.position( src ); sfloat[0] = Mipmap.GLU_SWAP_4_BYTES( datain.getFloat() ); @@ -994,9 +999,9 @@ public class HalveImage { assert( dest == ( components * element_size * halfWidth * halfHeight ) ); } - public static void halveImagePackedPixel( int components, Extract extract, int width, - int height, ByteBuffer datain, ByteBuffer dataout, - int pixelSizeInBytes, int rowSizeInBytes, boolean isSwap ) { + public static void halveImagePackedPixel( final int components, final Extract extract, final int width, + final int height, final ByteBuffer datain, final ByteBuffer dataout, + final int pixelSizeInBytes, final int rowSizeInBytes, final boolean isSwap ) { if( width == 1 || height == 1 ) { assert( !( width == 1 && height == 1 ) ); halve1DimagePackedPixel( components, extract, width, height, datain, dataout, @@ -1005,16 +1010,16 @@ public class HalveImage { } int ii, jj; - int halfWidth = width / 2; - int halfHeight = height / 2; + final int halfWidth = width / 2; + final int halfHeight = height / 2; int src = 0; - int padBytes = rowSizeInBytes - ( width * pixelSizeInBytes ); + final int padBytes = rowSizeInBytes - ( width * pixelSizeInBytes ); int outIndex = 0; for( ii = 0; ii < halfHeight; ii++ ) { for( jj = 0; jj < halfWidth; jj++ ) { - float totals[] = new float[4]; - float extractTotals[][] = new float[BOX4][4]; + final float totals[] = new float[4]; + final float extractTotals[][] = new float[BOX4][4]; int cc; datain.position( src ); @@ -1046,9 +1051,9 @@ public class HalveImage { assert( outIndex == halfWidth * halfHeight ); } - public static void halve1DimagePackedPixel( int components, Extract extract, int width, - int height, ByteBuffer datain, ByteBuffer dataout, - int pixelSizeInBytes, int rowSizeInBytes, boolean isSwap ) { + public static void halve1DimagePackedPixel( final int components, final Extract extract, final int width, + final int height, final ByteBuffer datain, final ByteBuffer dataout, + final int pixelSizeInBytes, final int rowSizeInBytes, final boolean isSwap ) { int halfWidth = width / 2; int halfHeight = height / 2; int src = 0; @@ -1066,8 +1071,8 @@ public class HalveImage { // one horizontal row with possible pad bytes for( jj = 0; jj < halfWidth; jj++ ) { - float[] totals = new float[4]; - float[][] extractTotals = new float[BOX2][4]; + final float[] totals = new float[4]; + final float[][] extractTotals = new float[BOX2][4]; int cc; datain.position( src ); @@ -1088,7 +1093,7 @@ public class HalveImage { // skip over to next group of 2 src += pixelSizeInBytes + pixelSizeInBytes; } - int padBytes = rowSizeInBytes - ( width * pixelSizeInBytes ); + final int padBytes = rowSizeInBytes - ( width * pixelSizeInBytes ); src += padBytes; assert( src == rowSizeInBytes ); @@ -1102,8 +1107,8 @@ public class HalveImage { // average two at a time for( jj = 0; jj < halfHeight; jj++ ) { - float[] totals = new float[4]; - float[][] extractTotals = new float[BOX2][4]; + final float[] totals = new float[4]; + final float[][] extractTotals = new float[BOX2][4]; int cc; // average two at a time, instead of four datain.position( src ); @@ -1129,16 +1134,16 @@ public class HalveImage { } } - public static void halveImagePackedPixelSlice( int components, Extract extract, - int width, int height, int depth, ByteBuffer dataIn, - ByteBuffer dataOut, int pixelSizeInBytes, int rowSizeInBytes, - int imageSizeInBytes, boolean isSwap ) { + public static void halveImagePackedPixelSlice( final int components, final Extract extract, + final int width, final int height, final int depth, final ByteBuffer dataIn, + final ByteBuffer dataOut, final int pixelSizeInBytes, final int rowSizeInBytes, + final int imageSizeInBytes, final boolean isSwap ) { int ii, jj; - int halfWidth = width / 2; - int halfHeight = height / 2; - int halfDepth = depth / 2; + final int halfWidth = width / 2; + final int halfHeight = height / 2; + final int halfDepth = depth / 2; int src = 0; - int padBytes = rowSizeInBytes - ( width * pixelSizeInBytes ); + final int padBytes = rowSizeInBytes - ( width * pixelSizeInBytes ); int outIndex = 0; assert( (width == 1 || height == 1) && depth >= 2 ); @@ -1148,8 +1153,8 @@ public class HalveImage { assert( depth >= 2 ); for( ii = 0; ii < halfDepth; ii++ ) { - float totals[] = new float[4]; - float extractTotals[][] = new float[BOX2][4]; + final float totals[] = new float[4]; + final float extractTotals[][] = new float[BOX2][4]; int cc; dataIn.position( src ); @@ -1178,8 +1183,8 @@ public class HalveImage { for( ii = 0; ii < halfDepth; ii++ ) { for( jj = 0; jj < halfWidth; jj++ ) { - float totals[] = new float[4]; - float extractTotals[][] = new float[BOX4][4]; + final float totals[] = new float[4]; + final float extractTotals[][] = new float[BOX4][4]; int cc; dataIn.position( src ); @@ -1199,7 +1204,7 @@ public class HalveImage { for( kk = 0; kk < BOX4; kk++ ) { totals[cc]+= extractTotals[kk][cc]; } - totals[cc]/= (float)BOX4; + totals[cc]/= BOX4; } extract.shove( totals, outIndex, dataOut ); outIndex++; @@ -1212,8 +1217,8 @@ public class HalveImage { for( ii = 0; ii < halfDepth; ii++ ) { for( jj = 0; jj < halfWidth; jj++ ) { - float totals[] = new float[4]; - float extractTotals[][] = new float[BOX4][4]; + final float totals[] = new float[4]; + final float extractTotals[][] = new float[BOX4][4]; int cc; dataIn.position( src ); @@ -1233,7 +1238,7 @@ public class HalveImage { for( kk = 0; kk < BOX4; kk++ ) { totals[cc]+= extractTotals[kk][cc]; } - totals[cc]/= (float)BOX4; + totals[cc]/= BOX4; } extract.shove( totals, outIndex, dataOut ); outIndex++; @@ -1244,16 +1249,16 @@ public class HalveImage { } } - public static void halveImageSlice( int components, ExtractPrimitive extract, int width, - int height, int depth, ByteBuffer dataIn, ByteBuffer dataOut, - int elementSizeInBytes, int groupSizeInBytes, int rowSizeInBytes, - int imageSizeInBytes, boolean isSwap ) { + public static void halveImageSlice( final int components, final ExtractPrimitive extract, final int width, + final int height, final int depth, final ByteBuffer dataIn, final ByteBuffer dataOut, + final int elementSizeInBytes, final int groupSizeInBytes, final int rowSizeInBytes, + final int imageSizeInBytes, final boolean isSwap ) { int ii, jj; - int halfWidth = width / 2; - int halfHeight = height / 2; - int halfDepth = depth / 2; + final int halfWidth = width / 2; + final int halfHeight = height / 2; + final int halfDepth = depth / 2; int src = 0; - int padBytes = rowSizeInBytes - ( width * groupSizeInBytes ); + final int padBytes = rowSizeInBytes - ( width * groupSizeInBytes ); int outIndex = 0; assert( (width == 1 || height == 1) && depth >= 2 ); @@ -1265,8 +1270,8 @@ public class HalveImage { for( ii = 0; ii < halfDepth; ii++ ) { int cc; for( cc = 0; cc < components; cc++ ) { - double[] totals = new double[4]; - double[][] extractTotals = new double[BOX2][4]; + final double[] totals = new double[4]; + final double[][] extractTotals = new double[BOX2][4]; int kk; dataIn.position( src ); @@ -1281,7 +1286,7 @@ public class HalveImage { for( kk = 0; kk < BOX2; kk++ ) { totals[cc] += extractTotals[kk][cc]; } - totals[cc] /= (double)BOX2; + totals[cc] /= BOX2; extract.shove( totals[cc], outIndex, dataOut ); outIndex++; @@ -1301,8 +1306,8 @@ public class HalveImage { int cc; for( cc = 0; cc < components; cc++ ) { int kk; - double totals[] = new double[4]; - double extractTotals[][] = new double[BOX4][4]; + final double totals[] = new double[4]; + final double extractTotals[][] = new double[BOX4][4]; dataIn.position( src ); extractTotals[0][cc] = extract.extract( isSwap, dataIn ); @@ -1321,7 +1326,7 @@ public class HalveImage { for( kk = 0; kk < BOX4; kk++ ) { totals[cc] += extractTotals[kk][cc]; } - totals[cc] /= (double)BOX4; + totals[cc] /= BOX4; extract.shove( totals[cc], outIndex, dataOut ); outIndex++; @@ -1343,8 +1348,8 @@ public class HalveImage { int cc; for( cc = 0; cc < components; cc++ ) { int kk; - double totals[] = new double[4]; - double extractTotals[][] = new double[BOX4][4]; + final double totals[] = new double[4]; + final double extractTotals[][] = new double[BOX4][4]; dataIn.position( src ); extractTotals[0][cc] = extract.extract( isSwap, dataIn ); @@ -1364,7 +1369,7 @@ public class HalveImage { for( kk = 0; kk < BOX4; kk++ ) { totals[cc] += extractTotals[kk][cc]; } - totals[cc] /= (double)BOX4; + totals[cc] /= BOX4; extract.shove( totals[cc], outIndex, dataOut ); outIndex++; @@ -1381,10 +1386,10 @@ public class HalveImage { } } - public static void halveImage3D( int components, ExtractPrimitive extract, - int width, int height, int depth, ByteBuffer dataIn, ByteBuffer dataOut, - int elementSizeInBytes, int groupSizeInBytes, int rowSizeInBytes, - int imageSizeInBytes, boolean isSwap ) { + public static void halveImage3D( final int components, final ExtractPrimitive extract, + final int width, final int height, final int depth, final ByteBuffer dataIn, final ByteBuffer dataOut, + final int elementSizeInBytes, final int groupSizeInBytes, final int rowSizeInBytes, + final int imageSizeInBytes, final boolean isSwap ) { assert( depth > 1 ); // horizontal/vertical/onecolumn slice viewed from top @@ -1399,11 +1404,11 @@ public class HalveImage { int ii, jj, dd; - int halfWidth = width / 2; - int halfHeight = height / 2; - int halfDepth = depth / 2; + final int halfWidth = width / 2; + final int halfHeight = height / 2; + final int halfDepth = depth / 2; int src = 0; - int padBytes = rowSizeInBytes - ( width * groupSizeInBytes ); + final int padBytes = rowSizeInBytes - ( width * groupSizeInBytes ); int outIndex = 0; for( dd = 0; dd < halfDepth; dd++ ) { @@ -1412,8 +1417,8 @@ public class HalveImage { int cc; for( cc = 0; cc < components; cc++ ) { int kk; - double totals[] = new double[4]; - double extractTotals[][] = new double[BOX8][4]; + final double totals[] = new double[4]; + final double extractTotals[][] = new double[BOX8][4]; dataIn.position( src ); extractTotals[0][cc] = extract.extract( isSwap, dataIn ); @@ -1437,7 +1442,7 @@ public class HalveImage { for( kk = 0; kk < BOX8; kk++ ) { totals[cc] += extractTotals[kk][cc]; } - totals[cc] /= (double)BOX8; + totals[cc] /= BOX8; extract.shove( totals[cc], outIndex, dataOut ); outIndex++; @@ -1457,10 +1462,10 @@ public class HalveImage { assert( outIndex == halfWidth * halfHeight * halfDepth * components ); } - public static void halveImagePackedPixel3D( int components, Extract extract, - int width, int height, int depth, ByteBuffer dataIn, - ByteBuffer dataOut, int pixelSizeInBytes, int rowSizeInBytes, - int imageSizeInBytes, boolean isSwap ) { + public static void halveImagePackedPixel3D( final int components, final Extract extract, + final int width, final int height, final int depth, final ByteBuffer dataIn, + final ByteBuffer dataOut, final int pixelSizeInBytes, final int rowSizeInBytes, + final int imageSizeInBytes, final boolean isSwap ) { if( depth == 1 ) { assert( 1 <= width && 1 <= height ); @@ -1476,18 +1481,18 @@ public class HalveImage { } int ii, jj, dd; - int halfWidth = width / 2; - int halfHeight = height / 2; - int halfDepth = depth / 2; + final int halfWidth = width / 2; + final int halfHeight = height / 2; + final int halfDepth = depth / 2; int src = 0; - int padBytes = rowSizeInBytes - ( width * pixelSizeInBytes ); + final int padBytes = rowSizeInBytes - ( width * pixelSizeInBytes ); int outIndex = 0; for( dd = 0; dd < halfDepth; dd++ ) { for( ii = 0; ii < halfHeight; ii++ ) { for( jj = 0; jj < halfWidth; jj++ ) { - float totals[] = new float[4]; // 4 is max components - float extractTotals[][] = new float[BOX8][4]; + final float totals[] = new float[4]; // 4 is max components + final float extractTotals[][] = new float[BOX8][4]; int cc; dataIn.position( src ); @@ -1514,7 +1519,7 @@ public class HalveImage { for( kk = 0; kk < BOX8; kk++ ) { totals[cc] += extractTotals[kk][cc]; } - totals[cc] /= (float)BOX8; + totals[cc] /= BOX8; } extract.shove( totals, outIndex, dataOut ); outIndex++; |