Streamline Java wrapper

git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@424 632fc199-4ca6-4c93-a231-07263d6284db
This commit is contained in:
DRC
2011-02-22 10:27:31 +00:00
parent 4e8ae08b00
commit 36336fcddc
8 changed files with 262 additions and 30 deletions

View File

@@ -32,22 +32,61 @@ final public class TJ {
// Subsampling options
final public static int
NUMSUBOPT = 4,
SAMP444 = 0,
SAMP422 = 1,
SAMP420 = 2,
GRAYSCALE = 3;
// Pixel formats
final public static int
NUMPIXFORMATS = 7,
RGB = 0,
BGR = 1,
RGBX = 2,
BGRX = 3,
XBGR = 4,
XRGB = 5,
YUV = 6;
final public static int pixelSize[] = {
3, 3, 4, 4, 4, 4, 3
};
public static int getPixelSize(int pixelFormat) throws Exception {
if(pixelFormat < 0 || pixelFormat >= NUMPIXFORMATS)
throw new Exception("Invalid pixel format");
return pixelSize[pixelFormat];
}
// Flags
final public static int
BGR = 1,
BOTTOMUP = 2,
FORCEMMX = 8,
FORCESSE = 16,
FORCESSE2 = 32,
ALPHAFIRST = 64,
FORCESSE3 = 128,
FASTUPSAMPLE = 256,
YUV = 512;
FASTUPSAMPLE = 256;
public native final static long bufSize(int width, int height);
final private static int
TJ_BGR = 1,
TJ_ALPHAFIRST = 64,
TJ_YUV = 512;
final private static int flags[] = {
0, TJ_BGR, 0, TJ_BGR, TJ_BGR|TJ_ALPHAFIRST, TJ_ALPHAFIRST, TJ_YUV
};
public static int getFlags(int pixelFormat) throws Exception {
if(pixelFormat < 0 || pixelFormat >= NUMPIXFORMATS)
throw new Exception("Invalid pixel format");
return flags[pixelFormat];
}
public native final static long bufSize(int width, int height)
throws Exception;
public native final static long bufSizeYUV(int width, int height,
int subsamp)
throws Exception;
};