Repo created

This commit is contained in:
Fr4nz D13trich 2025-11-22 14:04:28 +01:00
parent 81b91f4139
commit f8c34fa5ee
22732 changed files with 4815320 additions and 2 deletions

View file

@ -0,0 +1,52 @@
TurboJPEG Java Wrapper
======================
The TurboJPEG shared library can optionally be built with a Java Native
Interface wrapper, which allows the library to be loaded and used directly from
Java applications. The Java front end for this is defined in several classes
located under org/libjpegturbo/turbojpeg. The source code for these Java
classes is licensed under a BSD-style license, so the files can be incorporated
directly into both open source and proprietary projects without restriction. A
Java archive (JAR) file containing these classes is also shipped with the
"official" distribution packages of libjpeg-turbo.
TJExample.java, which should also be located in the same directory as this
README file, demonstrates how to use the TurboJPEG Java API to compress and
decompress JPEG images in memory.
Performance Pitfalls
--------------------
The TurboJPEG Java API defines several convenience methods that can allocate
image buffers or instantiate classes to hold the result of compress,
decompress, or transform operations. However, if you use these methods, then
be mindful of the amount of new data you are creating on the heap. It may be
necessary to manually invoke the garbage collector to prevent heap exhaustion
or to prevent performance degradation. Background garbage collection can kill
performance, particularly in a multi-threaded environment (Java pauses all
threads when the GC runs.)
The TurboJPEG Java API always gives you the option of pre-allocating your own
source and destination buffers, which allows you to re-use those buffers for
compressing/decompressing multiple images. If the image sequence you are
compressing or decompressing consists of images of the same size, then
pre-allocating the buffers is recommended.
Installation Directory
----------------------
The TurboJPEG Java Wrapper will look for the TurboJPEG JNI library
(libturbojpeg.so, libturbojpeg.jnilib, or turbojpeg.dll) in the system library
paths or in any paths specified in LD_LIBRARY_PATH (Un*x), DYLD_LIBRARY_PATH
(Mac), or PATH (Windows.) Failing this, on Un*x and Mac systems, the wrapper
will look for the JNI library under the library directory configured when
libjpeg-turbo was built. If that library directory is
/opt/libjpeg-turbo/lib32, then /opt/libjpeg-turbo/lib64 is also searched, and
vice versa.
If you installed the JNI library into another directory, then you will need
to pass an argument of -Djava.library.path={path_to_JNI_library} to java, or
manipulate LD_LIBRARY_PATH, DYLD_LIBRARY_PATH, or PATH to include the directory
containing the JNI library.

View file

@ -0,0 +1,129 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_libjpegturbo_turbojpeg_TJ */
#ifndef _Included_org_libjpegturbo_turbojpeg_TJ
#define _Included_org_libjpegturbo_turbojpeg_TJ
#ifdef __cplusplus
extern "C" {
#endif
#undef org_libjpegturbo_turbojpeg_TJ_NUMSAMP
#define org_libjpegturbo_turbojpeg_TJ_NUMSAMP 6L
#undef org_libjpegturbo_turbojpeg_TJ_SAMP_444
#define org_libjpegturbo_turbojpeg_TJ_SAMP_444 0L
#undef org_libjpegturbo_turbojpeg_TJ_SAMP_422
#define org_libjpegturbo_turbojpeg_TJ_SAMP_422 1L
#undef org_libjpegturbo_turbojpeg_TJ_SAMP_420
#define org_libjpegturbo_turbojpeg_TJ_SAMP_420 2L
#undef org_libjpegturbo_turbojpeg_TJ_SAMP_GRAY
#define org_libjpegturbo_turbojpeg_TJ_SAMP_GRAY 3L
#undef org_libjpegturbo_turbojpeg_TJ_SAMP_440
#define org_libjpegturbo_turbojpeg_TJ_SAMP_440 4L
#undef org_libjpegturbo_turbojpeg_TJ_SAMP_411
#define org_libjpegturbo_turbojpeg_TJ_SAMP_411 5L
#undef org_libjpegturbo_turbojpeg_TJ_NUMPF
#define org_libjpegturbo_turbojpeg_TJ_NUMPF 12L
#undef org_libjpegturbo_turbojpeg_TJ_PF_RGB
#define org_libjpegturbo_turbojpeg_TJ_PF_RGB 0L
#undef org_libjpegturbo_turbojpeg_TJ_PF_BGR
#define org_libjpegturbo_turbojpeg_TJ_PF_BGR 1L
#undef org_libjpegturbo_turbojpeg_TJ_PF_RGBX
#define org_libjpegturbo_turbojpeg_TJ_PF_RGBX 2L
#undef org_libjpegturbo_turbojpeg_TJ_PF_BGRX
#define org_libjpegturbo_turbojpeg_TJ_PF_BGRX 3L
#undef org_libjpegturbo_turbojpeg_TJ_PF_XBGR
#define org_libjpegturbo_turbojpeg_TJ_PF_XBGR 4L
#undef org_libjpegturbo_turbojpeg_TJ_PF_XRGB
#define org_libjpegturbo_turbojpeg_TJ_PF_XRGB 5L
#undef org_libjpegturbo_turbojpeg_TJ_PF_GRAY
#define org_libjpegturbo_turbojpeg_TJ_PF_GRAY 6L
#undef org_libjpegturbo_turbojpeg_TJ_PF_RGBA
#define org_libjpegturbo_turbojpeg_TJ_PF_RGBA 7L
#undef org_libjpegturbo_turbojpeg_TJ_PF_BGRA
#define org_libjpegturbo_turbojpeg_TJ_PF_BGRA 8L
#undef org_libjpegturbo_turbojpeg_TJ_PF_ABGR
#define org_libjpegturbo_turbojpeg_TJ_PF_ABGR 9L
#undef org_libjpegturbo_turbojpeg_TJ_PF_ARGB
#define org_libjpegturbo_turbojpeg_TJ_PF_ARGB 10L
#undef org_libjpegturbo_turbojpeg_TJ_PF_CMYK
#define org_libjpegturbo_turbojpeg_TJ_PF_CMYK 11L
#undef org_libjpegturbo_turbojpeg_TJ_NUMCS
#define org_libjpegturbo_turbojpeg_TJ_NUMCS 5L
#undef org_libjpegturbo_turbojpeg_TJ_CS_RGB
#define org_libjpegturbo_turbojpeg_TJ_CS_RGB 0L
#undef org_libjpegturbo_turbojpeg_TJ_CS_YCbCr
#define org_libjpegturbo_turbojpeg_TJ_CS_YCbCr 1L
#undef org_libjpegturbo_turbojpeg_TJ_CS_GRAY
#define org_libjpegturbo_turbojpeg_TJ_CS_GRAY 2L
#undef org_libjpegturbo_turbojpeg_TJ_CS_CMYK
#define org_libjpegturbo_turbojpeg_TJ_CS_CMYK 3L
#undef org_libjpegturbo_turbojpeg_TJ_CS_YCCK
#define org_libjpegturbo_turbojpeg_TJ_CS_YCCK 4L
#undef org_libjpegturbo_turbojpeg_TJ_FLAG_BOTTOMUP
#define org_libjpegturbo_turbojpeg_TJ_FLAG_BOTTOMUP 2L
#undef org_libjpegturbo_turbojpeg_TJ_FLAG_FASTUPSAMPLE
#define org_libjpegturbo_turbojpeg_TJ_FLAG_FASTUPSAMPLE 256L
#undef org_libjpegturbo_turbojpeg_TJ_FLAG_FASTDCT
#define org_libjpegturbo_turbojpeg_TJ_FLAG_FASTDCT 2048L
#undef org_libjpegturbo_turbojpeg_TJ_FLAG_ACCURATEDCT
#define org_libjpegturbo_turbojpeg_TJ_FLAG_ACCURATEDCT 4096L
/*
* Class: org_libjpegturbo_turbojpeg_TJ
* Method: bufSize
* Signature: (III)I
*/
JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJ_bufSize
(JNIEnv *, jclass, jint, jint, jint);
/*
* Class: org_libjpegturbo_turbojpeg_TJ
* Method: bufSizeYUV
* Signature: (IIII)I
*/
JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJ_bufSizeYUV__IIII
(JNIEnv *, jclass, jint, jint, jint, jint);
/*
* Class: org_libjpegturbo_turbojpeg_TJ
* Method: bufSizeYUV
* Signature: (III)I
*/
JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJ_bufSizeYUV__III
(JNIEnv *, jclass, jint, jint, jint);
/*
* Class: org_libjpegturbo_turbojpeg_TJ
* Method: planeSizeYUV
* Signature: (IIIII)I
*/
JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJ_planeSizeYUV__IIIII
(JNIEnv *, jclass, jint, jint, jint, jint, jint);
/*
* Class: org_libjpegturbo_turbojpeg_TJ
* Method: planeWidth
* Signature: (III)I
*/
JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJ_planeWidth__III
(JNIEnv *, jclass, jint, jint, jint);
/*
* Class: org_libjpegturbo_turbojpeg_TJ
* Method: planeHeight
* Signature: (III)I
*/
JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJ_planeHeight__III
(JNIEnv *, jclass, jint, jint, jint);
/*
* Class: org_libjpegturbo_turbojpeg_TJ
* Method: getScalingFactors
* Signature: ()[Lorg/libjpegturbo/turbojpeg/TJScalingFactor;
*/
JNIEXPORT jobjectArray JNICALL Java_org_libjpegturbo_turbojpeg_TJ_getScalingFactors
(JNIEnv *, jclass);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,101 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_libjpegturbo_turbojpeg_TJCompressor */
#ifndef _Included_org_libjpegturbo_turbojpeg_TJCompressor
#define _Included_org_libjpegturbo_turbojpeg_TJCompressor
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: org_libjpegturbo_turbojpeg_TJCompressor
* Method: init
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_init
(JNIEnv *, jobject);
/*
* Class: org_libjpegturbo_turbojpeg_TJCompressor
* Method: destroy
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_destroy
(JNIEnv *, jobject);
/*
* Class: org_libjpegturbo_turbojpeg_TJCompressor
* Method: compress
* Signature: ([BIIII[BIII)I
*/
JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_compress___3BIIII_3BIII
(JNIEnv *, jobject, jbyteArray, jint, jint, jint, jint, jbyteArray, jint, jint, jint);
/*
* Class: org_libjpegturbo_turbojpeg_TJCompressor
* Method: compress
* Signature: ([BIIIIII[BIII)I
*/
JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_compress___3BIIIIII_3BIII
(JNIEnv *, jobject, jbyteArray, jint, jint, jint, jint, jint, jint, jbyteArray, jint, jint, jint);
/*
* Class: org_libjpegturbo_turbojpeg_TJCompressor
* Method: compress
* Signature: ([IIIII[BIII)I
*/
JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_compress___3IIIII_3BIII
(JNIEnv *, jobject, jintArray, jint, jint, jint, jint, jbyteArray, jint, jint, jint);
/*
* Class: org_libjpegturbo_turbojpeg_TJCompressor
* Method: compress
* Signature: ([IIIIIII[BIII)I
*/
JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_compress___3IIIIIII_3BIII
(JNIEnv *, jobject, jintArray, jint, jint, jint, jint, jint, jint, jbyteArray, jint, jint, jint);
/*
* Class: org_libjpegturbo_turbojpeg_TJCompressor
* Method: compressFromYUV
* Signature: ([[B[II[III[BII)I
*/
JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_compressFromYUV___3_3B_3II_3III_3BII
(JNIEnv *, jobject, jobjectArray, jintArray, jint, jintArray, jint, jint, jbyteArray, jint, jint);
/*
* Class: org_libjpegturbo_turbojpeg_TJCompressor
* Method: encodeYUV
* Signature: ([BIIII[BII)V
*/
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3BIIII_3BII
(JNIEnv *, jobject, jbyteArray, jint, jint, jint, jint, jbyteArray, jint, jint);
/*
* Class: org_libjpegturbo_turbojpeg_TJCompressor
* Method: encodeYUV
* Signature: ([BIIIIII[[B[I[III)V
*/
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3BIIIIII_3_3B_3I_3III
(JNIEnv *, jobject, jbyteArray, jint, jint, jint, jint, jint, jint, jobjectArray, jintArray, jintArray, jint, jint);
/*
* Class: org_libjpegturbo_turbojpeg_TJCompressor
* Method: encodeYUV
* Signature: ([IIIII[BII)V
*/
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3IIIII_3BII
(JNIEnv *, jobject, jintArray, jint, jint, jint, jint, jbyteArray, jint, jint);
/*
* Class: org_libjpegturbo_turbojpeg_TJCompressor
* Method: encodeYUV
* Signature: ([IIIIIII[[B[I[III)V
*/
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3IIIIIII_3_3B_3I_3III
(JNIEnv *, jobject, jintArray, jint, jint, jint, jint, jint, jint, jobjectArray, jintArray, jintArray, jint, jint);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,101 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_libjpegturbo_turbojpeg_TJDecompressor */
#ifndef _Included_org_libjpegturbo_turbojpeg_TJDecompressor
#define _Included_org_libjpegturbo_turbojpeg_TJDecompressor
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: org_libjpegturbo_turbojpeg_TJDecompressor
* Method: init
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_init
(JNIEnv *, jobject);
/*
* Class: org_libjpegturbo_turbojpeg_TJDecompressor
* Method: destroy
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_destroy
(JNIEnv *, jobject);
/*
* Class: org_libjpegturbo_turbojpeg_TJDecompressor
* Method: decompressHeader
* Signature: ([BI)V
*/
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompressHeader
(JNIEnv *, jobject, jbyteArray, jint);
/*
* Class: org_libjpegturbo_turbojpeg_TJDecompressor
* Method: decompress
* Signature: ([BI[BIIIII)V
*/
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress___3BI_3BIIIII
(JNIEnv *, jobject, jbyteArray, jint, jbyteArray, jint, jint, jint, jint, jint);
/*
* Class: org_libjpegturbo_turbojpeg_TJDecompressor
* Method: decompress
* Signature: ([BI[BIIIIIII)V
*/
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress___3BI_3BIIIIIII
(JNIEnv *, jobject, jbyteArray, jint, jbyteArray, jint, jint, jint, jint, jint, jint, jint);
/*
* Class: org_libjpegturbo_turbojpeg_TJDecompressor
* Method: decompress
* Signature: ([BI[IIIIII)V
*/
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress___3BI_3IIIIII
(JNIEnv *, jobject, jbyteArray, jint, jintArray, jint, jint, jint, jint, jint);
/*
* Class: org_libjpegturbo_turbojpeg_TJDecompressor
* Method: decompress
* Signature: ([BI[IIIIIIII)V
*/
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress___3BI_3IIIIIIII
(JNIEnv *, jobject, jbyteArray, jint, jintArray, jint, jint, jint, jint, jint, jint, jint);
/*
* Class: org_libjpegturbo_turbojpeg_TJDecompressor
* Method: decompressToYUV
* Signature: ([BI[BI)V
*/
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompressToYUV___3BI_3BI
(JNIEnv *, jobject, jbyteArray, jint, jbyteArray, jint);
/*
* Class: org_libjpegturbo_turbojpeg_TJDecompressor
* Method: decompressToYUV
* Signature: ([BI[[B[II[III)V
*/
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompressToYUV___3BI_3_3B_3II_3III
(JNIEnv *, jobject, jbyteArray, jint, jobjectArray, jintArray, jint, jintArray, jint, jint);
/*
* Class: org_libjpegturbo_turbojpeg_TJDecompressor
* Method: decodeYUV
* Signature: ([[B[I[II[BIIIIIII)V
*/
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decodeYUV___3_3B_3I_3II_3BIIIIIII
(JNIEnv *, jobject, jobjectArray, jintArray, jintArray, jint, jbyteArray, jint, jint, jint, jint, jint, jint, jint);
/*
* Class: org_libjpegturbo_turbojpeg_TJDecompressor
* Method: decodeYUV
* Signature: ([[B[I[II[IIIIIIII)V
*/
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decodeYUV___3_3B_3I_3II_3IIIIIIII
(JNIEnv *, jobject, jobjectArray, jintArray, jintArray, jint, jintArray, jint, jint, jint, jint, jint, jint, jint);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,29 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_libjpegturbo_turbojpeg_TJTransformer */
#ifndef _Included_org_libjpegturbo_turbojpeg_TJTransformer
#define _Included_org_libjpegturbo_turbojpeg_TJTransformer
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: org_libjpegturbo_turbojpeg_TJTransformer
* Method: init
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJTransformer_init
(JNIEnv *, jobject);
/*
* Class: org_libjpegturbo_turbojpeg_TJTransformer
* Method: transform
* Signature: ([BI[[B[Lorg/libjpegturbo/turbojpeg/TJTransform;I)[I
*/
JNIEXPORT jintArray JNICALL Java_org_libjpegturbo_turbojpeg_TJTransformer_transform
(JNIEnv *, jobject, jbyteArray, jint, jobjectArray, jobjectArray, jint);
#ifdef __cplusplus
}
#endif
#endif