webp/swig/libwebp_java_wrap.c

1692 lines
50 KiB
C
Raw Normal View History

/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 1.3.40
*
* This file is not intended to be easily readable and contains a number of
* coding conventions designed to improve portability and efficiency. Do not make
* changes to this file unless you know what you are doing--modify the SWIG
* interface file instead.
* ----------------------------------------------------------------------------- */
#define SWIGJAVA
/* -----------------------------------------------------------------------------
* This section contains generic SWIG labels for method/variable
* declarations/attributes, and other compiler dependent labels.
* ----------------------------------------------------------------------------- */
/* template workaround for compilers that cannot correctly implement the C++ standard */
#ifndef SWIGTEMPLATEDISAMBIGUATOR
# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
# define SWIGTEMPLATEDISAMBIGUATOR template
# elif defined(__HP_aCC)
/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
# define SWIGTEMPLATEDISAMBIGUATOR template
# else
# define SWIGTEMPLATEDISAMBIGUATOR
# endif
#endif
/* inline attribute */
#ifndef SWIGINLINE
# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
# define SWIGINLINE inline
# else
# define SWIGINLINE
# endif
#endif
/* attribute recognised by some compilers to avoid 'unused' warnings */
#ifndef SWIGUNUSED
# if defined(__GNUC__)
# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
# define SWIGUNUSED __attribute__ ((__unused__))
# else
# define SWIGUNUSED
# endif
# elif defined(__ICC)
# define SWIGUNUSED __attribute__ ((__unused__))
# else
# define SWIGUNUSED
# endif
#endif
#ifndef SWIG_MSC_UNSUPPRESS_4505
# if defined(_MSC_VER)
# pragma warning(disable : 4505) /* unreferenced local function has been removed */
# endif
#endif
#ifndef SWIGUNUSEDPARM
# ifdef __cplusplus
# define SWIGUNUSEDPARM(p)
# else
# define SWIGUNUSEDPARM(p) p SWIGUNUSED
# endif
#endif
/* internal SWIG method */
#ifndef SWIGINTERN
# define SWIGINTERN static SWIGUNUSED
#endif
/* internal inline SWIG method */
#ifndef SWIGINTERNINLINE
# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
#endif
/* exporting methods */
#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
# ifndef GCC_HASCLASSVISIBILITY
# define GCC_HASCLASSVISIBILITY
# endif
#endif
#ifndef SWIGEXPORT
# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
# if defined(STATIC_LINKED)
# define SWIGEXPORT
# else
# define SWIGEXPORT __declspec(dllexport)
# endif
# else
# if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
# define SWIGEXPORT __attribute__ ((visibility("default")))
# else
# define SWIGEXPORT
# endif
# endif
#endif
/* calling conventions for Windows */
#ifndef SWIGSTDCALL
# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
# define SWIGSTDCALL __stdcall
# else
# define SWIGSTDCALL
# endif
#endif
/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
# define _CRT_SECURE_NO_DEPRECATE
#endif
/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
# define _SCL_SECURE_NO_DEPRECATE
#endif
/* Fix for jlong on some versions of gcc on Windows */
#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
typedef long long __int64;
#endif
/* Fix for jlong on 64-bit x86 Solaris */
#if defined(__x86_64)
# ifdef _LP64
# undef _LP64
# endif
#endif
#include <jni.h>
#include <stdlib.h>
#include <string.h>
/* Support for throwing Java exceptions */
typedef enum {
SWIG_JavaOutOfMemoryError = 1,
SWIG_JavaIOException,
SWIG_JavaRuntimeException,
SWIG_JavaIndexOutOfBoundsException,
SWIG_JavaArithmeticException,
SWIG_JavaIllegalArgumentException,
SWIG_JavaNullPointerException,
SWIG_JavaDirectorPureVirtual,
SWIG_JavaUnknownError
} SWIG_JavaExceptionCodes;
typedef struct {
SWIG_JavaExceptionCodes code;
const char *java_exception;
} SWIG_JavaExceptions_t;
static void SWIGUNUSED SWIG_JavaThrowException(JNIEnv *jenv, SWIG_JavaExceptionCodes code, const char *msg) {
jclass excep;
static const SWIG_JavaExceptions_t java_exceptions[] = {
{ SWIG_JavaOutOfMemoryError, "java/lang/OutOfMemoryError" },
{ SWIG_JavaIOException, "java/io/IOException" },
{ SWIG_JavaRuntimeException, "java/lang/RuntimeException" },
{ SWIG_JavaIndexOutOfBoundsException, "java/lang/IndexOutOfBoundsException" },
{ SWIG_JavaArithmeticException, "java/lang/ArithmeticException" },
{ SWIG_JavaIllegalArgumentException, "java/lang/IllegalArgumentException" },
{ SWIG_JavaNullPointerException, "java/lang/NullPointerException" },
{ SWIG_JavaDirectorPureVirtual, "java/lang/RuntimeException" },
{ SWIG_JavaUnknownError, "java/lang/UnknownError" },
{ (SWIG_JavaExceptionCodes)0, "java/lang/UnknownError" }
};
const SWIG_JavaExceptions_t *except_ptr = java_exceptions;
while (except_ptr->code != code && except_ptr->code)
except_ptr++;
(*jenv)->ExceptionClear(jenv);
excep = (*jenv)->FindClass(jenv, except_ptr->java_exception);
if (excep)
(*jenv)->ThrowNew(jenv, excep, msg);
}
/* Contract support */
#define SWIG_contract_assert(nullreturn, expr, msg) if (!(expr)) {SWIG_JavaThrowException(jenv, SWIG_JavaIllegalArgumentException, msg); return nullreturn; } else
/* Errors in SWIG */
#define SWIG_UnknownError -1
#define SWIG_IOError -2
#define SWIG_RuntimeError -3
#define SWIG_IndexError -4
#define SWIG_TypeError -5
#define SWIG_DivisionByZero -6
#define SWIG_OverflowError -7
#define SWIG_SyntaxError -8
#define SWIG_ValueError -9
#define SWIG_SystemError -10
#define SWIG_AttributeError -11
#define SWIG_MemoryError -12
#define SWIG_NullReferenceError -13
SWIGINTERN void SWIG_JavaException(JNIEnv *jenv, int code, const char *msg) {
SWIG_JavaExceptionCodes exception_code = SWIG_JavaUnknownError;
switch(code) {
case SWIG_MemoryError:
exception_code = SWIG_JavaOutOfMemoryError;
break;
case SWIG_IOError:
exception_code = SWIG_JavaIOException;
break;
case SWIG_SystemError:
case SWIG_RuntimeError:
exception_code = SWIG_JavaRuntimeException;
break;
case SWIG_OverflowError:
case SWIG_IndexError:
exception_code = SWIG_JavaIndexOutOfBoundsException;
break;
case SWIG_DivisionByZero:
exception_code = SWIG_JavaArithmeticException;
break;
case SWIG_SyntaxError:
case SWIG_ValueError:
case SWIG_TypeError:
exception_code = SWIG_JavaIllegalArgumentException;
break;
case SWIG_UnknownError:
default:
exception_code = SWIG_JavaUnknownError;
break;
}
SWIG_JavaThrowException(jenv, exception_code, msg);
}
#if defined(SWIG_NOINCLUDE) || defined(SWIG_NOARRAYS)
int SWIG_JavaArrayInSchar (JNIEnv *jenv, jbyte **jarr, signed char **carr, jbyteArray input);
void SWIG_JavaArrayArgoutSchar (JNIEnv *jenv, jbyte *jarr, signed char *carr, jbyteArray input);
jbyteArray SWIG_JavaArrayOutSchar (JNIEnv *jenv, signed char *result, jsize sz);
int SWIG_JavaArrayInUchar (JNIEnv *jenv, jshort **jarr, unsigned char **carr, jshortArray input);
void SWIG_JavaArrayArgoutUchar (JNIEnv *jenv, jshort *jarr, unsigned char *carr, jshortArray input);
jshortArray SWIG_JavaArrayOutUchar (JNIEnv *jenv, unsigned char *result, jsize sz);
int SWIG_JavaArrayInShort (JNIEnv *jenv, jshort **jarr, short **carr, jshortArray input);
void SWIG_JavaArrayArgoutShort (JNIEnv *jenv, jshort *jarr, short *carr, jshortArray input);
jshortArray SWIG_JavaArrayOutShort (JNIEnv *jenv, short *result, jsize sz);
int SWIG_JavaArrayInUshort (JNIEnv *jenv, jint **jarr, unsigned short **carr, jintArray input);
void SWIG_JavaArrayArgoutUshort (JNIEnv *jenv, jint *jarr, unsigned short *carr, jintArray input);
jintArray SWIG_JavaArrayOutUshort (JNIEnv *jenv, unsigned short *result, jsize sz);
int SWIG_JavaArrayInInt (JNIEnv *jenv, jint **jarr, int **carr, jintArray input);
void SWIG_JavaArrayArgoutInt (JNIEnv *jenv, jint *jarr, int *carr, jintArray input);
jintArray SWIG_JavaArrayOutInt (JNIEnv *jenv, int *result, jsize sz);
int SWIG_JavaArrayInUint (JNIEnv *jenv, jlong **jarr, unsigned int **carr, jlongArray input);
void SWIG_JavaArrayArgoutUint (JNIEnv *jenv, jlong *jarr, unsigned int *carr, jlongArray input);
jlongArray SWIG_JavaArrayOutUint (JNIEnv *jenv, unsigned int *result, jsize sz);
int SWIG_JavaArrayInLong (JNIEnv *jenv, jint **jarr, long **carr, jintArray input);
void SWIG_JavaArrayArgoutLong (JNIEnv *jenv, jint *jarr, long *carr, jintArray input);
jintArray SWIG_JavaArrayOutLong (JNIEnv *jenv, long *result, jsize sz);
int SWIG_JavaArrayInUlong (JNIEnv *jenv, jlong **jarr, unsigned long **carr, jlongArray input);
void SWIG_JavaArrayArgoutUlong (JNIEnv *jenv, jlong *jarr, unsigned long *carr, jlongArray input);
jlongArray SWIG_JavaArrayOutUlong (JNIEnv *jenv, unsigned long *result, jsize sz);
int SWIG_JavaArrayInLonglong (JNIEnv *jenv, jlong **jarr, jlong **carr, jlongArray input);
void SWIG_JavaArrayArgoutLonglong (JNIEnv *jenv, jlong *jarr, jlong *carr, jlongArray input);
jlongArray SWIG_JavaArrayOutLonglong (JNIEnv *jenv, jlong *result, jsize sz);
int SWIG_JavaArrayInFloat (JNIEnv *jenv, jfloat **jarr, float **carr, jfloatArray input);
void SWIG_JavaArrayArgoutFloat (JNIEnv *jenv, jfloat *jarr, float *carr, jfloatArray input);
jfloatArray SWIG_JavaArrayOutFloat (JNIEnv *jenv, float *result, jsize sz);
int SWIG_JavaArrayInDouble (JNIEnv *jenv, jdouble **jarr, double **carr, jdoubleArray input);
void SWIG_JavaArrayArgoutDouble (JNIEnv *jenv, jdouble *jarr, double *carr, jdoubleArray input);
jdoubleArray SWIG_JavaArrayOutDouble (JNIEnv *jenv, double *result, jsize sz);
#else
/* signed char[] support */
int SWIG_JavaArrayInSchar (JNIEnv *jenv, jbyte **jarr, signed char **carr, jbyteArray input) {
int i;
jsize sz;
if (!input) {
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null array");
return 0;
}
sz = (*jenv)->GetArrayLength(jenv, input);
*jarr = (*jenv)->GetByteArrayElements(jenv, input, 0);
if (!*jarr)
return 0;
*carr = (signed char*) calloc(sz, sizeof(signed char));
if (!*carr) {
SWIG_JavaThrowException(jenv, SWIG_JavaOutOfMemoryError, "array memory allocation failed");
return 0;
}
for (i=0; i<sz; i++)
(*carr)[i] = (signed char)(*jarr)[i];
return 1;
}
void SWIG_JavaArrayArgoutSchar (JNIEnv *jenv, jbyte *jarr, signed char *carr, jbyteArray input) {
int i;
jsize sz = (*jenv)->GetArrayLength(jenv, input);
for (i=0; i<sz; i++)
jarr[i] = (jbyte)carr[i];
(*jenv)->ReleaseByteArrayElements(jenv, input, jarr, 0);
}
jbyteArray SWIG_JavaArrayOutSchar (JNIEnv *jenv, signed char *result, jsize sz) {
jbyte *arr;
int i;
jbyteArray jresult = (*jenv)->NewByteArray(jenv, sz);
if (!jresult)
return NULL;
arr = (*jenv)->GetByteArrayElements(jenv, jresult, 0);
if (!arr)
return NULL;
for (i=0; i<sz; i++)
arr[i] = (jbyte)result[i];
(*jenv)->ReleaseByteArrayElements(jenv, jresult, arr, 0);
return jresult;
}
/* unsigned char[] support */
int SWIG_JavaArrayInUchar (JNIEnv *jenv, jshort **jarr, unsigned char **carr, jshortArray input) {
int i;
jsize sz;
if (!input) {
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null array");
return 0;
}
sz = (*jenv)->GetArrayLength(jenv, input);
*jarr = (*jenv)->GetShortArrayElements(jenv, input, 0);
if (!*jarr)
return 0;
*carr = (unsigned char*) calloc(sz, sizeof(unsigned char));
if (!*carr) {
SWIG_JavaThrowException(jenv, SWIG_JavaOutOfMemoryError, "array memory allocation failed");
return 0;
}
for (i=0; i<sz; i++)
(*carr)[i] = (unsigned char)(*jarr)[i];
return 1;
}
void SWIG_JavaArrayArgoutUchar (JNIEnv *jenv, jshort *jarr, unsigned char *carr, jshortArray input) {
int i;
jsize sz = (*jenv)->GetArrayLength(jenv, input);
for (i=0; i<sz; i++)
jarr[i] = (jshort)carr[i];
(*jenv)->ReleaseShortArrayElements(jenv, input, jarr, 0);
}
jshortArray SWIG_JavaArrayOutUchar (JNIEnv *jenv, unsigned char *result, jsize sz) {
jshort *arr;
int i;
jshortArray jresult = (*jenv)->NewShortArray(jenv, sz);
if (!jresult)
return NULL;
arr = (*jenv)->GetShortArrayElements(jenv, jresult, 0);
if (!arr)
return NULL;
for (i=0; i<sz; i++)
arr[i] = (jshort)result[i];
(*jenv)->ReleaseShortArrayElements(jenv, jresult, arr, 0);
return jresult;
}
/* short[] support */
int SWIG_JavaArrayInShort (JNIEnv *jenv, jshort **jarr, short **carr, jshortArray input) {
int i;
jsize sz;
if (!input) {
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null array");
return 0;
}
sz = (*jenv)->GetArrayLength(jenv, input);
*jarr = (*jenv)->GetShortArrayElements(jenv, input, 0);
if (!*jarr)
return 0;
*carr = (short*) calloc(sz, sizeof(short));
if (!*carr) {
SWIG_JavaThrowException(jenv, SWIG_JavaOutOfMemoryError, "array memory allocation failed");
return 0;
}
for (i=0; i<sz; i++)
(*carr)[i] = (short)(*jarr)[i];
return 1;
}
void SWIG_JavaArrayArgoutShort (JNIEnv *jenv, jshort *jarr, short *carr, jshortArray input) {
int i;
jsize sz = (*jenv)->GetArrayLength(jenv, input);
for (i=0; i<sz; i++)
jarr[i] = (jshort)carr[i];
(*jenv)->ReleaseShortArrayElements(jenv, input, jarr, 0);
}
jshortArray SWIG_JavaArrayOutShort (JNIEnv *jenv, short *result, jsize sz) {
jshort *arr;
int i;
jshortArray jresult = (*jenv)->NewShortArray(jenv, sz);
if (!jresult)
return NULL;
arr = (*jenv)->GetShortArrayElements(jenv, jresult, 0);
if (!arr)
return NULL;
for (i=0; i<sz; i++)
arr[i] = (jshort)result[i];
(*jenv)->ReleaseShortArrayElements(jenv, jresult, arr, 0);
return jresult;
}
/* unsigned short[] support */
int SWIG_JavaArrayInUshort (JNIEnv *jenv, jint **jarr, unsigned short **carr, jintArray input) {
int i;
jsize sz;
if (!input) {
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null array");
return 0;
}
sz = (*jenv)->GetArrayLength(jenv, input);
*jarr = (*jenv)->GetIntArrayElements(jenv, input, 0);
if (!*jarr)
return 0;
*carr = (unsigned short*) calloc(sz, sizeof(unsigned short));
if (!*carr) {
SWIG_JavaThrowException(jenv, SWIG_JavaOutOfMemoryError, "array memory allocation failed");
return 0;
}
for (i=0; i<sz; i++)
(*carr)[i] = (unsigned short)(*jarr)[i];
return 1;
}
void SWIG_JavaArrayArgoutUshort (JNIEnv *jenv, jint *jarr, unsigned short *carr, jintArray input) {
int i;
jsize sz = (*jenv)->GetArrayLength(jenv, input);
for (i=0; i<sz; i++)
jarr[i] = (jint)carr[i];
(*jenv)->ReleaseIntArrayElements(jenv, input, jarr, 0);
}
jintArray SWIG_JavaArrayOutUshort (JNIEnv *jenv, unsigned short *result, jsize sz) {
jint *arr;
int i;
jintArray jresult = (*jenv)->NewIntArray(jenv, sz);
if (!jresult)
return NULL;
arr = (*jenv)->GetIntArrayElements(jenv, jresult, 0);
if (!arr)
return NULL;
for (i=0; i<sz; i++)
arr[i] = (jint)result[i];
(*jenv)->ReleaseIntArrayElements(jenv, jresult, arr, 0);
return jresult;
}
/* int[] support */
int SWIG_JavaArrayInInt (JNIEnv *jenv, jint **jarr, int **carr, jintArray input) {
int i;
jsize sz;
if (!input) {
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null array");
return 0;
}
sz = (*jenv)->GetArrayLength(jenv, input);
*jarr = (*jenv)->GetIntArrayElements(jenv, input, 0);
if (!*jarr)
return 0;
*carr = (int*) calloc(sz, sizeof(int));
if (!*carr) {
SWIG_JavaThrowException(jenv, SWIG_JavaOutOfMemoryError, "array memory allocation failed");
return 0;
}
for (i=0; i<sz; i++)
(*carr)[i] = (int)(*jarr)[i];
return 1;
}
void SWIG_JavaArrayArgoutInt (JNIEnv *jenv, jint *jarr, int *carr, jintArray input) {
int i;
jsize sz = (*jenv)->GetArrayLength(jenv, input);
for (i=0; i<sz; i++)
jarr[i] = (jint)carr[i];
(*jenv)->ReleaseIntArrayElements(jenv, input, jarr, 0);
}
jintArray SWIG_JavaArrayOutInt (JNIEnv *jenv, int *result, jsize sz) {
jint *arr;
int i;
jintArray jresult = (*jenv)->NewIntArray(jenv, sz);
if (!jresult)
return NULL;
arr = (*jenv)->GetIntArrayElements(jenv, jresult, 0);
if (!arr)
return NULL;
for (i=0; i<sz; i++)
arr[i] = (jint)result[i];
(*jenv)->ReleaseIntArrayElements(jenv, jresult, arr, 0);
return jresult;
}
/* unsigned int[] support */
int SWIG_JavaArrayInUint (JNIEnv *jenv, jlong **jarr, unsigned int **carr, jlongArray input) {
int i;
jsize sz;
if (!input) {
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null array");
return 0;
}
sz = (*jenv)->GetArrayLength(jenv, input);
*jarr = (*jenv)->GetLongArrayElements(jenv, input, 0);
if (!*jarr)
return 0;
*carr = (unsigned int*) calloc(sz, sizeof(unsigned int));
if (!*carr) {
SWIG_JavaThrowException(jenv, SWIG_JavaOutOfMemoryError, "array memory allocation failed");
return 0;
}
for (i=0; i<sz; i++)
(*carr)[i] = (unsigned int)(*jarr)[i];
return 1;
}
void SWIG_JavaArrayArgoutUint (JNIEnv *jenv, jlong *jarr, unsigned int *carr, jlongArray input) {
int i;
jsize sz = (*jenv)->GetArrayLength(jenv, input);
for (i=0; i<sz; i++)
jarr[i] = (jlong)carr[i];
(*jenv)->ReleaseLongArrayElements(jenv, input, jarr, 0);
}
jlongArray SWIG_JavaArrayOutUint (JNIEnv *jenv, unsigned int *result, jsize sz) {
jlong *arr;
int i;
jlongArray jresult = (*jenv)->NewLongArray(jenv, sz);
if (!jresult)
return NULL;
arr = (*jenv)->GetLongArrayElements(jenv, jresult, 0);
if (!arr)
return NULL;
for (i=0; i<sz; i++)
arr[i] = (jlong)result[i];
(*jenv)->ReleaseLongArrayElements(jenv, jresult, arr, 0);
return jresult;
}
/* long[] support */
int SWIG_JavaArrayInLong (JNIEnv *jenv, jint **jarr, long **carr, jintArray input) {
int i;
jsize sz;
if (!input) {
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null array");
return 0;
}
sz = (*jenv)->GetArrayLength(jenv, input);
*jarr = (*jenv)->GetIntArrayElements(jenv, input, 0);
if (!*jarr)
return 0;
*carr = (long*) calloc(sz, sizeof(long));
if (!*carr) {
SWIG_JavaThrowException(jenv, SWIG_JavaOutOfMemoryError, "array memory allocation failed");
return 0;
}
for (i=0; i<sz; i++)
(*carr)[i] = (long)(*jarr)[i];
return 1;
}
void SWIG_JavaArrayArgoutLong (JNIEnv *jenv, jint *jarr, long *carr, jintArray input) {
int i;
jsize sz = (*jenv)->GetArrayLength(jenv, input);
for (i=0; i<sz; i++)
jarr[i] = (jint)carr[i];
(*jenv)->ReleaseIntArrayElements(jenv, input, jarr, 0);
}
jintArray SWIG_JavaArrayOutLong (JNIEnv *jenv, long *result, jsize sz) {
jint *arr;
int i;
jintArray jresult = (*jenv)->NewIntArray(jenv, sz);
if (!jresult)
return NULL;
arr = (*jenv)->GetIntArrayElements(jenv, jresult, 0);
if (!arr)
return NULL;
for (i=0; i<sz; i++)
arr[i] = (jint)result[i];
(*jenv)->ReleaseIntArrayElements(jenv, jresult, arr, 0);
return jresult;
}
/* unsigned long[] support */
int SWIG_JavaArrayInUlong (JNIEnv *jenv, jlong **jarr, unsigned long **carr, jlongArray input) {
int i;
jsize sz;
if (!input) {
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null array");
return 0;
}
sz = (*jenv)->GetArrayLength(jenv, input);
*jarr = (*jenv)->GetLongArrayElements(jenv, input, 0);
if (!*jarr)
return 0;
*carr = (unsigned long*) calloc(sz, sizeof(unsigned long));
if (!*carr) {
SWIG_JavaThrowException(jenv, SWIG_JavaOutOfMemoryError, "array memory allocation failed");
return 0;
}
for (i=0; i<sz; i++)
(*carr)[i] = (unsigned long)(*jarr)[i];
return 1;
}
void SWIG_JavaArrayArgoutUlong (JNIEnv *jenv, jlong *jarr, unsigned long *carr, jlongArray input) {
int i;
jsize sz = (*jenv)->GetArrayLength(jenv, input);
for (i=0; i<sz; i++)
jarr[i] = (jlong)carr[i];
(*jenv)->ReleaseLongArrayElements(jenv, input, jarr, 0);
}
jlongArray SWIG_JavaArrayOutUlong (JNIEnv *jenv, unsigned long *result, jsize sz) {
jlong *arr;
int i;
jlongArray jresult = (*jenv)->NewLongArray(jenv, sz);
if (!jresult)
return NULL;
arr = (*jenv)->GetLongArrayElements(jenv, jresult, 0);
if (!arr)
return NULL;
for (i=0; i<sz; i++)
arr[i] = (jlong)result[i];
(*jenv)->ReleaseLongArrayElements(jenv, jresult, arr, 0);
return jresult;
}
/* jlong[] support */
int SWIG_JavaArrayInLonglong (JNIEnv *jenv, jlong **jarr, jlong **carr, jlongArray input) {
int i;
jsize sz;
if (!input) {
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null array");
return 0;
}
sz = (*jenv)->GetArrayLength(jenv, input);
*jarr = (*jenv)->GetLongArrayElements(jenv, input, 0);
if (!*jarr)
return 0;
*carr = (jlong*) calloc(sz, sizeof(jlong));
if (!*carr) {
SWIG_JavaThrowException(jenv, SWIG_JavaOutOfMemoryError, "array memory allocation failed");
return 0;
}
for (i=0; i<sz; i++)
(*carr)[i] = (jlong)(*jarr)[i];
return 1;
}
void SWIG_JavaArrayArgoutLonglong (JNIEnv *jenv, jlong *jarr, jlong *carr, jlongArray input) {
int i;
jsize sz = (*jenv)->GetArrayLength(jenv, input);
for (i=0; i<sz; i++)
jarr[i] = (jlong)carr[i];
(*jenv)->ReleaseLongArrayElements(jenv, input, jarr, 0);
}
jlongArray SWIG_JavaArrayOutLonglong (JNIEnv *jenv, jlong *result, jsize sz) {
jlong *arr;
int i;
jlongArray jresult = (*jenv)->NewLongArray(jenv, sz);
if (!jresult)
return NULL;
arr = (*jenv)->GetLongArrayElements(jenv, jresult, 0);
if (!arr)
return NULL;
for (i=0; i<sz; i++)
arr[i] = (jlong)result[i];
(*jenv)->ReleaseLongArrayElements(jenv, jresult, arr, 0);
return jresult;
}
/* float[] support */
int SWIG_JavaArrayInFloat (JNIEnv *jenv, jfloat **jarr, float **carr, jfloatArray input) {
int i;
jsize sz;
if (!input) {
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null array");
return 0;
}
sz = (*jenv)->GetArrayLength(jenv, input);
*jarr = (*jenv)->GetFloatArrayElements(jenv, input, 0);
if (!*jarr)
return 0;
*carr = (float*) calloc(sz, sizeof(float));
if (!*carr) {
SWIG_JavaThrowException(jenv, SWIG_JavaOutOfMemoryError, "array memory allocation failed");
return 0;
}
for (i=0; i<sz; i++)
(*carr)[i] = (float)(*jarr)[i];
return 1;
}
void SWIG_JavaArrayArgoutFloat (JNIEnv *jenv, jfloat *jarr, float *carr, jfloatArray input) {
int i;
jsize sz = (*jenv)->GetArrayLength(jenv, input);
for (i=0; i<sz; i++)
jarr[i] = (jfloat)carr[i];
(*jenv)->ReleaseFloatArrayElements(jenv, input, jarr, 0);
}
jfloatArray SWIG_JavaArrayOutFloat (JNIEnv *jenv, float *result, jsize sz) {
jfloat *arr;
int i;
jfloatArray jresult = (*jenv)->NewFloatArray(jenv, sz);
if (!jresult)
return NULL;
arr = (*jenv)->GetFloatArrayElements(jenv, jresult, 0);
if (!arr)
return NULL;
for (i=0; i<sz; i++)
arr[i] = (jfloat)result[i];
(*jenv)->ReleaseFloatArrayElements(jenv, jresult, arr, 0);
return jresult;
}
/* double[] support */
int SWIG_JavaArrayInDouble (JNIEnv *jenv, jdouble **jarr, double **carr, jdoubleArray input) {
int i;
jsize sz;
if (!input) {
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null array");
return 0;
}
sz = (*jenv)->GetArrayLength(jenv, input);
*jarr = (*jenv)->GetDoubleArrayElements(jenv, input, 0);
if (!*jarr)
return 0;
*carr = (double*) calloc(sz, sizeof(double));
if (!*carr) {
SWIG_JavaThrowException(jenv, SWIG_JavaOutOfMemoryError, "array memory allocation failed");
return 0;
}
for (i=0; i<sz; i++)
(*carr)[i] = (double)(*jarr)[i];
return 1;
}
void SWIG_JavaArrayArgoutDouble (JNIEnv *jenv, jdouble *jarr, double *carr, jdoubleArray input) {
int i;
jsize sz = (*jenv)->GetArrayLength(jenv, input);
for (i=0; i<sz; i++)
jarr[i] = (jdouble)carr[i];
(*jenv)->ReleaseDoubleArrayElements(jenv, input, jarr, 0);
}
jdoubleArray SWIG_JavaArrayOutDouble (JNIEnv *jenv, double *result, jsize sz) {
jdouble *arr;
int i;
jdoubleArray jresult = (*jenv)->NewDoubleArray(jenv, sz);
if (!jresult)
return NULL;
arr = (*jenv)->GetDoubleArrayElements(jenv, jresult, 0);
if (!arr)
return NULL;
for (i=0; i<sz; i++)
arr[i] = (jdouble)result[i];
(*jenv)->ReleaseDoubleArrayElements(jenv, jresult, arr, 0);
return jresult;
}
#endif
#include "webp/decode.h"
#include "webp/encode.h"
#define FillMeInAsSizeCannotBeDeterminedAutomatically \
(result ? returned_buffer_size(__FUNCTION__, arg3, arg4) : 0)
static jint returned_buffer_size(
const char *function, int *width, int *height) {
static const struct sizemap {
const char *function;
int size_multiplier;
} size_map[] = {
{ "Java_com_google_webp_libwebpJNI_WebPDecodeRGB", 3 },
{ "Java_com_google_webp_libwebpJNI_WebPDecodeRGBA", 4 },
{ "Java_com_google_webp_libwebpJNI_WebPDecodeARGB", 4 },
{ "Java_com_google_webp_libwebpJNI_WebPDecodeBGR", 3 },
{ "Java_com_google_webp_libwebpJNI_WebPDecodeBGRA", 4 },
{ "Java_com_google_webp_libwebpJNI_wrap_1WebPEncodeRGB", 1 },
{ "Java_com_google_webp_libwebpJNI_wrap_1WebPEncodeBGR", 1 },
{ "Java_com_google_webp_libwebpJNI_wrap_1WebPEncodeRGBA", 1 },
{ "Java_com_google_webp_libwebpJNI_wrap_1WebPEncodeBGRA", 1 },
{ "Java_com_google_webp_libwebpJNI_wrap_1WebPEncodeLosslessRGB", 1 },
{ "Java_com_google_webp_libwebpJNI_wrap_1WebPEncodeLosslessBGR", 1 },
{ "Java_com_google_webp_libwebpJNI_wrap_1WebPEncodeLosslessRGBA", 1 },
{ "Java_com_google_webp_libwebpJNI_wrap_1WebPEncodeLosslessBGRA", 1 },
{ NULL, 0 }
};
const struct sizemap *p;
jint size = -1;
for (p = size_map; p->function; p++) {
if (!strcmp(function, p->function)) {
size = *width * *height * p->size_multiplier;
break;
}
}
return size;
}
typedef size_t (*WebPEncodeFunction)(const uint8_t* rgb,
int width, int height, int stride,
float quality_factor, uint8_t** output);
typedef size_t (*WebPEncodeLosslessFunction)(const uint8_t* rgb,
int width, int height, int stride,
uint8_t** output);
static uint8_t* encode(const uint8_t* rgb,
int width, int height, int stride,
float quality_factor,
WebPEncodeFunction encfn,
int* output_size, int* unused) {
uint8_t *output = NULL;
const size_t image_size =
encfn(rgb, width, height, stride, quality_factor, &output);
// the values of following two will be interpreted by returned_buffer_size()
// as 'width' and 'height' in the size calculation.
*output_size = image_size;
*unused = 1;
return image_size ? output : NULL;
}
static uint8_t* encode_lossless(const uint8_t* rgb,
int width, int height, int stride,
WebPEncodeLosslessFunction encfn,
int* output_size, int* unused) {
uint8_t *output = NULL;
const size_t image_size = encfn(rgb, width, height, stride, &output);
// the values of following two will be interpreted by returned_buffer_size()
// as 'width' and 'height' in the size calculation.
*output_size = image_size;
*unused = 1;
return image_size ? output : NULL;
}
// Changes the return type of WebPEncode* to more closely match Decode*.
// This also makes it easier to wrap the output buffer in a native type rather
// than dealing with the return pointer.
// The additional parameters are to allow reuse of returned_buffer_size(),
// unused2 and output_size will be used in this case.
#define LOSSY_WRAPPER(FUNC) \
static uint8_t* wrap_##FUNC( \
const uint8_t* rgb, int* unused1, int* unused2, int* output_size, \
int width, int height, int stride, float quality_factor) { \
return encode(rgb, width, height, stride, quality_factor, \
FUNC, output_size, unused2); \
} \
LOSSY_WRAPPER(WebPEncodeRGB)
LOSSY_WRAPPER(WebPEncodeBGR)
LOSSY_WRAPPER(WebPEncodeRGBA)
LOSSY_WRAPPER(WebPEncodeBGRA)
#undef LOSSY_WRAPPER
#define LOSSLESS_WRAPPER(FUNC) \
static uint8_t* wrap_##FUNC( \
const uint8_t* rgb, int* unused1, int* unused2, int* output_size, \
int width, int height, int stride) { \
return encode_lossless(rgb, width, height, stride, \
FUNC, output_size, unused2); \
} \
LOSSLESS_WRAPPER(WebPEncodeLosslessRGB)
LOSSLESS_WRAPPER(WebPEncodeLosslessBGR)
LOSSLESS_WRAPPER(WebPEncodeLosslessRGBA)
LOSSLESS_WRAPPER(WebPEncodeLosslessBGRA)
#undef LOSSLESS_WRAPPER
/* Work around broken gcj jni.h */
#ifdef __GCJ_JNI_H__
# undef JNIEXPORT
# define JNIEXPORT
# undef JNICALL
# define JNICALL
#endif
#ifdef __cplusplus
extern "C" {
#endif
SWIGEXPORT jint JNICALL Java_com_google_webp_libwebpJNI_WebPGetDecoderVersion(JNIEnv *jenv, jclass jcls) {
jint jresult = 0 ;
int result;
(void)jenv;
(void)jcls;
result = (int)WebPGetDecoderVersion();
jresult = (jint)result;
return jresult;
}
SWIGEXPORT jint JNICALL Java_com_google_webp_libwebpJNI_WebPGetInfo(JNIEnv *jenv, jclass jcls, jbyteArray jarg1, jlong jarg2, jintArray jarg3, jintArray jarg4) {
jint jresult = 0 ;
uint8_t *arg1 = (uint8_t *) 0 ;
size_t arg2 ;
int *arg3 = (int *) 0 ;
int *arg4 = (int *) 0 ;
jbyte *jarr1 ;
int temp3 ;
int temp4 ;
int result;
(void)jenv;
(void)jcls;
if (!SWIG_JavaArrayInSchar(jenv, &jarr1, &arg1, jarg1)) return 0;
arg2 = (size_t)jarg2;
{
if (!jarg3) {
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "array null");
return 0;
}
if ((*jenv)->GetArrayLength(jenv, jarg3) == 0) {
SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, "Array must contain at least 1 element");
return 0;
}
arg3 = &temp3;
}
{
if (!jarg4) {
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "array null");
return 0;
}
if ((*jenv)->GetArrayLength(jenv, jarg4) == 0) {
SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, "Array must contain at least 1 element");
return 0;
}
arg4 = &temp4;
}
result = (int)WebPGetInfo((uint8_t const *)arg1,arg2,arg3,arg4);
jresult = (jint)result;
SWIG_JavaArrayArgoutSchar(jenv, jarr1, arg1, jarg1);
{
jint jvalue = (jint)temp3;
(*jenv)->SetIntArrayRegion(jenv, jarg3, 0, 1, &jvalue);
}
{
jint jvalue = (jint)temp4;
(*jenv)->SetIntArrayRegion(jenv, jarg4, 0, 1, &jvalue);
}
free(arg1);
return jresult;
}
SWIGEXPORT jbyteArray JNICALL Java_com_google_webp_libwebpJNI_WebPDecodeRGB(JNIEnv *jenv, jclass jcls, jbyteArray jarg1, jlong jarg2, jintArray jarg3, jintArray jarg4) {
jbyteArray jresult = 0 ;
uint8_t *arg1 = (uint8_t *) 0 ;
size_t arg2 ;
int *arg3 = (int *) 0 ;
int *arg4 = (int *) 0 ;
jbyte *jarr1 ;
int temp3 ;
int temp4 ;
uint8_t *result = 0 ;
(void)jenv;
(void)jcls;
if (!SWIG_JavaArrayInSchar(jenv, &jarr1, &arg1, jarg1)) return 0;
arg2 = (size_t)jarg2;
{
if (!jarg3) {
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "array null");
return 0;
}
if ((*jenv)->GetArrayLength(jenv, jarg3) == 0) {
SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, "Array must contain at least 1 element");
return 0;
}
arg3 = &temp3;
}
{
if (!jarg4) {
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "array null");
return 0;
}
if ((*jenv)->GetArrayLength(jenv, jarg4) == 0) {
SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, "Array must contain at least 1 element");
return 0;
}
arg4 = &temp4;
}
result = (uint8_t *)WebPDecodeRGB((uint8_t const *)arg1,arg2,arg3,arg4);
jresult = SWIG_JavaArrayOutSchar(jenv, result, FillMeInAsSizeCannotBeDeterminedAutomatically);
SWIG_JavaArrayArgoutSchar(jenv, jarr1, arg1, jarg1);
{
jint jvalue = (jint)temp3;
(*jenv)->SetIntArrayRegion(jenv, jarg3, 0, 1, &jvalue);
}
{
jint jvalue = (jint)temp4;
(*jenv)->SetIntArrayRegion(jenv, jarg4, 0, 1, &jvalue);
}
free(arg1);
free(result);
return jresult;
}
SWIGEXPORT jbyteArray JNICALL Java_com_google_webp_libwebpJNI_WebPDecodeRGBA(JNIEnv *jenv, jclass jcls, jbyteArray jarg1, jlong jarg2, jintArray jarg3, jintArray jarg4) {
jbyteArray jresult = 0 ;
uint8_t *arg1 = (uint8_t *) 0 ;
size_t arg2 ;
int *arg3 = (int *) 0 ;
int *arg4 = (int *) 0 ;
jbyte *jarr1 ;
int temp3 ;
int temp4 ;
uint8_t *result = 0 ;
(void)jenv;
(void)jcls;
if (!SWIG_JavaArrayInSchar(jenv, &jarr1, &arg1, jarg1)) return 0;
arg2 = (size_t)jarg2;
{
if (!jarg3) {
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "array null");
return 0;
}
if ((*jenv)->GetArrayLength(jenv, jarg3) == 0) {
SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, "Array must contain at least 1 element");
return 0;
}
arg3 = &temp3;
}
{
if (!jarg4) {
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "array null");
return 0;
}
if ((*jenv)->GetArrayLength(jenv, jarg4) == 0) {
SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, "Array must contain at least 1 element");
return 0;
}
arg4 = &temp4;
}
result = (uint8_t *)WebPDecodeRGBA((uint8_t const *)arg1,arg2,arg3,arg4);
jresult = SWIG_JavaArrayOutSchar(jenv, result, FillMeInAsSizeCannotBeDeterminedAutomatically);
SWIG_JavaArrayArgoutSchar(jenv, jarr1, arg1, jarg1);
{
jint jvalue = (jint)temp3;
(*jenv)->SetIntArrayRegion(jenv, jarg3, 0, 1, &jvalue);
}
{
jint jvalue = (jint)temp4;
(*jenv)->SetIntArrayRegion(jenv, jarg4, 0, 1, &jvalue);
}
free(arg1);
free(result);
return jresult;
}
SWIGEXPORT jbyteArray JNICALL Java_com_google_webp_libwebpJNI_WebPDecodeARGB(JNIEnv *jenv, jclass jcls, jbyteArray jarg1, jlong jarg2, jintArray jarg3, jintArray jarg4) {
jbyteArray jresult = 0 ;
uint8_t *arg1 = (uint8_t *) 0 ;
size_t arg2 ;
int *arg3 = (int *) 0 ;
int *arg4 = (int *) 0 ;
jbyte *jarr1 ;
int temp3 ;
int temp4 ;
uint8_t *result = 0 ;
(void)jenv;
(void)jcls;
if (!SWIG_JavaArrayInSchar(jenv, &jarr1, &arg1, jarg1)) return 0;
arg2 = (size_t)jarg2;
{
if (!jarg3) {
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "array null");
return 0;
}
if ((*jenv)->GetArrayLength(jenv, jarg3) == 0) {
SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, "Array must contain at least 1 element");
return 0;
}
arg3 = &temp3;
}
{
if (!jarg4) {
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "array null");
return 0;
}
if ((*jenv)->GetArrayLength(jenv, jarg4) == 0) {
SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, "Array must contain at least 1 element");
return 0;
}
arg4 = &temp4;
}
result = (uint8_t *)WebPDecodeARGB((uint8_t const *)arg1,arg2,arg3,arg4);
jresult = SWIG_JavaArrayOutSchar(jenv, result, FillMeInAsSizeCannotBeDeterminedAutomatically);
SWIG_JavaArrayArgoutSchar(jenv, jarr1, arg1, jarg1);
{
jint jvalue = (jint)temp3;
(*jenv)->SetIntArrayRegion(jenv, jarg3, 0, 1, &jvalue);
}
{
jint jvalue = (jint)temp4;
(*jenv)->SetIntArrayRegion(jenv, jarg4, 0, 1, &jvalue);
}
free(arg1);
free(result);
return jresult;
}
SWIGEXPORT jbyteArray JNICALL Java_com_google_webp_libwebpJNI_WebPDecodeBGR(JNIEnv *jenv, jclass jcls, jbyteArray jarg1, jlong jarg2, jintArray jarg3, jintArray jarg4) {
jbyteArray jresult = 0 ;
uint8_t *arg1 = (uint8_t *) 0 ;
size_t arg2 ;
int *arg3 = (int *) 0 ;
int *arg4 = (int *) 0 ;
jbyte *jarr1 ;
int temp3 ;
int temp4 ;
uint8_t *result = 0 ;
(void)jenv;
(void)jcls;
if (!SWIG_JavaArrayInSchar(jenv, &jarr1, &arg1, jarg1)) return 0;
arg2 = (size_t)jarg2;
{
if (!jarg3) {
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "array null");
return 0;
}
if ((*jenv)->GetArrayLength(jenv, jarg3) == 0) {
SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, "Array must contain at least 1 element");
return 0;
}
arg3 = &temp3;
}
{
if (!jarg4) {
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "array null");
return 0;
}
if ((*jenv)->GetArrayLength(jenv, jarg4) == 0) {
SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, "Array must contain at least 1 element");
return 0;
}
arg4 = &temp4;
}
result = (uint8_t *)WebPDecodeBGR((uint8_t const *)arg1,arg2,arg3,arg4);
jresult = SWIG_JavaArrayOutSchar(jenv, result, FillMeInAsSizeCannotBeDeterminedAutomatically);
SWIG_JavaArrayArgoutSchar(jenv, jarr1, arg1, jarg1);
{
jint jvalue = (jint)temp3;
(*jenv)->SetIntArrayRegion(jenv, jarg3, 0, 1, &jvalue);
}
{
jint jvalue = (jint)temp4;
(*jenv)->SetIntArrayRegion(jenv, jarg4, 0, 1, &jvalue);
}
free(arg1);
free(result);
return jresult;
}
SWIGEXPORT jbyteArray JNICALL Java_com_google_webp_libwebpJNI_WebPDecodeBGRA(JNIEnv *jenv, jclass jcls, jbyteArray jarg1, jlong jarg2, jintArray jarg3, jintArray jarg4) {
jbyteArray jresult = 0 ;
uint8_t *arg1 = (uint8_t *) 0 ;
size_t arg2 ;
int *arg3 = (int *) 0 ;
int *arg4 = (int *) 0 ;
jbyte *jarr1 ;
int temp3 ;
int temp4 ;
uint8_t *result = 0 ;
(void)jenv;
(void)jcls;
if (!SWIG_JavaArrayInSchar(jenv, &jarr1, &arg1, jarg1)) return 0;
arg2 = (size_t)jarg2;
{
if (!jarg3) {
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "array null");
return 0;
}
if ((*jenv)->GetArrayLength(jenv, jarg3) == 0) {
SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, "Array must contain at least 1 element");
return 0;
}
arg3 = &temp3;
}
{
if (!jarg4) {
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "array null");
return 0;
}
if ((*jenv)->GetArrayLength(jenv, jarg4) == 0) {
SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, "Array must contain at least 1 element");
return 0;
}
arg4 = &temp4;
}
result = (uint8_t *)WebPDecodeBGRA((uint8_t const *)arg1,arg2,arg3,arg4);
jresult = SWIG_JavaArrayOutSchar(jenv, result, FillMeInAsSizeCannotBeDeterminedAutomatically);
SWIG_JavaArrayArgoutSchar(jenv, jarr1, arg1, jarg1);
{
jint jvalue = (jint)temp3;
(*jenv)->SetIntArrayRegion(jenv, jarg3, 0, 1, &jvalue);
}
{
jint jvalue = (jint)temp4;
(*jenv)->SetIntArrayRegion(jenv, jarg4, 0, 1, &jvalue);
}
free(arg1);
free(result);
return jresult;
}
SWIGEXPORT jint JNICALL Java_com_google_webp_libwebpJNI_WebPGetEncoderVersion(JNIEnv *jenv, jclass jcls) {
jint jresult = 0 ;
int result;
(void)jenv;
(void)jcls;
result = (int)WebPGetEncoderVersion();
jresult = (jint)result;
return jresult;
}
SWIGEXPORT jbyteArray JNICALL Java_com_google_webp_libwebpJNI_wrap_1WebPEncodeRGB(JNIEnv *jenv, jclass jcls, jbyteArray jarg1, jint jarg2, jint jarg3, jintArray jarg4, jint jarg5, jint jarg6, jint jarg7, jfloat jarg8) {
jbyteArray jresult = 0 ;
uint8_t *arg1 = (uint8_t *) 0 ;
int *arg2 = (int *) 0 ;
int *arg3 = (int *) 0 ;
int *arg4 = (int *) 0 ;
int arg5 ;
int arg6 ;
int arg7 ;
float arg8 ;
jbyte *jarr1 ;
int temp4 ;
uint8_t *result = 0 ;
(void)jenv;
(void)jcls;
if (!SWIG_JavaArrayInSchar(jenv, &jarr1, &arg1, jarg1)) return 0;
arg2 = (int *)&jarg2;
arg3 = (int *)&jarg3;
{
if (!jarg4) {
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "array null");
return 0;
}
if ((*jenv)->GetArrayLength(jenv, jarg4) == 0) {
SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, "Array must contain at least 1 element");
return 0;
}
arg4 = &temp4;
}
arg5 = (int)jarg5;
arg6 = (int)jarg6;
arg7 = (int)jarg7;
arg8 = (float)jarg8;
result = (uint8_t *)wrap_WebPEncodeRGB((uint8_t const *)arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8);
jresult = SWIG_JavaArrayOutSchar(jenv, result, FillMeInAsSizeCannotBeDeterminedAutomatically);
SWIG_JavaArrayArgoutSchar(jenv, jarr1, arg1, jarg1);
{
jint jvalue = (jint)temp4;
(*jenv)->SetIntArrayRegion(jenv, jarg4, 0, 1, &jvalue);
}
free(arg1);
free(result);
return jresult;
}
SWIGEXPORT jbyteArray JNICALL Java_com_google_webp_libwebpJNI_wrap_1WebPEncodeBGR(JNIEnv *jenv, jclass jcls, jbyteArray jarg1, jint jarg2, jint jarg3, jintArray jarg4, jint jarg5, jint jarg6, jint jarg7, jfloat jarg8) {
jbyteArray jresult = 0 ;
uint8_t *arg1 = (uint8_t *) 0 ;
int *arg2 = (int *) 0 ;
int *arg3 = (int *) 0 ;
int *arg4 = (int *) 0 ;
int arg5 ;
int arg6 ;
int arg7 ;
float arg8 ;
jbyte *jarr1 ;
int temp4 ;
uint8_t *result = 0 ;
(void)jenv;
(void)jcls;
if (!SWIG_JavaArrayInSchar(jenv, &jarr1, &arg1, jarg1)) return 0;
arg2 = (int *)&jarg2;
arg3 = (int *)&jarg3;
{
if (!jarg4) {
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "array null");
return 0;
}
if ((*jenv)->GetArrayLength(jenv, jarg4) == 0) {
SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, "Array must contain at least 1 element");
return 0;
}
arg4 = &temp4;
}
arg5 = (int)jarg5;
arg6 = (int)jarg6;
arg7 = (int)jarg7;
arg8 = (float)jarg8;
result = (uint8_t *)wrap_WebPEncodeBGR((uint8_t const *)arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8);
jresult = SWIG_JavaArrayOutSchar(jenv, result, FillMeInAsSizeCannotBeDeterminedAutomatically);
SWIG_JavaArrayArgoutSchar(jenv, jarr1, arg1, jarg1);
{
jint jvalue = (jint)temp4;
(*jenv)->SetIntArrayRegion(jenv, jarg4, 0, 1, &jvalue);
}
free(arg1);
free(result);
return jresult;
}
SWIGEXPORT jbyteArray JNICALL Java_com_google_webp_libwebpJNI_wrap_1WebPEncodeRGBA(JNIEnv *jenv, jclass jcls, jbyteArray jarg1, jint jarg2, jint jarg3, jintArray jarg4, jint jarg5, jint jarg6, jint jarg7, jfloat jarg8) {
jbyteArray jresult = 0 ;
uint8_t *arg1 = (uint8_t *) 0 ;
int *arg2 = (int *) 0 ;
int *arg3 = (int *) 0 ;
int *arg4 = (int *) 0 ;
int arg5 ;
int arg6 ;
int arg7 ;
float arg8 ;
jbyte *jarr1 ;
int temp4 ;
uint8_t *result = 0 ;
(void)jenv;
(void)jcls;
if (!SWIG_JavaArrayInSchar(jenv, &jarr1, &arg1, jarg1)) return 0;
arg2 = (int *)&jarg2;
arg3 = (int *)&jarg3;
{
if (!jarg4) {
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "array null");
return 0;
}
if ((*jenv)->GetArrayLength(jenv, jarg4) == 0) {
SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, "Array must contain at least 1 element");
return 0;
}
arg4 = &temp4;
}
arg5 = (int)jarg5;
arg6 = (int)jarg6;
arg7 = (int)jarg7;
arg8 = (float)jarg8;
result = (uint8_t *)wrap_WebPEncodeRGBA((uint8_t const *)arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8);
jresult = SWIG_JavaArrayOutSchar(jenv, result, FillMeInAsSizeCannotBeDeterminedAutomatically);
SWIG_JavaArrayArgoutSchar(jenv, jarr1, arg1, jarg1);
{
jint jvalue = (jint)temp4;
(*jenv)->SetIntArrayRegion(jenv, jarg4, 0, 1, &jvalue);
}
free(arg1);
free(result);
return jresult;
}
SWIGEXPORT jbyteArray JNICALL Java_com_google_webp_libwebpJNI_wrap_1WebPEncodeBGRA(JNIEnv *jenv, jclass jcls, jbyteArray jarg1, jint jarg2, jint jarg3, jintArray jarg4, jint jarg5, jint jarg6, jint jarg7, jfloat jarg8) {
jbyteArray jresult = 0 ;
uint8_t *arg1 = (uint8_t *) 0 ;
int *arg2 = (int *) 0 ;
int *arg3 = (int *) 0 ;
int *arg4 = (int *) 0 ;
int arg5 ;
int arg6 ;
int arg7 ;
float arg8 ;
jbyte *jarr1 ;
int temp4 ;
uint8_t *result = 0 ;
(void)jenv;
(void)jcls;
if (!SWIG_JavaArrayInSchar(jenv, &jarr1, &arg1, jarg1)) return 0;
arg2 = (int *)&jarg2;
arg3 = (int *)&jarg3;
{
if (!jarg4) {
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "array null");
return 0;
}
if ((*jenv)->GetArrayLength(jenv, jarg4) == 0) {
SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, "Array must contain at least 1 element");
return 0;
}
arg4 = &temp4;
}
arg5 = (int)jarg5;
arg6 = (int)jarg6;
arg7 = (int)jarg7;
arg8 = (float)jarg8;
result = (uint8_t *)wrap_WebPEncodeBGRA((uint8_t const *)arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8);
jresult = SWIG_JavaArrayOutSchar(jenv, result, FillMeInAsSizeCannotBeDeterminedAutomatically);
SWIG_JavaArrayArgoutSchar(jenv, jarr1, arg1, jarg1);
{
jint jvalue = (jint)temp4;
(*jenv)->SetIntArrayRegion(jenv, jarg4, 0, 1, &jvalue);
}
free(arg1);
free(result);
return jresult;
}
SWIGEXPORT jbyteArray JNICALL Java_com_google_webp_libwebpJNI_wrap_1WebPEncodeLosslessRGB(JNIEnv *jenv, jclass jcls, jbyteArray jarg1, jint jarg2, jint jarg3, jintArray jarg4, jint jarg5, jint jarg6, jint jarg7) {
jbyteArray jresult = 0 ;
uint8_t *arg1 = (uint8_t *) 0 ;
int *arg2 = (int *) 0 ;
int *arg3 = (int *) 0 ;
int *arg4 = (int *) 0 ;
int arg5 ;
int arg6 ;
int arg7 ;
jbyte *jarr1 ;
int temp4 ;
uint8_t *result = 0 ;
(void)jenv;
(void)jcls;
if (!SWIG_JavaArrayInSchar(jenv, &jarr1, &arg1, jarg1)) return 0;
arg2 = (int *)&jarg2;
arg3 = (int *)&jarg3;
{
if (!jarg4) {
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "array null");
return 0;
}
if ((*jenv)->GetArrayLength(jenv, jarg4) == 0) {
SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, "Array must contain at least 1 element");
return 0;
}
arg4 = &temp4;
}
arg5 = (int)jarg5;
arg6 = (int)jarg6;
arg7 = (int)jarg7;
result = (uint8_t *)wrap_WebPEncodeLosslessRGB((uint8_t const *)arg1,arg2,arg3,arg4,arg5,arg6,arg7);
jresult = SWIG_JavaArrayOutSchar(jenv, result, FillMeInAsSizeCannotBeDeterminedAutomatically);
SWIG_JavaArrayArgoutSchar(jenv, jarr1, arg1, jarg1);
{
jint jvalue = (jint)temp4;
(*jenv)->SetIntArrayRegion(jenv, jarg4, 0, 1, &jvalue);
}
free(arg1);
free(result);
return jresult;
}
SWIGEXPORT jbyteArray JNICALL Java_com_google_webp_libwebpJNI_wrap_1WebPEncodeLosslessBGR(JNIEnv *jenv, jclass jcls, jbyteArray jarg1, jint jarg2, jint jarg3, jintArray jarg4, jint jarg5, jint jarg6, jint jarg7) {
jbyteArray jresult = 0 ;
uint8_t *arg1 = (uint8_t *) 0 ;
int *arg2 = (int *) 0 ;
int *arg3 = (int *) 0 ;
int *arg4 = (int *) 0 ;
int arg5 ;
int arg6 ;
int arg7 ;
jbyte *jarr1 ;
int temp4 ;
uint8_t *result = 0 ;
(void)jenv;
(void)jcls;
if (!SWIG_JavaArrayInSchar(jenv, &jarr1, &arg1, jarg1)) return 0;
arg2 = (int *)&jarg2;
arg3 = (int *)&jarg3;
{
if (!jarg4) {
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "array null");
return 0;
}
if ((*jenv)->GetArrayLength(jenv, jarg4) == 0) {
SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, "Array must contain at least 1 element");
return 0;
}
arg4 = &temp4;
}
arg5 = (int)jarg5;
arg6 = (int)jarg6;
arg7 = (int)jarg7;
result = (uint8_t *)wrap_WebPEncodeLosslessBGR((uint8_t const *)arg1,arg2,arg3,arg4,arg5,arg6,arg7);
jresult = SWIG_JavaArrayOutSchar(jenv, result, FillMeInAsSizeCannotBeDeterminedAutomatically);
SWIG_JavaArrayArgoutSchar(jenv, jarr1, arg1, jarg1);
{
jint jvalue = (jint)temp4;
(*jenv)->SetIntArrayRegion(jenv, jarg4, 0, 1, &jvalue);
}
free(arg1);
free(result);
return jresult;
}
SWIGEXPORT jbyteArray JNICALL Java_com_google_webp_libwebpJNI_wrap_1WebPEncodeLosslessRGBA(JNIEnv *jenv, jclass jcls, jbyteArray jarg1, jint jarg2, jint jarg3, jintArray jarg4, jint jarg5, jint jarg6, jint jarg7) {
jbyteArray jresult = 0 ;
uint8_t *arg1 = (uint8_t *) 0 ;
int *arg2 = (int *) 0 ;
int *arg3 = (int *) 0 ;
int *arg4 = (int *) 0 ;
int arg5 ;
int arg6 ;
int arg7 ;
jbyte *jarr1 ;
int temp4 ;
uint8_t *result = 0 ;
(void)jenv;
(void)jcls;
if (!SWIG_JavaArrayInSchar(jenv, &jarr1, &arg1, jarg1)) return 0;
arg2 = (int *)&jarg2;
arg3 = (int *)&jarg3;
{
if (!jarg4) {
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "array null");
return 0;
}
if ((*jenv)->GetArrayLength(jenv, jarg4) == 0) {
SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, "Array must contain at least 1 element");
return 0;
}
arg4 = &temp4;
}
arg5 = (int)jarg5;
arg6 = (int)jarg6;
arg7 = (int)jarg7;
result = (uint8_t *)wrap_WebPEncodeLosslessRGBA((uint8_t const *)arg1,arg2,arg3,arg4,arg5,arg6,arg7);
jresult = SWIG_JavaArrayOutSchar(jenv, result, FillMeInAsSizeCannotBeDeterminedAutomatically);
SWIG_JavaArrayArgoutSchar(jenv, jarr1, arg1, jarg1);
{
jint jvalue = (jint)temp4;
(*jenv)->SetIntArrayRegion(jenv, jarg4, 0, 1, &jvalue);
}
free(arg1);
free(result);
return jresult;
}
SWIGEXPORT jbyteArray JNICALL Java_com_google_webp_libwebpJNI_wrap_1WebPEncodeLosslessBGRA(JNIEnv *jenv, jclass jcls, jbyteArray jarg1, jint jarg2, jint jarg3, jintArray jarg4, jint jarg5, jint jarg6, jint jarg7) {
jbyteArray jresult = 0 ;
uint8_t *arg1 = (uint8_t *) 0 ;
int *arg2 = (int *) 0 ;
int *arg3 = (int *) 0 ;
int *arg4 = (int *) 0 ;
int arg5 ;
int arg6 ;
int arg7 ;
jbyte *jarr1 ;
int temp4 ;
uint8_t *result = 0 ;
(void)jenv;
(void)jcls;
if (!SWIG_JavaArrayInSchar(jenv, &jarr1, &arg1, jarg1)) return 0;
arg2 = (int *)&jarg2;
arg3 = (int *)&jarg3;
{
if (!jarg4) {
SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "array null");
return 0;
}
if ((*jenv)->GetArrayLength(jenv, jarg4) == 0) {
SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, "Array must contain at least 1 element");
return 0;
}
arg4 = &temp4;
}
arg5 = (int)jarg5;
arg6 = (int)jarg6;
arg7 = (int)jarg7;
result = (uint8_t *)wrap_WebPEncodeLosslessBGRA((uint8_t const *)arg1,arg2,arg3,arg4,arg5,arg6,arg7);
jresult = SWIG_JavaArrayOutSchar(jenv, result, FillMeInAsSizeCannotBeDeterminedAutomatically);
SWIG_JavaArrayArgoutSchar(jenv, jarr1, arg1, jarg1);
{
jint jvalue = (jint)temp4;
(*jenv)->SetIntArrayRegion(jenv, jarg4, 0, 1, &jvalue);
}
free(arg1);
free(result);
return jresult;
}
#ifdef __cplusplus
}
#endif