You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2026/04/09 14:54:36 UTC
(pdfbox-jbig2) branch master updated (d56a04f -> c68b97c)
This is an automated email from the ASF dual-hosted git repository.
tilman pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/pdfbox-jbig2.git
from d56a04f PDFBOX-6156: improve comment, exclude when src bitmap larger than destination
new d32c5d6 PDFBOX-5597: do Math.ceil() when subsampling
new c68b97c PDFBOX-5597: adjust test results; improve test
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
src/main/java/org/apache/pdfbox/jbig2/image/Bitmaps.java | 8 ++++----
.../org/apache/pdfbox/jbig2/image/BitmapsChecksumTest.java | 14 +++++++++-----
2 files changed, 13 insertions(+), 9 deletions(-)
(pdfbox-jbig2) 02/02: PDFBOX-5597: adjust test results; improve test
Posted by ti...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
tilman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pdfbox-jbig2.git
commit c68b97c99436ace9e838e24cd1dcd4d4314751d1
Author: Tilman Hausherr <ti...@apache.org>
AuthorDate: Thu Apr 9 16:54:21 2026 +0200
PDFBOX-5597: adjust test results; improve test
---
.../org/apache/pdfbox/jbig2/image/BitmapsChecksumTest.java | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/src/test/java/org/apache/pdfbox/jbig2/image/BitmapsChecksumTest.java b/src/test/java/org/apache/pdfbox/jbig2/image/BitmapsChecksumTest.java
index edbfbe2..df52097 100644
--- a/src/test/java/org/apache/pdfbox/jbig2/image/BitmapsChecksumTest.java
+++ b/src/test/java/org/apache/pdfbox/jbig2/image/BitmapsChecksumTest.java
@@ -17,7 +17,7 @@
package org.apache.pdfbox.jbig2.image;
-import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assume.assumeTrue;
import java.awt.Dimension;
@@ -74,11 +74,11 @@ public class BitmapsChecksumTest
new PreconfiguredImageReadParam(new Dimension(600, 300)), FilterType.Bessel,
"-69-11478-721003586-100-72-85-1559101-118-24-94" },
{ "target/images/042_1.jb2", 1, new PreconfiguredImageReadParam(2, 2, 0, 0),
- FilterType.Bessel, "42-7327-48-10105-703710-571171181079448-70" },
+ FilterType.Bessel, "-3733-65-17-3887-10070-78122-6517-98-989959" },
{ "target/images/042_1.jb2", 1, new PreconfiguredImageReadParam(2, 2, 0, 0),
- FilterType.Lanczos, "42-7327-48-10105-703710-571171181079448-70" },
+ FilterType.Lanczos, "-3733-65-17-3887-10070-78122-6517-98-989959" },
{ "target/images/042_1.jb2", 1, new PreconfiguredImageReadParam(3, 3, 1, 1),
- FilterType.Lanczos, "-68082-6815-41-95-124101-60-69-106-114-68-81-65" },
+ FilterType.Lanczos, "-114123887011117-3-7711920-16-96-707-114-120" },
{ "target/images/042_1.jb2", 1,
new PreconfiguredImageReadParam(new Rectangle(100, 100, 500, 500)),
FilterType.Lanczos, "15-92-12415-6-46-89-78-2070-59-4250-305893" },
@@ -133,8 +133,12 @@ public class BitmapsChecksumTest
{
sb.append(toAppend);
}
+
+ // to check if any changes produce a decent file, do this before changing the test values
+ // if (!checksum.equals(sb.toString()))
+ // ImageIO.write(Bitmaps.asBufferedImage(b), "png", new File("DIR","jbig2tst-" + inputFile.getName() + "-" + checksum + ".png"));
- assertArrayEquals(checksum.getBytes(), sb.toString().getBytes());
+ assertEquals("File '" + inputFile.getName(), checksum, sb.toString());
}
static class RasterChecksumCalculator
(pdfbox-jbig2) 01/02: PDFBOX-5597: do Math.ceil() when subsampling
Posted by ti...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
tilman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pdfbox-jbig2.git
commit d32c5d62db240017db96511950c58a7594b6f257
Author: Tilman Hausherr <ti...@apache.org>
AuthorDate: Thu Apr 9 16:52:16 2026 +0200
PDFBOX-5597: do Math.ceil() when subsampling
---
src/main/java/org/apache/pdfbox/jbig2/image/Bitmaps.java | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/main/java/org/apache/pdfbox/jbig2/image/Bitmaps.java b/src/main/java/org/apache/pdfbox/jbig2/image/Bitmaps.java
index 250315d..f87fe10 100644
--- a/src/main/java/org/apache/pdfbox/jbig2/image/Bitmaps.java
+++ b/src/main/java/org/apache/pdfbox/jbig2/image/Bitmaps.java
@@ -419,8 +419,8 @@ public class Bitmaps
final int xSubsamplingOffset = param.getSubsamplingXOffset();
final int ySubsamplingOffset = param.getSubsamplingYOffset();
- final int dstWidth = (src.getWidth() - xSubsamplingOffset) / xSubsampling;
- final int dstHeight = (src.getHeight() - ySubsamplingOffset) / ySubsampling;
+ final int dstWidth = (int) Math.ceil((src.getWidth() - xSubsamplingOffset) / (double) xSubsampling);
+ final int dstHeight = (int) Math.ceil((src.getHeight() - ySubsamplingOffset) / (double) ySubsampling);
final Bitmap dst = new Bitmap(dstWidth, dstHeight);
@@ -445,7 +445,7 @@ public class Bitmaps
if (src == null)
throw new IllegalArgumentException("src must not be null");
- final int dstHeight = (src.getWidth() - xSubsamplingOffset) / xSubsampling;
+ final int dstHeight = (int) Math.ceil((src.getWidth() - xSubsamplingOffset) / (double) xSubsampling);
final Bitmap dst = new Bitmap(src.getWidth(), dstHeight);
for (int yDst = 0; yDst < dst.getHeight(); yDst++)
@@ -468,7 +468,7 @@ public class Bitmaps
if (src == null)
throw new IllegalArgumentException("src must not be null");
- final int dstWidth = (src.getWidth() - ySubsamplingOffset) / ySubsampling;
+ final int dstWidth = (int) Math.ceil((src.getWidth() - ySubsamplingOffset) / (double) ySubsampling);
final Bitmap dst = new Bitmap(dstWidth, src.getHeight());
for (int yDst = 0, ySrc = ySubsamplingOffset; yDst < dst