minor fixes
authorSvjatoslav Agejenko <svjatoslav@svjatoslav.eu>
Fri, 6 Dec 2013 07:49:03 +0000 (09:49 +0200)
committerSvjatoslav Agejenko <svjatoslav@svjatoslav.eu>
Fri, 6 Dec 2013 07:49:03 +0000 (09:49 +0200)
doc/index.html
pom.xml
src/main/java/eu/svjatoslav/imagesqueeze/codec/Approximator.java
src/main/java/eu/svjatoslav/imagesqueeze/codec/ImageDecoder.java
src/main/java/eu/svjatoslav/imagesqueeze/codec/ImageEncoder.java

index 7ccf9f6..ad87c30 100755 (executable)
@@ -10,7 +10,7 @@
     <h1>ImageSqueeze - lossy image codec</h1>
     <a href="http://php.svjatoslav.eu/gitweb/?p=imagesqueeze.git;a=snapshot;h=HEAD;sf=tgz">Download</a>
     &nbsp;&nbsp;
-    <a href="http://svjatoslav.eu/static/gitbrowse/imagesqueeze/doc/index.html">Online homepage</a>
+    <a href="http://www2.svjatoslav.eu/gitbrowse/imagesqueeze/doc/index.html">Online homepage</a>
     &nbsp;&nbsp;
     <a href="http://svjatoslav.eu/programs.jsp">Other applications hosted on svjatoslav.eu</a>
     <pre>
diff --git a/pom.xml b/pom.xml
index 4712a2f..f261444 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
     <modelVersion>4.0.0</modelVersion>
     <groupId>eu.svjatoslav</groupId>
     <artifactId>imagesqueeze</artifactId>
-    <version>1.0-SNAPSHOT</version>
+    <version>1.2-SNAPSHOT</version>
     <name>imagesqueeze</name>
     <packaging>jar</packaging>
 
index a4f78af..0f3857b 100755 (executable)
@@ -31,12 +31,14 @@ public class Approximator implements Comparable<Approximator> {
        @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;
index bfcaeb6..78bf715 100755 (executable)
@@ -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;
index 613064c..7e8af8d 100755 (executable)
@@ -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;