From: Svjatoslav Agejenko Date: Fri, 6 Dec 2013 07:49:03 +0000 (+0200) Subject: minor fixes X-Git-Url: http://www2.svjatoslav.eu/gitweb/?a=commitdiff_plain;h=be13f5e7ec2b5e610db95ab2950a35a4e64c9a71;p=imagesqueeze.git minor fixes --- diff --git a/doc/index.html b/doc/index.html index 7ccf9f6..ad87c30 100755 --- a/doc/index.html +++ b/doc/index.html @@ -10,7 +10,7 @@

ImageSqueeze - lossy image codec

Download    - Online homepage + Online homepage    Other applications hosted on svjatoslav.eu
diff --git a/pom.xml b/pom.xml
index 4712a2f..f261444 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
     4.0.0
     eu.svjatoslav
     imagesqueeze
-    1.0-SNAPSHOT
+    1.2-SNAPSHOT
     imagesqueeze
     jar
 
diff --git a/src/main/java/eu/svjatoslav/imagesqueeze/codec/Approximator.java b/src/main/java/eu/svjatoslav/imagesqueeze/codec/Approximator.java
index a4f78af..0f3857b 100755
--- a/src/main/java/eu/svjatoslav/imagesqueeze/codec/Approximator.java
+++ b/src/main/java/eu/svjatoslav/imagesqueeze/codec/Approximator.java
@@ -31,12 +31,14 @@ public class Approximator implements Comparable {
 	@Override
 	public int compareTo(final Approximator o) {
 		int result = yTable.compareTo(o.yTable);
-		if (result != 0)
+		if (result != 0) {
 			return result;
+		}
 
 		result = uTable.compareTo(o.uTable);
-		if (result != 0)
+		if (result != 0) {
 			return result;
+		}
 
 		result = vTable.compareTo(o.vTable);
 		return result;
diff --git a/src/main/java/eu/svjatoslav/imagesqueeze/codec/ImageDecoder.java b/src/main/java/eu/svjatoslav/imagesqueeze/codec/ImageDecoder.java
index bfcaeb6..78bf715 100755
--- a/src/main/java/eu/svjatoslav/imagesqueeze/codec/ImageDecoder.java
+++ b/src/main/java/eu/svjatoslav/imagesqueeze/codec/ImageDecoder.java
@@ -110,8 +110,9 @@ public class ImageDecoder {
 		gridSquare(step / 2, 0, step, pixels);
 		gridSquare(0, step / 2, step, pixels);
 
-		if (step > 2)
+		if (step > 2) {
 			grid(step / 2, pixels);
+		}
 	}
 
 	public void gridDiagonal(final int offsetX, final int offsetY,
@@ -193,10 +194,12 @@ public class ImageDecoder {
 								computedRange, computedRangeBitCount);
 
 				decodedValue = averageDecodedValue - decodedDifference;
-				if (decodedValue > 255)
+				if (decodedValue > 255) {
 					decodedValue = 255;
-				if (decodedValue < 0)
+				}
+				if (decodedValue < 0) {
 					decodedValue = 0;
+				}
 			}
 		} else {
 			decodedRangeMap[index] = (byte) inheritedRange;
diff --git a/src/main/java/eu/svjatoslav/imagesqueeze/codec/ImageEncoder.java b/src/main/java/eu/svjatoslav/imagesqueeze/codec/ImageEncoder.java
index 613064c..7e8af8d 100755
--- a/src/main/java/eu/svjatoslav/imagesqueeze/codec/ImageEncoder.java
+++ b/src/main/java/eu/svjatoslav/imagesqueeze/codec/ImageEncoder.java
@@ -92,16 +92,19 @@ public class ImageEncoder {
 				final int colorBufferIndex = index * 3;
 
 				int blue = pixels[colorBufferIndex];
-				if (blue < 0)
+				if (blue < 0) {
 					blue = blue + 256;
+				}
 
 				int green = pixels[colorBufferIndex + 1];
-				if (green < 0)
+				if (green < 0) {
 					green = green + 256;
+				}
 
 				int red = pixels[colorBufferIndex + 2];
-				if (red < 0)
+				if (red < 0) {
 					red = red + 256;
+				}
 
 				color.r = red;
 				color.g = green;
@@ -184,10 +187,12 @@ public class ImageEncoder {
 				final int decodedDifference = decodeValueFromGivenBits(
 						bitEncodedDifference, computedRange, computedBitCount);
 				int decodedValue = averageDecodedValue - decodedDifference;
-				if (decodedValue > 255)
+				if (decodedValue > 255) {
 					decodedValue = 255;
-				if (decodedValue < 0)
+				}
+				if (decodedValue < 0) {
 					decodedValue = 0;
+				}
 
 				decodedMap[index] = (byte) decodedValue;
 			} else {
@@ -219,8 +224,9 @@ public class ImageEncoder {
 		rangeGridSquare(step / 2, 0, step);
 		rangeGridSquare(0, step / 2, step);
 
-		if (step > 2)
+		if (step > 2) {
 			rangeGrid(step / 2);
+		}
 	}
 
 	public void rangeGridDiagonal(final int offsetX, final int offsetY,
@@ -275,8 +281,9 @@ public class ImageEncoder {
 		rangeRoundGridSquare(step / 2, 0, step);
 		rangeRoundGridSquare(0, step / 2, step);
 
-		if (step < 1024)
+		if (step < 1024) {
 			rangeRoundGrid(step * 2);
+		}
 	}
 
 	public void rangeRoundGridDiagonal(final int offsetX, final int offsetY,
@@ -370,8 +377,9 @@ public class ImageEncoder {
 		saveGridSquare(step / 2, 0, step);
 		saveGridSquare(0, step / 2, step);
 
-		if (step > 2)
+		if (step > 2) {
 			saveGrid(step / 2);
+		}
 	}
 
 	public void saveGridDiagonal(final int offsetX, final int offsetY,
@@ -464,8 +472,9 @@ public class ImageEncoder {
 
 	public static int byteToInt(final byte input) {
 		int result = input;
-		if (result < 0)
+		if (result < 0) {
 			result = result + 256;
+		}
 		return result;
 	}
 
@@ -496,8 +505,9 @@ public class ImageEncoder {
 			int decodedValue = (range * encodedValue)
 					/ realvalueForThisBitcount;
 
-			if (decodedValue > range)
+			if (decodedValue > range) {
 				decodedValue = range;
+			}
 
 			if (negativeBit == 0) {
 				return decodedValue;
@@ -529,15 +539,17 @@ public class ImageEncoder {
 			// still one or more bits left, encode value as precisely as
 			// possible
 
-			if (value > range)
+			if (value > range) {
 				value = range;
+			}
 
 			final int realvalueForThisBitcount = 1 << remainingBitCount;
 			// int valueMultiplier = range / realvalueForThisBitcount;
 			int encodedValue = (value * realvalueForThisBitcount) / range;
 
-			if (encodedValue >= realvalueForThisBitcount)
+			if (encodedValue >= realvalueForThisBitcount) {
 				encodedValue = realvalueForThisBitcount - 1;
+			}
 
 			encodedValue = (encodedValue << 1) + negativeBit;