mirror of
https://github.com/haraldk/TwelveMonkeys.git
synced 2026-05-27 00:00:02 -04:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e5aa124e17 |
@@ -43,7 +43,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ ubuntu-latest, windows-latest, macos-14 ]
|
||||
os: [ ubuntu-latest, windows-latest, macos-13 ]
|
||||
runs-on: ${{ matrix.os }}
|
||||
permissions:
|
||||
checks: write
|
||||
@@ -51,7 +51,7 @@ jobs:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
- uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0
|
||||
with:
|
||||
distribution: 'zulu'
|
||||
distribution: 'temurin'
|
||||
java-version: '8'
|
||||
java-package: jdk
|
||||
cache: 'maven'
|
||||
|
||||
@@ -37,7 +37,7 @@ jobs:
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@e296a935590eb16afc0c0108289f68c87e2a89a5 # v4.30.7
|
||||
uses: github/codeql-action/init@3599b3baa15b485a2e49ef411a7a4bb2452e7f93 # v3.30.5
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||
@@ -51,7 +51,7 @@ jobs:
|
||||
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
|
||||
# If this step fails, then you should remove it and run the build manually (see below)
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@e296a935590eb16afc0c0108289f68c87e2a89a5 # v4.30.7
|
||||
uses: github/codeql-action/autobuild@3599b3baa15b485a2e49ef411a7a4bb2452e7f93 # v3.30.5
|
||||
|
||||
# ℹ️ Command-line programs to run using the OS shell.
|
||||
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
|
||||
@@ -64,6 +64,6 @@ jobs:
|
||||
# ./location_of_script_within_repo/buildscript.sh
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@e296a935590eb16afc0c0108289f68c87e2a89a5 # v4.30.7
|
||||
uses: github/codeql-action/analyze@3599b3baa15b485a2e49ef411a7a4bb2452e7f93 # v3.30.5
|
||||
with:
|
||||
category: "/language:${{matrix.language}}"
|
||||
|
||||
@@ -57,6 +57,6 @@ jobs:
|
||||
|
||||
# Upload the results to GitHub's code scanning dashboard.
|
||||
- name: "Upload to code-scanning"
|
||||
uses: github/codeql-action/upload-sarif@e296a935590eb16afc0c0108289f68c87e2a89a5 # v4.30.7
|
||||
uses: github/codeql-action/upload-sarif@3599b3baa15b485a2e49ef411a7a4bb2452e7f93 # v3.30.5
|
||||
with:
|
||||
sarif_file: results.sarif
|
||||
|
||||
+3
-23
@@ -212,9 +212,7 @@ final class JPEGLosslessDecoder {
|
||||
|
||||
final int[] firstValue = new int[numComp];
|
||||
for (int i = 0; i < numComp; i++) {
|
||||
// scan.approxLow is the point transformation (Pt) value
|
||||
// ref. ISO/IEC 10918-1 H.1.2.1
|
||||
firstValue[i] = (1 << (precision - scan.approxLow - 1));
|
||||
firstValue[i] = (1 << (precision - 1));
|
||||
}
|
||||
|
||||
final int[] pred = new int[numComp];
|
||||
@@ -234,11 +232,6 @@ final class JPEGLosslessDecoder {
|
||||
output(pred);
|
||||
current = decode(pred, temp, index);
|
||||
}
|
||||
|
||||
if ((current == JPEG.EOI) && (xLoc == xDim - 1) && (yLoc == yDim - 1)) {
|
||||
// Output value left in pred if EOI is hit while decoding last pixel
|
||||
output(pred);
|
||||
}
|
||||
|
||||
break; //current=MARKER
|
||||
}
|
||||
@@ -275,17 +268,6 @@ final class JPEGLosslessDecoder {
|
||||
// TODO oe: 05.05.2018 Is it correct loop? Content of outputData from previous iteration is always lost.
|
||||
} while ((current != JPEG.EOI) && ((xLoc < xDim) && (yLoc < yDim)) && (scanNum == 0));
|
||||
|
||||
// Apply point transform to output. This must be done after it has finished being
|
||||
// used for predictive purposes.
|
||||
if (scan.approxLow != 0) {
|
||||
for (int componentIndex = 0; componentIndex < numComp; ++componentIndex) {
|
||||
int[] comp = outputData[componentIndex];
|
||||
for (int i = 0; i < comp.length; i++) {
|
||||
comp[i] = mask & (comp[i] << scan.approxLow);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return outputData;
|
||||
}
|
||||
|
||||
@@ -347,11 +329,9 @@ final class JPEGLosslessDecoder {
|
||||
private int decodeSingle(final int[] prev, final int[] temp, final int[] index) throws IOException {
|
||||
// At the beginning of the first line and
|
||||
// at the beginning of each restart interval the prediction value of 2P – 1 is used, where P is the input precision.
|
||||
// If the point transformation parameter (see A.4) is non-zero, the prediction value at the beginning of the first lines and the
|
||||
// beginning of each restart interval is 2P – Pt – 1 , where Pt is the value of the point transformation parameter
|
||||
if (restarting) {
|
||||
restarting = false;
|
||||
prev[0] = (1 << (frame.samplePrecision - scan.approxLow - 1));
|
||||
prev[0] = (1 << (frame.samplePrecision - 1));
|
||||
}
|
||||
else {
|
||||
final int[] outputData = this.outputData[0];
|
||||
@@ -706,7 +686,7 @@ final class JPEGLosslessDecoder {
|
||||
return getPreviousY(data);
|
||||
}
|
||||
else {
|
||||
return (1 << (frame.samplePrecision - scan.approxLow - 1));
|
||||
return (1 << (frame.samplePrecision - 1));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
-61
@@ -2033,65 +2033,4 @@ public class JPEGImageReaderTest extends ImageReaderAbstractTest<JPEGImageReader
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadLosslessJPEGGradient() throws IOException {
|
||||
JPEGImageReader reader = createReader();
|
||||
|
||||
try (ImageInputStream stream = ImageIO.createImageInputStream(getClassLoaderResource("/jpeg-lossless/gradient_ls.jpg"))) {
|
||||
reader.setInput(stream);
|
||||
|
||||
assertEquals(256, reader.getWidth(0));
|
||||
assertEquals(256, reader.getHeight(0));
|
||||
|
||||
BufferedImage image = reader.read(0, null);
|
||||
|
||||
assertNotNull(image);
|
||||
assertEquals(256, image.getWidth());
|
||||
assertEquals(256, image.getHeight());
|
||||
assertEquals(16, image.getColorModel().getComponentSize(0));
|
||||
|
||||
for (int y = 0; y < 256; y++) {
|
||||
for (int x = 0; x < 256; x++) {
|
||||
assertEquals((y << 8) | x, image.getRaster().getSample(x, y, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
finally {
|
||||
reader.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadLosslessJPEGGradientWithPointTransform() throws IOException {
|
||||
JPEGImageReader reader = createReader();
|
||||
|
||||
try (ImageInputStream stream = ImageIO.createImageInputStream(getClassLoaderResource("/jpeg-lossless/gradient_ls_pt.jpg"))) {
|
||||
reader.setInput(stream);
|
||||
|
||||
assertEquals(256, reader.getWidth(0));
|
||||
assertEquals(256, reader.getHeight(0));
|
||||
|
||||
BufferedImage image = reader.read(0, null);
|
||||
|
||||
assertNotNull(image);
|
||||
assertEquals(256, image.getWidth());
|
||||
assertEquals(256, image.getHeight());
|
||||
assertEquals(16, image.getColorModel().getComponentSize(0));
|
||||
|
||||
for (int y = 0; y < 256; y++) {
|
||||
for (int x = 0; x < 256; x++) {
|
||||
int expected = (y << 8) | x;
|
||||
|
||||
// Simulate effect of precision loss due to point transform = 4
|
||||
expected = (expected >> 4) << 4;
|
||||
|
||||
assertEquals(expected, image.getRaster().getSample(x, y, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
finally {
|
||||
reader.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 16 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 9.2 KiB |
Reference in New Issue
Block a user