mirror of
https://github.com/webmproject/libwebp.git
synced 2025-02-28 14:52:52 +01:00
swig: cosmetics
normalize formatting - update decode prototypes - match project function name style Change-Id: Ib481b5602171b72dbb1a5d462e6d5166e9b8566e (cherry picked from commit 7f5f42bb36e07c4f61fe19617e29fb2b5fed5b5d)
This commit is contained in:
parent
498d4dd634
commit
b4f5bb6ca3
@ -76,9 +76,9 @@ int WebPGetEncoderVersion(void);
|
|||||||
#ifdef SWIGJAVA
|
#ifdef SWIGJAVA
|
||||||
%{
|
%{
|
||||||
#define FillMeInAsSizeCannotBeDeterminedAutomatically \
|
#define FillMeInAsSizeCannotBeDeterminedAutomatically \
|
||||||
(result ? returned_buffer_size(__FUNCTION__, arg3, arg4) : 0)
|
(result ? ReturnedBufferSize(__FUNCTION__, arg3, arg4) : 0)
|
||||||
|
|
||||||
static jint returned_buffer_size(
|
static jint ReturnedBufferSize(
|
||||||
const char* function, int* width, int* height) {
|
const char* function, int* width, int* height) {
|
||||||
static const struct sizemap {
|
static const struct sizemap {
|
||||||
const char* function;
|
const char* function;
|
||||||
@ -123,7 +123,7 @@ typedef size_t (*WebPEncodeLosslessFunction)(const uint8_t* rgb,
|
|||||||
int width, int height, int stride,
|
int width, int height, int stride,
|
||||||
uint8_t** output);
|
uint8_t** output);
|
||||||
|
|
||||||
static uint8_t* encode(const uint8_t* rgb,
|
static uint8_t* EncodeLossy(const uint8_t* rgb,
|
||||||
int width, int height, int stride,
|
int width, int height, int stride,
|
||||||
float quality_factor,
|
float quality_factor,
|
||||||
WebPEncodeFunction encfn,
|
WebPEncodeFunction encfn,
|
||||||
@ -131,21 +131,21 @@ static uint8_t* encode(const uint8_t* rgb,
|
|||||||
uint8_t* output = NULL;
|
uint8_t* output = NULL;
|
||||||
const size_t image_size =
|
const size_t image_size =
|
||||||
encfn(rgb, width, height, stride, quality_factor, &output);
|
encfn(rgb, width, height, stride, quality_factor, &output);
|
||||||
// the values of following two will be interpreted by returned_buffer_size()
|
// the values of following two will be interpreted by ReturnedBufferSize()
|
||||||
// as 'width' and 'height' in the size calculation.
|
// as 'width' and 'height' in the size calculation.
|
||||||
*output_size = image_size;
|
*output_size = image_size;
|
||||||
*unused = 1;
|
*unused = 1;
|
||||||
return image_size ? output : NULL;
|
return image_size ? output : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint8_t* encode_lossless(const uint8_t* rgb,
|
static uint8_t* EncodeLossless(const uint8_t* rgb,
|
||||||
int width, int height, int stride,
|
int width, int height, int stride,
|
||||||
WebPEncodeLosslessFunction encfn,
|
WebPEncodeLosslessFunction encfn,
|
||||||
int* output_size, int* unused) {
|
int* output_size, int* unused) {
|
||||||
uint8_t* output = NULL;
|
uint8_t* output = NULL;
|
||||||
const size_t image_size = encfn(rgb, width, height, stride, &output);
|
const size_t image_size = encfn(rgb, width, height, stride, &output);
|
||||||
// the values of following two will be interpreted by returned_buffer_size()
|
// the values of the following two will be interpreted by
|
||||||
// as 'width' and 'height' in the size calculation.
|
// ReturnedBufferSize() as 'width' and 'height' in the size calculation.
|
||||||
*output_size = image_size;
|
*output_size = image_size;
|
||||||
*unused = 1;
|
*unused = 1;
|
||||||
return image_size ? output : NULL;
|
return image_size ? output : NULL;
|
||||||
@ -185,13 +185,13 @@ static uint8_t* encode_lossless(const uint8_t* rgb,
|
|||||||
// Changes the return type of WebPEncode* to more closely match Decode*.
|
// 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
|
// This also makes it easier to wrap the output buffer in a native type rather
|
||||||
// than dealing with the return pointer.
|
// than dealing with the return pointer.
|
||||||
// The additional parameters are to allow reuse of returned_buffer_size(),
|
// The additional parameters are to allow reuse of ReturnedBufferSize(),
|
||||||
// unused2 and output_size will be used in this case.
|
// unused2 and output_size will be used in this case.
|
||||||
#define LOSSY_WRAPPER(FUNC) \
|
#define LOSSY_WRAPPER(FUNC) \
|
||||||
static uint8_t* wrap_##FUNC( \
|
static uint8_t* wrap_##FUNC( \
|
||||||
const uint8_t* rgb, int* unused1, int* unused2, int* output_size, \
|
const uint8_t* rgb, int* unused1, int* unused2, int* output_size, \
|
||||||
int width, int height, int stride, float quality_factor) { \
|
int width, int height, int stride, float quality_factor) { \
|
||||||
return encode(rgb, width, height, stride, quality_factor, \
|
return EncodeLossy(rgb, width, height, stride, quality_factor, \
|
||||||
FUNC, output_size, unused2); \
|
FUNC, output_size, unused2); \
|
||||||
} \
|
} \
|
||||||
|
|
||||||
@ -206,7 +206,7 @@ LOSSY_WRAPPER(WebPEncodeBGRA)
|
|||||||
static uint8_t* wrap_##FUNC( \
|
static uint8_t* wrap_##FUNC( \
|
||||||
const uint8_t* rgb, int* unused1, int* unused2, int* output_size, \
|
const uint8_t* rgb, int* unused1, int* unused2, int* output_size, \
|
||||||
int width, int height, int stride) { \
|
int width, int height, int stride) { \
|
||||||
return encode_lossless(rgb, width, height, stride, \
|
return EncodeLossless(rgb, width, height, stride, \
|
||||||
FUNC, output_size, unused2); \
|
FUNC, output_size, unused2); \
|
||||||
} \
|
} \
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* ----------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------
|
||||||
* This file was automatically generated by SWIG (http://www.swig.org).
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
* Version 1.3.40
|
* Version 2.0.4
|
||||||
*
|
*
|
||||||
* This file is not intended to be easily readable and contains a number of
|
* 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
|
* coding conventions designed to improve portability and efficiency. Do not make
|
||||||
@ -811,10 +811,11 @@ jdoubleArray SWIG_JavaArrayOutDouble (JNIEnv *jenv, double *result, jsize sz) {
|
|||||||
#include "webp/decode.h"
|
#include "webp/decode.h"
|
||||||
#include "webp/encode.h"
|
#include "webp/encode.h"
|
||||||
|
|
||||||
#define FillMeInAsSizeCannotBeDeterminedAutomatically \
|
|
||||||
(result ? returned_buffer_size(__FUNCTION__, arg3, arg4) : 0)
|
|
||||||
|
|
||||||
static jint returned_buffer_size(
|
#define FillMeInAsSizeCannotBeDeterminedAutomatically \
|
||||||
|
(result ? ReturnedBufferSize(__FUNCTION__, arg3, arg4) : 0)
|
||||||
|
|
||||||
|
static jint ReturnedBufferSize(
|
||||||
const char* function, int* width, int* height) {
|
const char* function, int* width, int* height) {
|
||||||
static const struct sizemap {
|
static const struct sizemap {
|
||||||
const char* function;
|
const char* function;
|
||||||
@ -848,6 +849,8 @@ static jint returned_buffer_size(
|
|||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef size_t (*WebPEncodeFunction)(const uint8_t* rgb,
|
typedef size_t (*WebPEncodeFunction)(const uint8_t* rgb,
|
||||||
int width, int height, int stride,
|
int width, int height, int stride,
|
||||||
float quality_factor, uint8_t** output);
|
float quality_factor, uint8_t** output);
|
||||||
@ -855,7 +858,7 @@ typedef size_t (*WebPEncodeLosslessFunction)(const uint8_t* rgb,
|
|||||||
int width, int height, int stride,
|
int width, int height, int stride,
|
||||||
uint8_t** output);
|
uint8_t** output);
|
||||||
|
|
||||||
static uint8_t* encode(const uint8_t* rgb,
|
static uint8_t* EncodeLossy(const uint8_t* rgb,
|
||||||
int width, int height, int stride,
|
int width, int height, int stride,
|
||||||
float quality_factor,
|
float quality_factor,
|
||||||
WebPEncodeFunction encfn,
|
WebPEncodeFunction encfn,
|
||||||
@ -863,21 +866,21 @@ static uint8_t* encode(const uint8_t* rgb,
|
|||||||
uint8_t* output = NULL;
|
uint8_t* output = NULL;
|
||||||
const size_t image_size =
|
const size_t image_size =
|
||||||
encfn(rgb, width, height, stride, quality_factor, &output);
|
encfn(rgb, width, height, stride, quality_factor, &output);
|
||||||
// the values of following two will be interpreted by returned_buffer_size()
|
// the values of following two will be interpreted by ReturnedBufferSize()
|
||||||
// as 'width' and 'height' in the size calculation.
|
// as 'width' and 'height' in the size calculation.
|
||||||
*output_size = image_size;
|
*output_size = image_size;
|
||||||
*unused = 1;
|
*unused = 1;
|
||||||
return image_size ? output : NULL;
|
return image_size ? output : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint8_t* encode_lossless(const uint8_t* rgb,
|
static uint8_t* EncodeLossless(const uint8_t* rgb,
|
||||||
int width, int height, int stride,
|
int width, int height, int stride,
|
||||||
WebPEncodeLosslessFunction encfn,
|
WebPEncodeLosslessFunction encfn,
|
||||||
int* output_size, int* unused) {
|
int* output_size, int* unused) {
|
||||||
uint8_t* output = NULL;
|
uint8_t* output = NULL;
|
||||||
const size_t image_size = encfn(rgb, width, height, stride, &output);
|
const size_t image_size = encfn(rgb, width, height, stride, &output);
|
||||||
// the values of following two will be interpreted by returned_buffer_size()
|
// the values of the following two will be interpreted by
|
||||||
// as 'width' and 'height' in the size calculation.
|
// ReturnedBufferSize() as 'width' and 'height' in the size calculation.
|
||||||
*output_size = image_size;
|
*output_size = image_size;
|
||||||
*unused = 1;
|
*unused = 1;
|
||||||
return image_size ? output : NULL;
|
return image_size ? output : NULL;
|
||||||
@ -887,13 +890,13 @@ static uint8_t* encode_lossless(const uint8_t* rgb,
|
|||||||
// Changes the return type of WebPEncode* to more closely match Decode*.
|
// 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
|
// This also makes it easier to wrap the output buffer in a native type rather
|
||||||
// than dealing with the return pointer.
|
// than dealing with the return pointer.
|
||||||
// The additional parameters are to allow reuse of returned_buffer_size(),
|
// The additional parameters are to allow reuse of ReturnedBufferSize(),
|
||||||
// unused2 and output_size will be used in this case.
|
// unused2 and output_size will be used in this case.
|
||||||
#define LOSSY_WRAPPER(FUNC) \
|
#define LOSSY_WRAPPER(FUNC) \
|
||||||
static uint8_t* wrap_##FUNC( \
|
static uint8_t* wrap_##FUNC( \
|
||||||
const uint8_t* rgb, int* unused1, int* unused2, int* output_size, \
|
const uint8_t* rgb, int* unused1, int* unused2, int* output_size, \
|
||||||
int width, int height, int stride, float quality_factor) { \
|
int width, int height, int stride, float quality_factor) { \
|
||||||
return encode(rgb, width, height, stride, quality_factor, \
|
return EncodeLossy(rgb, width, height, stride, quality_factor, \
|
||||||
FUNC, output_size, unused2); \
|
FUNC, output_size, unused2); \
|
||||||
} \
|
} \
|
||||||
|
|
||||||
@ -908,7 +911,7 @@ LOSSY_WRAPPER(WebPEncodeBGRA)
|
|||||||
static uint8_t* wrap_##FUNC( \
|
static uint8_t* wrap_##FUNC( \
|
||||||
const uint8_t* rgb, int* unused1, int* unused2, int* output_size, \
|
const uint8_t* rgb, int* unused1, int* unused2, int* output_size, \
|
||||||
int width, int height, int stride) { \
|
int width, int height, int stride) { \
|
||||||
return encode_lossless(rgb, width, height, stride, \
|
return EncodeLossless(rgb, width, height, stride, \
|
||||||
FUNC, output_size, unused2); \
|
FUNC, output_size, unused2); \
|
||||||
} \
|
} \
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user