projects
/
imagesqueeze.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
7a74c09
)
minor fixes
author
Svjatoslav Agejenko
<svjatoslav@svjatoslav.eu>
Fri, 6 Dec 2013 07:49:03 +0000
(09:49 +0200)
committer
Svjatoslav Agejenko
<svjatoslav@svjatoslav.eu>
Fri, 6 Dec 2013 07:49:03 +0000
(09:49 +0200)
doc/index.html
patch
|
blob
|
history
pom.xml
patch
|
blob
|
history
src/main/java/eu/svjatoslav/imagesqueeze/codec/Approximator.java
patch
|
blob
|
history
src/main/java/eu/svjatoslav/imagesqueeze/codec/ImageDecoder.java
patch
|
blob
|
history
src/main/java/eu/svjatoslav/imagesqueeze/codec/ImageEncoder.java
patch
|
blob
|
history
diff --git
a/doc/index.html
b/doc/index.html
index
7ccf9f6
..
ad87c30
100755
(executable)
--- a/
doc/index.html
+++ b/
doc/index.html
@@
-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>
<h1>ImageSqueeze - lossy image codec</h1>
<a href="http://php.svjatoslav.eu/gitweb/?p=imagesqueeze.git;a=snapshot;h=HEAD;sf=tgz">Download</a>
- <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>
<a href="http://svjatoslav.eu/programs.jsp">Other applications hosted on svjatoslav.eu</a>
<pre>
<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>
<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>
<name>imagesqueeze</name>
<packaging>jar</packaging>
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
(executable)
--- 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<Approximator> {
@Override
public int compareTo(final Approximator o) {
int result = yTable.compareTo(o.yTable);
@Override
public int compareTo(final Approximator o) {
int result = yTable.compareTo(o.yTable);
- if (result != 0)
+ if (result != 0)
{
return result;
return result;
+ }
result = uTable.compareTo(o.uTable);
result = uTable.compareTo(o.uTable);
- if (result != 0)
+ if (result != 0)
{
return result;
return result;
+ }
result = vTable.compareTo(o.vTable);
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
(executable)
--- 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);
gridSquare(step / 2, 0, step, pixels);
gridSquare(0, step / 2, step, pixels);
- if (step > 2)
+ if (step > 2)
{
grid(step / 2, pixels);
grid(step / 2, pixels);
+ }
}
public void gridDiagonal(final int offsetX, final int offsetY,
}
public void gridDiagonal(final int offsetX, final int offsetY,
@@
-193,10
+194,12
@@
public class ImageDecoder {
computedRange, computedRangeBitCount);
decodedValue = averageDecodedValue - decodedDifference;
computedRange, computedRangeBitCount);
decodedValue = averageDecodedValue - decodedDifference;
- if (decodedValue > 255)
+ if (decodedValue > 255)
{
decodedValue = 255;
decodedValue = 255;
- if (decodedValue < 0)
+ }
+ if (decodedValue < 0) {
decodedValue = 0;
decodedValue = 0;
+ }
}
} else {
decodedRangeMap[index] = (byte) inheritedRange;
}
} 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
(executable)
--- 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];
final int colorBufferIndex = index * 3;
int blue = pixels[colorBufferIndex];
- if (blue < 0)
+ if (blue < 0)
{
blue = blue + 256;
blue = blue + 256;
+ }
int green = pixels[colorBufferIndex + 1];
int green = pixels[colorBufferIndex + 1];
- if (green < 0)
+ if (green < 0)
{
green = green + 256;
green = green + 256;
+ }
int red = pixels[colorBufferIndex + 2];
int red = pixels[colorBufferIndex + 2];
- if (red < 0)
+ if (red < 0)
{
red = red + 256;
red = red + 256;
+ }
color.r = red;
color.g = green;
color.r = red;
color.g = green;
@@
-184,10
+187,12
@@
public class ImageEncoder {
final int decodedDifference = decodeValueFromGivenBits(
bitEncodedDifference, computedRange, computedBitCount);
int decodedValue = averageDecodedValue - decodedDifference;
final int decodedDifference = decodeValueFromGivenBits(
bitEncodedDifference, computedRange, computedBitCount);
int decodedValue = averageDecodedValue - decodedDifference;
- if (decodedValue > 255)
+ if (decodedValue > 255)
{
decodedValue = 255;
decodedValue = 255;
- if (decodedValue < 0)
+ }
+ if (decodedValue < 0) {
decodedValue = 0;
decodedValue = 0;
+ }
decodedMap[index] = (byte) decodedValue;
} else {
decodedMap[index] = (byte) decodedValue;
} else {
@@
-219,8
+224,9
@@
public class ImageEncoder {
rangeGridSquare(step / 2, 0, step);
rangeGridSquare(0, step / 2, step);
rangeGridSquare(step / 2, 0, step);
rangeGridSquare(0, step / 2, step);
- if (step > 2)
+ if (step > 2)
{
rangeGrid(step / 2);
rangeGrid(step / 2);
+ }
}
public void rangeGridDiagonal(final int offsetX, final int offsetY,
}
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);
rangeRoundGridSquare(step / 2, 0, step);
rangeRoundGridSquare(0, step / 2, step);
- if (step < 1024)
+ if (step < 1024)
{
rangeRoundGrid(step * 2);
rangeRoundGrid(step * 2);
+ }
}
public void rangeRoundGridDiagonal(final int offsetX, final int offsetY,
}
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);
saveGridSquare(step / 2, 0, step);
saveGridSquare(0, step / 2, step);
- if (step > 2)
+ if (step > 2)
{
saveGrid(step / 2);
saveGrid(step / 2);
+ }
}
public void saveGridDiagonal(final int offsetX, final int offsetY,
}
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;
public static int byteToInt(final byte input) {
int result = input;
- if (result < 0)
+ if (result < 0)
{
result = result + 256;
result = result + 256;
+ }
return result;
}
return result;
}
@@
-496,8
+505,9
@@
public class ImageEncoder {
int decodedValue = (range * encodedValue)
/ realvalueForThisBitcount;
int decodedValue = (range * encodedValue)
/ realvalueForThisBitcount;
- if (decodedValue > range)
+ if (decodedValue > range)
{
decodedValue = range;
decodedValue = range;
+ }
if (negativeBit == 0) {
return decodedValue;
if (negativeBit == 0) {
return decodedValue;
@@
-529,15
+539,17
@@
public class ImageEncoder {
// still one or more bits left, encode value as precisely as
// possible
// still one or more bits left, encode value as precisely as
// possible
- if (value > range)
+ if (value > range)
{
value = range;
value = range;
+ }
final int realvalueForThisBitcount = 1 << remainingBitCount;
// int valueMultiplier = range / realvalueForThisBitcount;
int encodedValue = (value * realvalueForThisBitcount) / 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 = realvalueForThisBitcount - 1;
+ }
encodedValue = (encodedValue << 1) + negativeBit;
encodedValue = (encodedValue << 1) + negativeBit;