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:
@@ -499,7 +499,7 @@ final class TJBench {
|
|||||||
// Original image
|
// Original image
|
||||||
int w = 0, h = 0, ntilesw = 1, ntilesh = 1, subsamp = -1, cs = -1;
|
int w = 0, h = 0, ntilesw = 1, ntilesh = 1, subsamp = -1, cs = -1;
|
||||||
// Transformed image
|
// Transformed image
|
||||||
int tw, th, ttilew, ttileh, tntilesw, tntilesh, tsubsamp;
|
int minTile, tw, th, ttilew, ttileh, tntilesw, tntilesh, tsubsamp;
|
||||||
|
|
||||||
FileInputStream fis = new FileInputStream(fileName);
|
FileInputStream fis = new FileInputStream(fileName);
|
||||||
if (fis.getChannel().size() > (long)Integer.MAX_VALUE)
|
if (fis.getChannel().size() > (long)Integer.MAX_VALUE)
|
||||||
@@ -541,7 +541,8 @@ final class TJBench {
|
|||||||
(flags & TJ.FLAG_BOTTOMUP) != 0 ?
|
(flags & TJ.FLAG_BOTTOMUP) != 0 ?
|
||||||
"Bottom-up" : "Top-down");
|
"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) {
|
tilew *= 2, tileh *= 2) {
|
||||||
if (tilew > w)
|
if (tilew > w)
|
||||||
tilew = w;
|
tilew = w;
|
||||||
|
|||||||
@@ -534,8 +534,8 @@ static int decompTest(char *fileName)
|
|||||||
int ps = tjPixelSize[pf], tile, row, col, i, iter, retval = 0, decompsrc = 0;
|
int ps = tjPixelSize[pf], tile, row, col, i, iter, retval = 0, decompsrc = 0;
|
||||||
char *temp = NULL, tempStr[80], tempStr2[80];
|
char *temp = NULL, tempStr[80], tempStr2[80];
|
||||||
/* Original image */
|
/* Original image */
|
||||||
int w = 0, h = 0, tilew, tileh, ntilesw = 1, ntilesh = 1, subsamp = -1,
|
int w = 0, h = 0, minTile, tilew, tileh, ntilesw = 1, ntilesh = 1,
|
||||||
cs = -1;
|
subsamp = -1, cs = -1;
|
||||||
/* Transformed image */
|
/* Transformed image */
|
||||||
int tw, th, ttilew, ttileh, tntilesw, tntilesh, tsubsamp;
|
int tw, th, ttilew, ttileh, tntilesw, tntilesh, tsubsamp;
|
||||||
|
|
||||||
@@ -580,7 +580,8 @@ static int decompTest(char *fileName)
|
|||||||
formatName(subsamp, cs, tempStr), pixFormatStr[pf],
|
formatName(subsamp, cs, tempStr), pixFormatStr[pf],
|
||||||
(flags & TJFLAG_BOTTOMUP) ? "Bottom-up" : "Top-down");
|
(flags & TJFLAG_BOTTOMUP) ? "Bottom-up" : "Top-down");
|
||||||
|
|
||||||
for (tilew = doTile ? 16 : w, tileh = doTile ? 16 : h; ;
|
minTile = max(tjMCUWidth[subsamp], tjMCUHeight[subsamp]);
|
||||||
|
for (tilew = doTile ? minTile : w, tileh = doTile ? minTile : h; ;
|
||||||
tilew *= 2, tileh *= 2) {
|
tilew *= 2, tileh *= 2) {
|
||||||
if (tilew > w) tilew = w;
|
if (tilew > w) tilew = w;
|
||||||
if (tileh > h) tileh = h;
|
if (tileh > h) tileh = h;
|
||||||
|
|||||||
Reference in New Issue
Block a user