From 608840a320cd85e6d7e3d8a4cba112418a49aa98 Mon Sep 17 00:00:00 2001 From: dcommander Date: Tue, 8 Feb 2011 02:11:37 +0000 Subject: Use Java capitalization conventions git-svn-id: svn://svn.code.sf.net/p/libjpeg-turbo/code/trunk@357 632fc199-4ca6-4c93-a231-07263d6284db --- java/README | 8 ++-- java/TJ.h | 4 +- java/TJCompressor.h | 37 +++++++++++++++ java/TJDecompressor.h | 45 ++++++++++++++++++ java/TJExample.java | 91 +++++++++++++++++++++++++++++++++++++ java/TurboJPEG.java | 123 ++++++++++++++++++++++++++++++++++++++++++++++++++ java/tjCompressor.h | 37 --------------- java/tjDecompressor.h | 45 ------------------ java/tjexample.java | 91 ------------------------------------- java/turbojpeg.java | 123 -------------------------------------------------- turbojpeg-jni.c | 24 +++++----- turbojpeg-mapfile.jni | 16 +++---- 12 files changed, 322 insertions(+), 322 deletions(-) create mode 100644 java/TJCompressor.h create mode 100644 java/TJDecompressor.h create mode 100644 java/TJExample.java create mode 100644 java/TurboJPEG.java delete mode 100644 java/tjCompressor.h delete mode 100644 java/tjDecompressor.h delete mode 100644 java/tjexample.java delete mode 100644 java/turbojpeg.java diff --git a/java/README b/java/README index 8b6f5bc..0146ed3 100644 --- a/java/README +++ b/java/README @@ -4,12 +4,12 @@ TurboJPEG/OSS JNI Wrapper TurboJPEG/OSS can optionally be built with a Java Native Interface wrapper, which allows the TurboJPEG/OSS dynamic library to be loaded and used directly from Java applications. The Java front end for this is defined in -turbojpeg.java, which should be located in the same directory as this README -file. turbojpeg.java is licensed under a BSD-style license, so it can be +TurboJPEG.java, which should be located in the same directory as this README +file. TurboJPEG.java is licensed under a BSD-style license, so it can be incorporated directly into both open source and proprietary projects without restriction. -tjexample.java, which should also be located in the same directory as this +TJExample.java, which should also be located in the same directory as this README file, demonstrates how to use the TurboJPEG/OSS Java front end to compress and decompress JPEG images in memory. @@ -48,5 +48,5 @@ convention of MinGW, and it also avoids a filename conflict when the GCC and Visual C++ versions of the libjpeg-turbo SDK are installed on the same system. However, the TurboJPEG/OSS JNI wrapper will not work on Windows unless the DLL is named turbojpeg.dll. You can work around this by renaming the DLL or by -simply changing the LoadLibrary() calls in turbojpeg.java so that they load +simply changing the LoadLibrary() calls in TurboJPEG.java so that they load "libturbojpeg" instead of "turbojpeg". diff --git a/java/TJ.h b/java/TJ.h index 7be782d..2527117 100644 --- a/java/TJ.h +++ b/java/TJ.h @@ -35,10 +35,10 @@ extern "C" { #define TJ_YUV 512L /* * Class: TJ - * Method: BUFSIZE + * Method: bufSize * Signature: (II)J */ -JNIEXPORT jlong JNICALL Java_TJ_BUFSIZE +JNIEXPORT jlong JNICALL Java_TJ_bufSize (JNIEnv *, jclass, jint, jint); #ifdef __cplusplus diff --git a/java/TJCompressor.h b/java/TJCompressor.h new file mode 100644 index 0000000..15e659f --- /dev/null +++ b/java/TJCompressor.h @@ -0,0 +1,37 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class TJCompressor */ + +#ifndef _Included_TJCompressor +#define _Included_TJCompressor +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: TJCompressor + * Method: init + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_TJCompressor_init + (JNIEnv *, jobject); + +/* + * Class: TJCompressor + * Method: destroy + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_TJCompressor_destroy + (JNIEnv *, jobject); + +/* + * Class: TJCompressor + * Method: compress + * Signature: ([BIIII[BIII)J + */ +JNIEXPORT jlong JNICALL Java_TJCompressor_compress + (JNIEnv *, jobject, jbyteArray, jint, jint, jint, jint, jbyteArray, jint, jint, jint); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/java/TJDecompressor.h b/java/TJDecompressor.h new file mode 100644 index 0000000..4b61ac9 --- /dev/null +++ b/java/TJDecompressor.h @@ -0,0 +1,45 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class TJDecompressor */ + +#ifndef _Included_TJDecompressor +#define _Included_TJDecompressor +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: TJDecompressor + * Method: init + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_TJDecompressor_init + (JNIEnv *, jobject); + +/* + * Class: TJDecompressor + * Method: destroy + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_TJDecompressor_destroy + (JNIEnv *, jobject); + +/* + * Class: TJDecompressor + * Method: decompressHeader + * Signature: ([BJ)LTJHeaderInfo; + */ +JNIEXPORT jobject JNICALL Java_TJDecompressor_decompressHeader + (JNIEnv *, jobject, jbyteArray, jlong); + +/* + * Class: TJDecompressor + * Method: decompress + * Signature: ([BJ[BIIIII)V + */ +JNIEXPORT void JNICALL Java_TJDecompressor_decompress + (JNIEnv *, jobject, jbyteArray, jlong, jbyteArray, jint, jint, jint, jint, jint); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/java/TJExample.java b/java/TJExample.java new file mode 100644 index 0000000..991b8eb --- /dev/null +++ b/java/TJExample.java @@ -0,0 +1,91 @@ +/* + * Copyright (C)2011 D. R. Commander. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the libjpeg-turbo Project nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS", + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * This program demonstrates how to compress and decompress JPEG files using + * the TurboJPEG JNI wrapper + */ + +import java.io.*; + +public class TJExample { + + public static final String classname=new TJExample().getClass().getName(); + + public static void main(String argv[]) { + + try { + + if(argv.length<2) { + System.out.println("USAGE: java "+classname+" "); + System.exit(1); + } + + File file=new File(argv[0]); + FileInputStream fis=new FileInputStream(file); + int inputsize=fis.available(); + if(inputsize<1) { + System.out.println("Input file contains no data"); + System.exit(1); + } + byte [] inputbuf=new byte[inputsize]; + fis.read(inputbuf); + fis.close(); + + TJDecompressor tjd=new TJDecompressor(); + TJHeaderInfo tji=tjd.decompressHeader(inputbuf, inputsize); + System.out.print("Source Image: "+tji.width+" x "+tji.height+ " pixels, "); + switch(tji.subsamp) { + case TJ.SAMP444: System.out.println("4:4:4 subsampling"); break; + case TJ.SAMP422: System.out.println("4:2:2 subsampling"); break; + case TJ.SAMP420: System.out.println("4:2:0 subsampling"); break; + case TJ.GRAYSCALE: System.out.println("Grayscale"); break; + default: System.out.println("Unknown subsampling"); break; + } + byte [] tmpbuf=new byte[tji.width*tji.height*3]; + tjd.decompress(inputbuf, inputsize, tmpbuf, tji.width, tji.width*3, + tji.height, 3, TJ.BOTTOMUP); + tjd.close(); + + TJCompressor tjc=new TJCompressor(); + byte [] outputbuf=new byte[(int)TJ.bufSize(tji.width, tji.height)]; + long outputsize=tjc.compress(tmpbuf, tji.width, tji.width*3, tji.height, + 3, outputbuf, tji.subsamp, 95, TJ.BOTTOMUP); + tjc.close(); + + file=new File(argv[1]); + FileOutputStream fos=new FileOutputStream(file); + fos.write(outputbuf, 0, (int)outputsize); + fos.close(); + + } catch(Exception e) { + System.out.println(e); + } + } + +}; diff --git a/java/TurboJPEG.java b/java/TurboJPEG.java new file mode 100644 index 0000000..0d08edc --- /dev/null +++ b/java/TurboJPEG.java @@ -0,0 +1,123 @@ +/* + * Copyright (C)2011 D. R. Commander. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the libjpeg-turbo Project nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS", + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +final class TJ { + + // Subsampling options + final static int + SAMP444 = 0, + SAMP422 = 1, + SAMP420 = 2, + GRAYSCALE = 3; + + // Flags + final static int + BGR = 1, + BOTTOMUP = 2, + FORCEMMX = 8, + FORCESSE = 16, + FORCESSE2 = 32, + ALPHAFIRST = 64, + FORCESSE3 = 128, + FASTUPSAMPLE = 256, + YUV = 512; + + public native final static long bufSize(int width, int height); +}; + +class TJCompressor { + + TJCompressor() throws Exception {init();} + + public void close() throws Exception {destroy();} + + protected void finalize() throws Throwable { + try { + close(); + } catch(Exception e) { + } + finally { + super.finalize(); + } + }; + + private native void init() throws Exception; + + private native void destroy() throws Exception; + + // JPEG size in bytes is returned + public native long compress(byte [] srcbuf, int width, int pitch, + int height, int pixelsize, byte [] dstbuf, int jpegsubsamp, int jpegqual, + int flags) throws Exception; + + static { + System.loadLibrary("turbojpeg"); + } + + private long handle=0; +}; + +class TJHeaderInfo { + int subsamp=-1; + int width=-1; + int height=-1; +}; + +class TJDecompressor { + + TJDecompressor() throws Exception {init();} + + public void close() throws Exception {destroy();} + + protected void finalize() throws Throwable { + try { + close(); + } catch(Exception e) { + } + finally { + super.finalize(); + } + }; + + private native void init() throws Exception; + + private native void destroy() throws Exception; + + public native TJHeaderInfo decompressHeader(byte [] srcbuf, long size) + throws Exception; + + public native void decompress(byte [] srcbuf, long size, byte [] dstbuf, + int width, int pitch, int height, int pixelsize, int flags) + throws Exception; + + static { + System.loadLibrary("turbojpeg"); + } + + private long handle=0; +}; diff --git a/java/tjCompressor.h b/java/tjCompressor.h deleted file mode 100644 index fa2c5ff..0000000 --- a/java/tjCompressor.h +++ /dev/null @@ -1,37 +0,0 @@ -/* DO NOT EDIT THIS FILE - it is machine generated */ -#include -/* Header for class tjCompressor */ - -#ifndef _Included_tjCompressor -#define _Included_tjCompressor -#ifdef __cplusplus -extern "C" { -#endif -/* - * Class: tjCompressor - * Method: Init - * Signature: ()V - */ -JNIEXPORT void JNICALL Java_tjCompressor_Init - (JNIEnv *, jobject); - -/* - * Class: tjCompressor - * Method: Destroy - * Signature: ()V - */ -JNIEXPORT void JNICALL Java_tjCompressor_Destroy - (JNIEnv *, jobject); - -/* - * Class: tjCompressor - * Method: Compress - * Signature: ([BIIII[BIII)J - */ -JNIEXPORT jlong JNICALL Java_tjCompressor_Compress - (JNIEnv *, jobject, jbyteArray, jint, jint, jint, jint, jbyteArray, jint, jint, jint); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/java/tjDecompressor.h b/java/tjDecompressor.h deleted file mode 100644 index 498112b..0000000 --- a/java/tjDecompressor.h +++ /dev/null @@ -1,45 +0,0 @@ -/* DO NOT EDIT THIS FILE - it is machine generated */ -#include -/* Header for class tjDecompressor */ - -#ifndef _Included_tjDecompressor -#define _Included_tjDecompressor -#ifdef __cplusplus -extern "C" { -#endif -/* - * Class: tjDecompressor - * Method: Init - * Signature: ()V - */ -JNIEXPORT void JNICALL Java_tjDecompressor_Init - (JNIEnv *, jobject); - -/* - * Class: tjDecompressor - * Method: Destroy - * Signature: ()V - */ -JNIEXPORT void JNICALL Java_tjDecompressor_Destroy - (JNIEnv *, jobject); - -/* - * Class: tjDecompressor - * Method: DecompressHeader - * Signature: ([BJ)LtjHeaderInfo; - */ -JNIEXPORT jobject JNICALL Java_tjDecompressor_DecompressHeader - (JNIEnv *, jobject, jbyteArray, jlong); - -/* - * Class: tjDecompressor - * Method: Decompress - * Signature: ([BJ[BIIIII)V - */ -JNIEXPORT void JNICALL Java_tjDecompressor_Decompress - (JNIEnv *, jobject, jbyteArray, jlong, jbyteArray, jint, jint, jint, jint, jint); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/java/tjexample.java b/java/tjexample.java deleted file mode 100644 index 5f92333..0000000 --- a/java/tjexample.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (C)2011 D. R. Commander. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * - Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - Neither the name of the libjpeg-turbo Project nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS", - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * This program demonstrates how to compress and decompress JPEG files using - * the TurboJPEG JNI wrapper - */ - -import java.io.*; - -public class tjexample { - - public static final String classname=new tjexample().getClass().getName(); - - public static void main(String argv[]) { - - try { - - if(argv.length<2) { - System.out.println("USAGE: java "+classname+" "); - System.exit(1); - } - - File file=new File(argv[0]); - FileInputStream fis=new FileInputStream(file); - int inputsize=fis.available(); - if(inputsize<1) { - System.out.println("Input file contains no data"); - System.exit(1); - } - byte [] inputbuf=new byte[inputsize]; - fis.read(inputbuf); - fis.close(); - - tjDecompressor tjd=new tjDecompressor(); - tjHeaderInfo tji=tjd.DecompressHeader(inputbuf, inputsize); - System.out.print("Source Image: "+tji.width+" x "+tji.height+ " pixels, "); - switch(tji.subsamp) { - case TJ.SAMP444: System.out.println("4:4:4 subsampling"); break; - case TJ.SAMP422: System.out.println("4:2:2 subsampling"); break; - case TJ.SAMP420: System.out.println("4:2:0 subsampling"); break; - case TJ.GRAYSCALE: System.out.println("Grayscale"); break; - default: System.out.println("Unknown subsampling"); break; - } - byte [] tmpbuf=new byte[tji.width*tji.height*3]; - tjd.Decompress(inputbuf, inputsize, tmpbuf, tji.width, tji.width*3, - tji.height, 3, TJ.BOTTOMUP); - tjd.close(); - - tjCompressor tjc=new tjCompressor(); - byte [] outputbuf=new byte[(int)TJ.BUFSIZE(tji.width, tji.height)]; - long outputsize=tjc.Compress(tmpbuf, tji.width, tji.width*3, tji.height, - 3, outputbuf, tji.subsamp, 95, TJ.BOTTOMUP); - tjc.close(); - - file=new File(argv[1]); - FileOutputStream fos=new FileOutputStream(file); - fos.write(outputbuf, 0, (int)outputsize); - fos.close(); - - } catch(Exception e) { - System.out.println(e); - } - } - -}; diff --git a/java/turbojpeg.java b/java/turbojpeg.java deleted file mode 100644 index e5ecca7..0000000 --- a/java/turbojpeg.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (C)2011 D. R. Commander. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * - Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - Neither the name of the libjpeg-turbo Project nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS", - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -final class TJ { - - // Subsampling options - final static int - SAMP444 = 0, - SAMP422 = 1, - SAMP420 = 2, - GRAYSCALE = 3; - - // Flags - final static int - BGR = 1, - BOTTOMUP = 2, - FORCEMMX = 8, - FORCESSE = 16, - FORCESSE2 = 32, - ALPHAFIRST = 64, - FORCESSE3 = 128, - FASTUPSAMPLE = 256, - YUV = 512; - - public native final static long BUFSIZE(int width, int height); -}; - -class tjCompressor { - - tjCompressor() throws Exception {Init();} - - public void close() throws Exception {Destroy();} - - protected void finalize() throws Throwable { - try { - close(); - } catch(Exception e) { - } - finally { - super.finalize(); - } - }; - - private native void Init() throws Exception; - - private native void Destroy() throws Exception; - - // JPEG size in bytes is returned - public native long Compress(byte [] srcbuf, int width, int pitch, - int height, int pixelsize, byte [] dstbuf, int jpegsubsamp, int jpegqual, - int flags) throws Exception; - - static { - System.loadLibrary("turbojpeg"); - } - - private long handle=0; -}; - -class tjHeaderInfo { - int subsamp=-1; - int width=-1; - int height=-1; -}; - -class tjDecompressor { - - tjDecompressor() throws Exception {Init();} - - public void close() throws Exception {Destroy();} - - protected void finalize() throws Throwable { - try { - close(); - } catch(Exception e) { - } - finally { - super.finalize(); - } - }; - - private native void Init() throws Exception; - - private native void Destroy() throws Exception; - - public native tjHeaderInfo DecompressHeader(byte [] srcbuf, long size) - throws Exception; - - public native void Decompress(byte [] srcbuf, long size, byte [] dstbuf, - int width, int pitch, int height, int pixelsize, int flags) - throws Exception; - - static { - System.loadLibrary("turbojpeg"); - } - - private long handle=0; -}; diff --git a/turbojpeg-jni.c b/turbojpeg-jni.c index 961f9ef..c0992a4 100644 --- a/turbojpeg-jni.c +++ b/turbojpeg-jni.c @@ -28,8 +28,8 @@ #include "turbojpeg.h" #include -#include "java/tjCompressor.h" -#include "java/tjDecompressor.h" +#include "java/TJCompressor.h" +#include "java/TJDecompressor.h" #include "java/TJ.h" #define _throw(msg) { \ @@ -49,13 +49,13 @@ handle=(tjhandle)(long)(*env)->GetLongField(env, obj, _fid); \ } -JNIEXPORT jlong JNICALL Java_TJ_BUFSIZE +JNIEXPORT jlong JNICALL Java_TJ_bufSize (JNIEnv *env, jclass cls, jint width, jint height) { return TJBUFSIZE(width, height); } -JNIEXPORT void JNICALL Java_tjCompressor_Init +JNIEXPORT void JNICALL Java_TJCompressor_init (JNIEnv *env, jobject obj) { jclass cls; @@ -73,7 +73,7 @@ JNIEXPORT void JNICALL Java_tjCompressor_Init return; } -JNIEXPORT jlong JNICALL Java_tjCompressor_Compress +JNIEXPORT jlong JNICALL Java_TJCompressor_compress (JNIEnv *env, jobject obj, jbyteArray src, jint width, jint pitch, jint height, jint pixelsize, jbyteArray dst, jint jpegsubsamp, jint jpegqual, jint flags) @@ -101,7 +101,7 @@ JNIEXPORT jlong JNICALL Java_tjCompressor_Compress return size; } -JNIEXPORT void JNICALL Java_tjCompressor_Destroy +JNIEXPORT void JNICALL Java_TJCompressor_destroy (JNIEnv *env, jobject obj) { tjhandle handle=0; @@ -114,7 +114,7 @@ JNIEXPORT void JNICALL Java_tjCompressor_Destroy return; } -JNIEXPORT void JNICALL Java_tjDecompressor_Init +JNIEXPORT void JNICALL Java_TJDecompressor_init (JNIEnv *env, jobject obj) { jclass cls; @@ -131,7 +131,7 @@ JNIEXPORT void JNICALL Java_tjDecompressor_Init return; } -JNIEXPORT jobject JNICALL Java_tjDecompressor_DecompressHeader +JNIEXPORT jobject JNICALL Java_TJDecompressor_decompressHeader (JNIEnv *env, jobject obj, jbyteArray src, jlong size) { jclass jhicls=NULL; @@ -153,7 +153,7 @@ JNIEXPORT jobject JNICALL Java_tjDecompressor_DecompressHeader } (*env)->ReleasePrimitiveArrayCritical(env, src, srcbuf, 0); srcbuf=NULL; - bailif0(jhicls=(*env)->FindClass(env, "tjHeaderInfo")); + bailif0(jhicls=(*env)->FindClass(env, "TJHeaderInfo")); bailif0(jhiobj=(*env)->AllocObject(env, jhicls)); bailif0(fid=(*env)->GetFieldID(env, jhicls, "subsamp", "I")); @@ -167,7 +167,7 @@ JNIEXPORT jobject JNICALL Java_tjDecompressor_DecompressHeader return jhiobj; } -JNIEXPORT void JNICALL Java_tjDecompressor_Decompress +JNIEXPORT void JNICALL Java_TJDecompressor_decompress (JNIEnv *env, jobject obj, jbyteArray src, jlong size, jbyteArray dst, jint width, jint pitch, jint height, jint pixelsize, jint flags) { @@ -193,8 +193,8 @@ JNIEXPORT void JNICALL Java_tjDecompressor_Decompress return; } -JNIEXPORT void JNICALL Java_tjDecompressor_Destroy +JNIEXPORT void JNICALL Java_TJDecompressor_destroy (JNIEnv *env, jobject obj) { - Java_tjCompressor_Destroy(env, obj); + Java_TJCompressor_destroy(env, obj); } diff --git a/turbojpeg-mapfile.jni b/turbojpeg-mapfile.jni index 47199f2..0b1d1bd 100755 --- a/turbojpeg-mapfile.jni +++ b/turbojpeg-mapfile.jni @@ -9,14 +9,14 @@ tjDecompress; tjDestroy; tjGetErrorStr; - Java_TJ_BUFSIZE; - Java_tjCompressor_Init; - Java_tjCompressor_Compress; - Java_tjCompressor_Destroy; - Java_tjDecompressor_Init; - Java_tjDecompressor_DecompressHeader; - Java_tjDecompressor_Decompress; - Java_tjDecompressor_Destroy; + Java_TJ_bufSize; + Java_TJCompressor_init; + Java_TJCompressor_compress; + Java_TJCompressor_destroy; + Java_TJDecompressor_init; + Java_TJDecompressor_decompressHeader; + Java_TJDecompressor_decompress; + Java_TJDecompressor_destroy; local: *; }; -- cgit v1.2.3