Skip to content

Commit f28ea49

Browse files
author
minggo
authored
Merge pull request #229 from zilongshanren/upgrade-webp-tizen
upgrade webp to 0.5 for tizen
2 parents 0b98105 + 64123e2 commit f28ea49

File tree

5 files changed

+37
-41
lines changed

5 files changed

+37
-41
lines changed

webp/include/tizen/decode.h

+9-24
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
extern "C" {
2121
#endif
2222

23-
#define WEBP_DECODER_ABI_VERSION 0x0203 // MAJOR(8b) + MINOR(8b)
23+
#define WEBP_DECODER_ABI_VERSION 0x0208 // MAJOR(8b) + MINOR(8b)
2424

2525
// Note: forward declaring enumerations is not allowed in (strict) C and C++,
2626
// the types are left here for reference.
@@ -48,7 +48,7 @@ WEBP_EXTERN(int) WebPGetInfo(const uint8_t* data, size_t data_size,
4848
// Decodes WebP images pointed to by 'data' and returns RGBA samples, along
4949
// with the dimensions in *width and *height. The ordering of samples in
5050
// memory is R, G, B, A, R, G, B, A... in scan order (endian-independent).
51-
// The returned pointer should be deleted calling free().
51+
// The returned pointer should be deleted calling WebPFree().
5252
// Returns NULL in case of error.
5353
WEBP_EXTERN(uint8_t*) WebPDecodeRGBA(const uint8_t* data, size_t data_size,
5454
int* width, int* height);
@@ -73,9 +73,9 @@ WEBP_EXTERN(uint8_t*) WebPDecodeBGR(const uint8_t* data, size_t data_size,
7373

7474
// Decode WebP images pointed to by 'data' to Y'UV format(*). The pointer
7575
// returned is the Y samples buffer. Upon return, *u and *v will point to
76-
// the U and V chroma data. These U and V buffers need NOT be free()'d,
77-
// unlike the returned Y luma one. The dimension of the U and V planes
78-
// are both (*width + 1) / 2 and (*height + 1)/ 2.
76+
// the U and V chroma data. These U and V buffers need NOT be passed to
77+
// WebPFree(), unlike the returned Y luma one. The dimension of the U and V
78+
// planes are both (*width + 1) / 2 and (*height + 1)/ 2.
7979
// Upon return, the Y buffer has a stride returned as '*stride', while U and V
8080
// have a common stride returned as '*uv_stride'.
8181
// Return NULL in case of error.
@@ -85,6 +85,9 @@ WEBP_EXTERN(uint8_t*) WebPDecodeYUV(const uint8_t* data, size_t data_size,
8585
uint8_t** u, uint8_t** v,
8686
int* stride, int* uv_stride);
8787

88+
// Releases memory returned by the WebPDecode*() functions above.
89+
WEBP_EXTERN(void) WebPFree(void* ptr);
90+
8891
// These five functions are variants of the above ones, that decode the image
8992
// directly into a pre-allocated buffer 'output_buffer'. The maximum storage
9093
// available in this buffer is indicated by 'output_buffer_size'. If this
@@ -406,12 +409,7 @@ struct WebPBitstreamFeatures {
406409
int has_animation; // True if the bitstream is an animation.
407410
int format; // 0 = undefined (/mixed), 1 = lossy, 2 = lossless
408411

409-
// Unused for now:
410-
int no_incremental_decoding; // if true, using incremental decoding is not
411-
// recommended.
412-
int rotate; // TODO(later)
413-
int uv_sampling; // should be 0 for now. TODO(later)
414-
uint32_t pad[2]; // padding for later use
412+
uint32_t pad[5]; // padding for later use
415413
};
416414

417415
// Internal, version-checked, entry point
@@ -442,23 +440,10 @@ struct WebPDecoderOptions {
442440
int scaled_width, scaled_height; // final resolution
443441
int use_threads; // if true, use multi-threaded decoding
444442
int dithering_strength; // dithering strength (0=Off, 100=full)
445-
#if WEBP_DECODER_ABI_VERSION > 0x0203
446443
int flip; // flip output vertically
447-
#endif
448-
#if WEBP_DECODER_ABI_VERSION > 0x0204
449444
int alpha_dithering_strength; // alpha dithering strength in [0..100]
450-
#endif
451445

452-
// Unused for now:
453-
int force_rotation; // forced rotation (to be applied _last_)
454-
int no_enhancement; // if true, discard enhancement layer
455-
#if WEBP_DECODER_ABI_VERSION < 0x0203
456446
uint32_t pad[5]; // padding for later use
457-
#elif WEBP_DECODER_ABI_VERSION < 0x0204
458-
uint32_t pad[4]; // padding for later use
459-
#else
460-
uint32_t pad[3]; // padding for later use
461-
#endif
462447
};
463448

464449
// Main object storing the configuration for advanced decoding.

webp/include/tizen/encode.h

+23-16
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
extern "C" {
2121
#endif
2222

23-
#define WEBP_ENCODER_ABI_VERSION 0x0202 // MAJOR(8b) + MINOR(8b)
23+
#define WEBP_ENCODER_ABI_VERSION 0x0209 // MAJOR(8b) + MINOR(8b)
2424

2525
// Note: forward declaring enumerations is not allowed in (strict) C and C++,
2626
// the types are left here for reference.
@@ -42,7 +42,7 @@ WEBP_EXTERN(int) WebPGetEncoderVersion(void);
4242

4343
// Returns the size of the compressed data (pointed to by *output), or 0 if
4444
// an error occurred. The compressed data must be released by the caller
45-
// using the call 'free(*output)'.
45+
// using the call 'WebPFree(*output)'.
4646
// These functions compress using the lossy format, and the quality_factor
4747
// can go from 0 (smaller output, lower quality) to 100 (best quality,
4848
// larger output).
@@ -75,6 +75,9 @@ WEBP_EXTERN(size_t) WebPEncodeLosslessBGRA(const uint8_t* bgra,
7575
int width, int height, int stride,
7676
uint8_t** output);
7777

78+
// Releases memory returned by the WebPEncode*() functions above.
79+
WEBP_EXTERN(void) WebPFree(void* ptr);
80+
7881
//------------------------------------------------------------------------------
7982
// Coding parameters
8083

@@ -131,7 +134,19 @@ struct WebPConfig {
131134
int thread_level; // If non-zero, try and use multi-threaded encoding.
132135
int low_memory; // If set, reduce memory usage (but increase CPU use).
133136

134-
uint32_t pad[5]; // padding for later use
137+
int near_lossless; // Near lossless encoding [0 = off(default) .. 100].
138+
// This feature is experimental.
139+
int exact; // if non-zero, preserve the exact RGB values under
140+
// transparent area. Otherwise, discard this invisible
141+
// RGB information for better compression. The default
142+
// value is 0.
143+
144+
#ifdef WEBP_EXPERIMENTAL_FEATURES
145+
int delta_palettization;
146+
uint32_t pad[2]; // padding for later use
147+
#else
148+
uint32_t pad[3]; // padding for later use
149+
#endif // WEBP_EXPERIMENTAL_FEATURES
135150
};
136151

137152
// Enumerate some predefined settings for WebPConfig, depending on the type
@@ -167,15 +182,13 @@ static WEBP_INLINE int WebPConfigPreset(WebPConfig* config,
167182
WEBP_ENCODER_ABI_VERSION);
168183
}
169184

170-
#if WEBP_ENCODER_ABI_VERSION > 0x0202
171185
// Activate the lossless compression mode with the desired efficiency level
172186
// between 0 (fastest, lowest compression) and 9 (slower, best compression).
173187
// A good default level is '6', providing a fair tradeoff between compression
174188
// speed and final compressed size.
175189
// This function will overwrite several fields from config: 'method', 'quality'
176190
// and 'lossless'. Returns false in case of parameter error.
177191
WEBP_EXTERN(int) WebPConfigLosslessPreset(WebPConfig* config, int level);
178-
#endif
179192

180193
// Returns true if 'config' is non-NULL and all configuration parameters are
181194
// within their valid ranges.
@@ -209,8 +222,10 @@ struct WebPAuxStats {
209222
int cache_bits; // number of bits for color cache lookup
210223
int palette_size; // number of color in palette, if used
211224
int lossless_size; // final lossless size
225+
int lossless_hdr_size; // lossless header (transform, huffman etc) size
226+
int lossless_data_size; // lossless image data size
212227

213-
uint32_t pad[4]; // padding for later use
228+
uint32_t pad[2]; // padding for later use
214229
};
215230

216231
// Signature for output function. Should return true if writing was successful.
@@ -231,18 +246,12 @@ struct WebPMemoryWriter {
231246
// The following must be called first before any use.
232247
WEBP_EXTERN(void) WebPMemoryWriterInit(WebPMemoryWriter* writer);
233248

234-
#if WEBP_ENCODER_ABI_VERSION > 0x0203
235249
// The following must be called to deallocate writer->mem memory. The 'writer'
236250
// object itself is not deallocated.
237251
WEBP_EXTERN(void) WebPMemoryWriterClear(WebPMemoryWriter* writer);
238-
#endif
239252
// The custom writer to be used with WebPMemoryWriter as custom_ptr. Upon
240253
// completion, writer.mem and writer.size will hold the coded data.
241-
#if WEBP_ENCODER_ABI_VERSION > 0x0203
242254
// writer.mem must be freed by calling WebPMemoryWriterClear.
243-
#else
244-
// writer.mem must be freed by calling 'free(writer.mem)'.
245-
#endif
246255
WEBP_EXTERN(int) WebPMemoryWrite(const uint8_t* data, size_t data_size,
247256
const WebPPicture* picture);
248257

@@ -379,8 +388,8 @@ WEBP_EXTERN(void) WebPPictureFree(WebPPicture* picture);
379388
// Returns false in case of memory allocation error.
380389
WEBP_EXTERN(int) WebPPictureCopy(const WebPPicture* src, WebPPicture* dst);
381390

382-
// Compute PSNR, SSIM or LSIM distortion metric between two pictures.
383-
// Result is in dB, stores in result[] in the Y/U/V/Alpha/All order.
391+
// Compute PSNR, SSIM or LSIM distortion metric between two pictures. Results
392+
// are in dB, stored in result[] in the Y/U/V/Alpha/All or B/G/R/A/All order.
384393
// Returns false in case of error (src and ref don't have same dimension, ...)
385394
// Warning: this function is rather CPU-intensive.
386395
WEBP_EXTERN(int) WebPPictureDistortion(
@@ -464,14 +473,12 @@ WEBP_EXTERN(int) WebPPictureARGBToYUVA(WebPPicture* picture,
464473
WEBP_EXTERN(int) WebPPictureARGBToYUVADithered(
465474
WebPPicture* picture, WebPEncCSP colorspace, float dithering);
466475

467-
#if WEBP_ENCODER_ABI_VERSION > 0x0204
468476
// Performs 'smart' RGBA->YUVA420 downsampling and colorspace conversion.
469477
// Downsampling is handled with extra care in case of color clipping. This
470478
// method is roughly 2x slower than WebPPictureARGBToYUVA() but produces better
471479
// YUV representation.
472480
// Returns false in case of error.
473481
WEBP_EXTERN(int) WebPPictureSmartARGBToYUVA(WebPPicture* picture);
474-
#endif
475482

476483
// Converts picture->yuv to picture->argb and sets picture->use_argb to true.
477484
// The input format must be YUV_420 or YUV_420A.

webp/include/tizen/types.h

+5-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,11 @@ typedef long long int int64_t;
3939
#ifndef WEBP_EXTERN
4040
// This explicitly marks library functions and allows for changing the
4141
// signature for e.g., Windows DLL builds.
42-
#define WEBP_EXTERN(type) extern type
42+
# if defined(__GNUC__) && __GNUC__ >= 4
43+
# define WEBP_EXTERN(type) extern __attribute__ ((visibility ("default"))) type
44+
# else
45+
# define WEBP_EXTERN(type) extern type
46+
# endif /* __GNUC__ >= 4 */
4347
#endif /* WEBP_EXTERN */
4448

4549
// Macro to check ABI compatibility (same major revision number)

webp/prebuilt/tizen/arm/libwebp.a

54.7 KB
Binary file not shown.

webp/prebuilt/tizen/x86/libwebp.a

132 KB
Binary file not shown.

0 commit comments

Comments
 (0)