Re-work TJBUFSIZE() to take into account the level of chrominance subsampling

git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@668 632fc199-4ca6-4c93-a231-07263d6284db
This commit is contained in:
DRC
2011-07-12 03:17:23 +00:00
parent bd1ef431b3
commit 9b49f0e4c7
41 changed files with 268 additions and 180 deletions

View File

@@ -160,7 +160,7 @@ public class TJCompressor {
public byte[] compress(int flags) throws Exception {
if(srcWidth < 1 || srcHeight < 1)
throw new Exception(NO_ASSOC_ERROR);
byte[] buf = new byte[TJ.bufSize(srcWidth, srcHeight)];
byte[] buf = new byte[TJ.bufSize(srcWidth, srcHeight, subsamp)];
compress(buf, flags);
return buf;
}
@@ -249,7 +249,7 @@ public class TJCompressor {
public byte[] compress(BufferedImage srcImage, int flags) throws Exception {
int width = srcImage.getWidth();
int height = srcImage.getHeight();
byte[] buf = new byte[TJ.bufSize(width, height)];
byte[] buf = new byte[TJ.bufSize(width, height, subsamp)];
compress(srcImage, buf, flags);
return buf;
}