Java: Reformat code per checkstyle recommendations

... and modify tjbench.c to match the variable name changes made to
TJBench.java

("checkstyle" = http://checkstyle.sourceforge.net, not our regex-based
checkstyle script)
This commit is contained in:
DRC
2018-05-15 14:51:49 -05:00
parent 2401e4d10c
commit 53bb941845
14 changed files with 317 additions and 271 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C)2011-2015 D. R. Commander. All Rights Reserved.
* Copyright (C)2011-2015, 2018 D. R. Commander. All Rights Reserved.
* Copyright (C)2015 Viktor Szathmáry. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -77,6 +77,7 @@ public class TJCompressor implements Closeable {
* @deprecated Use
* {@link #TJCompressor(byte[], int, int, int, int, int, int)} instead.
*/
@SuppressWarnings("checkstyle:JavadocMethod")
@Deprecated
public TJCompressor(byte[] srcImage, int width, int pitch, int height,
int pixelFormat) throws TJException {
@@ -164,6 +165,7 @@ public class TJCompressor implements Closeable {
* @deprecated Use
* {@link #setSourceImage(byte[], int, int, int, int, int, int)} instead.
*/
@SuppressWarnings("checkstyle:JavadocMethod")
@Deprecated
public void setSourceImage(byte[] srcImage, int width, int pitch,
int height, int pixelFormat) throws TJException {
@@ -386,6 +388,7 @@ public class TJCompressor implements Closeable {
* {@link #setSourceImage(BufferedImage, int, int, int, int)} and
* {@link #compress(byte[], int)} instead.
*/
@SuppressWarnings("checkstyle:JavadocMethod")
@Deprecated
public void compress(BufferedImage srcImage, byte[] dstBuf, int flags)
throws TJException {
@@ -398,6 +401,7 @@ public class TJCompressor implements Closeable {
* {@link #setSourceImage(BufferedImage, int, int, int, int)} and
* {@link #compress(int)} instead.
*/
@SuppressWarnings("checkstyle:JavadocMethod")
@Deprecated
public byte[] compress(BufferedImage srcImage, int flags)
throws TJException {
@@ -445,14 +449,16 @@ public class TJCompressor implements Closeable {
/**
* @deprecated Use {@link #encodeYUV(YUVImage, int)} instead.
*/
@SuppressWarnings("checkstyle:JavadocMethod")
@Deprecated
public void encodeYUV(byte[] dstBuf, int flags) throws TJException {
if (dstBuf == null)
throw new IllegalArgumentException("Invalid argument in encodeYUV()");
checkSourceImage();
checkSubsampling();
YUVImage yuvImage = new YUVImage(dstBuf, srcWidth, 4, srcHeight, subsamp);
encodeYUV(yuvImage, flags);
YUVImage dstYUVImage = new YUVImage(dstBuf, srcWidth, 4, srcHeight,
subsamp);
encodeYUV(dstYUVImage, flags);
}
/**
@@ -477,9 +483,9 @@ public class TJCompressor implements Closeable {
checkSubsampling();
if (pad < 1 || ((pad & (pad - 1)) != 0))
throw new IllegalStateException("Invalid argument in encodeYUV()");
YUVImage yuvImage = new YUVImage(srcWidth, pad, srcHeight, subsamp);
encodeYUV(yuvImage, flags);
return yuvImage;
YUVImage dstYUVImage = new YUVImage(srcWidth, pad, srcHeight, subsamp);
encodeYUV(dstYUVImage, flags);
return dstYUVImage;
}
/**
@@ -506,21 +512,22 @@ public class TJCompressor implements Closeable {
public YUVImage encodeYUV(int[] strides, int flags) throws TJException {
checkSourceImage();
checkSubsampling();
YUVImage yuvImage = new YUVImage(srcWidth, strides, srcHeight, subsamp);
encodeYUV(yuvImage, flags);
return yuvImage;
YUVImage dstYUVImage = new YUVImage(srcWidth, strides, srcHeight, subsamp);
encodeYUV(dstYUVImage, flags);
return dstYUVImage;
}
/**
* @deprecated Use {@link #encodeYUV(int, int)} instead.
*/
@SuppressWarnings("checkstyle:JavadocMethod")
@Deprecated
public byte[] encodeYUV(int flags) throws TJException {
checkSourceImage();
checkSubsampling();
YUVImage yuvImage = new YUVImage(srcWidth, 4, srcHeight, subsamp);
encodeYUV(yuvImage, flags);
return yuvImage.getBuf();
YUVImage dstYUVImage = new YUVImage(srcWidth, 4, srcHeight, subsamp);
encodeYUV(dstYUVImage, flags);
return dstYUVImage.getBuf();
}
/**
@@ -528,6 +535,7 @@ public class TJCompressor implements Closeable {
* {@link #setSourceImage(BufferedImage, int, int, int, int)} and
* {@link #encodeYUV(byte[], int)} instead.
*/
@SuppressWarnings("checkstyle:JavadocMethod")
@Deprecated
public void encodeYUV(BufferedImage srcImage, byte[] dstBuf, int flags)
throws TJException {
@@ -540,6 +548,7 @@ public class TJCompressor implements Closeable {
* {@link #setSourceImage(BufferedImage, int, int, int, int)} and
* {@link #encodeYUV(int, int)} instead.
*/
@SuppressWarnings("checkstyle:JavadocMethod")
@Deprecated
public byte[] encodeYUV(BufferedImage srcImage, int flags)
throws TJException {
@@ -567,6 +576,7 @@ public class TJCompressor implements Closeable {
destroy();
}
@SuppressWarnings("checkstyle:DesignForExtension")
@Override
protected void finalize() throws Throwable {
try {
@@ -582,44 +592,53 @@ public class TJCompressor implements Closeable {
private native void destroy() throws TJException;
// JPEG size in bytes is returned
@SuppressWarnings("checkstyle:HiddenField")
@Deprecated
private native int compress(byte[] srcBuf, int width, int pitch,
int height, int pixelFormat, byte[] dstBuf, int jpegSubsamp, int jpegQual,
int height, int pixelFormat, byte[] jpegBuf, int jpegSubsamp, int jpegQual,
int flags) throws TJException;
@SuppressWarnings("checkstyle:HiddenField")
private native int compress(byte[] srcBuf, int x, int y, int width,
int pitch, int height, int pixelFormat, byte[] dstBuf, int jpegSubsamp,
int pitch, int height, int pixelFormat, byte[] jpegBuf, int jpegSubsamp,
int jpegQual, int flags) throws TJException;
@SuppressWarnings("checkstyle:HiddenField")
@Deprecated
private native int compress(int[] srcBuf, int width, int stride,
int height, int pixelFormat, byte[] dstBuf, int jpegSubsamp, int jpegQual,
int height, int pixelFormat, byte[] jpegBuf, int jpegSubsamp, int jpegQual,
int flags) throws TJException;
@SuppressWarnings("checkstyle:HiddenField")
private native int compress(int[] srcBuf, int x, int y, int width,
int stride, int height, int pixelFormat, byte[] dstBuf, int jpegSubsamp,
int stride, int height, int pixelFormat, byte[] jpegBuf, int jpegSubsamp,
int jpegQual, int flags) throws TJException;
@SuppressWarnings("checkstyle:HiddenField")
private native int compressFromYUV(byte[][] srcPlanes, int[] srcOffsets,
int width, int[] srcStrides, int height, int subsamp, byte[] dstBuf,
int width, int[] srcStrides, int height, int subsamp, byte[] jpegBuf,
int jpegQual, int flags)
throws TJException;
@SuppressWarnings("checkstyle:HiddenField")
@Deprecated
private native void encodeYUV(byte[] srcBuf, int width, int pitch,
int height, int pixelFormat, byte[] dstBuf, int subsamp, int flags)
throws TJException;
@SuppressWarnings("checkstyle:HiddenField")
private native void encodeYUV(byte[] srcBuf, int x, int y, int width,
int pitch, int height, int pixelFormat, byte[][] dstPlanes,
int[] dstOffsets, int[] dstStrides, int subsamp, int flags)
throws TJException;
@SuppressWarnings("checkstyle:HiddenField")
@Deprecated
private native void encodeYUV(int[] srcBuf, int width, int stride,
int height, int pixelFormat, byte[] dstBuf, int subsamp, int flags)
throws TJException;
@SuppressWarnings("checkstyle:HiddenField")
private native void encodeYUV(int[] srcBuf, int x, int y, int width,
int srcStride, int height, int pixelFormat, byte[][] dstPlanes,
int[] dstOffsets, int[] dstStrides, int subsamp, int flags)