Implement YUV encode/decode methods at the Java level; Remove some of the arguments from the Java API and replace with get/set methods; General API cleanup; Fix BufferedImage grayscale tests in TJUnitTest

This commit is contained in:
DRC
2011-02-25 06:11:03 +00:00
parent 7ce8dfe258
commit 8755a6805a
10 changed files with 657 additions and 345 deletions

View File

@@ -150,10 +150,8 @@ public class TJExample {
height = (height + scaleFactor - 1)/scaleFactor;
}
if(!outFormat.equalsIgnoreCase("jpg")) {
img = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
tjd.decompress(img, 0);
}
if(!outFormat.equalsIgnoreCase("jpg"))
img = tjd.decompress(width, height, BufferedImage.TYPE_INT_RGB, 0);
else bmpBuf = tjd.decompress(width, 0, height, TJ.PF_BGRX, 0);
tjd.close();
}
@@ -175,14 +173,17 @@ public class TJExample {
+ " subsampling, quality = " + outQual);
TJCompressor tjc = new TJCompressor();
int jpegSize;
byte [] jpegBuf = new byte[TJ.bufSize(width, height)];
byte [] jpegBuf;
tjc.setSubsamp(outSubsamp);
tjc.setJPEGQuality(outQual);
if(img != null)
jpegSize = tjc.compress(img, jpegBuf, outSubsamp, outQual, 0);
jpegBuf = tjc.compress(img, 0);
else {
tjc.setBitmapBuffer(bmpBuf, width, 0, height, TJ.PF_BGRX);
jpegSize = tjc.compress(jpegBuf, outSubsamp, outQual, 0);
jpegBuf = tjc.compress(0);
}
jpegSize = tjc.getCompressedSize();
tjc.close();
file = new File(argv[1]);