TJBench: w/JPEG input imgs, set min tile= MCU size

When -tile is used with a JPEG input image, TJBench generates the tiles
using lossless cropping, which will fail if the cropping region doesn't
align with an MCU boundary.  Furthermore, there is no reason to avoid
8x8 tiles when decompressing 4:4:4 or grayscale JPEG images.
This commit is contained in:
DRC
2023-03-13 13:11:19 -05:00
parent fc881ebb21
commit 386ec0abc7
2 changed files with 7 additions and 5 deletions

View File

@@ -530,7 +530,7 @@ final class TJBench {
// Original image
int w = 0, h = 0, ntilesw = 1, ntilesh = 1, subsamp = -1, cs = -1;
// Transformed image
int tw, th, ttilew, ttileh, tntilesw, tntilesh, tsubsamp;
int minTile, tw, th, ttilew, ttileh, tntilesw, tntilesh, tsubsamp;
FileInputStream fis = new FileInputStream(fileName);
if (fis.getChannel().size() > (long)Integer.MAX_VALUE)
@@ -593,7 +593,8 @@ final class TJBench {
precision, formatName(subsamp, cs), PIXFORMATSTR[pf],
bottomUp ? "Bottom-up" : "Top-down");
for (int tilew = doTile ? 16 : w, tileh = doTile ? 16 : h; ;
minTile = Math.max(TJ.getMCUWidth(subsamp), TJ.getMCUHeight(subsamp));
for (int tilew = doTile ? minTile : w, tileh = doTile ? minTile : h; ;
tilew *= 2, tileh *= 2) {
if (tilew > w)
tilew = w;