Skip to content

Commit

Permalink
updated to the latest libwebp library (v1.2.x HEAD commit 05b72d4)
Browse files Browse the repository at this point in the history
https://chromium.googlesource.com/webm/libwebp

latest include files from src\webp
latest built static libraries using the build instructions in the x86 and x64 toolset
nmake /f Makefile.vc CFG=release-static RTLIBCFG=static OBJDIR=output
  • Loading branch information
sylikc committed May 12, 2021
1 parent 1086e9d commit 60d4f83
Show file tree
Hide file tree
Showing 8 changed files with 787 additions and 355 deletions.
167 changes: 90 additions & 77 deletions WEBP/include/webp/decode.h

Large diffs are not rendered by default.

295 changes: 222 additions & 73 deletions WEBP/include/webp/demux.h

Large diffs are not rendered by default.

243 changes: 155 additions & 88 deletions WEBP/include/webp/encode.h

Large diffs are not rendered by default.

375 changes: 274 additions & 101 deletions WEBP/include/webp/mux.h

Large diffs are not rendered by default.

29 changes: 19 additions & 10 deletions WEBP/include/webp/mux_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,29 @@
#ifndef WEBP_WEBP_MUX_TYPES_H_
#define WEBP_WEBP_MUX_TYPES_H_

#include <stdlib.h> // free()
#include <string.h> // memset()
#include "./types.h"

#if defined(__cplusplus) || defined(c_plusplus)
#ifdef __cplusplus
extern "C" {
#endif

// Note: forward declaring enumerations is not allowed in (strict) C and C++,
// the types are left here for reference.
// typedef enum WebPFeatureFlags WebPFeatureFlags;
// typedef enum WebPMuxAnimDispose WebPMuxAnimDispose;
// typedef enum WebPMuxAnimBlend WebPMuxAnimBlend;
typedef struct WebPData WebPData;

// VP8X Feature Flags.
typedef enum WebPFeatureFlags {
FRAGMENTS_FLAG = 0x00000001,
ANIMATION_FLAG = 0x00000002,
XMP_FLAG = 0x00000004,
EXIF_FLAG = 0x00000008,
ALPHA_FLAG = 0x00000010,
ICCP_FLAG = 0x00000020
ICCP_FLAG = 0x00000020,

ALL_VALID_FLAGS = 0x0000003e
} WebPFeatureFlags;

// Dispose method (animation only). Indicates how the area used by the current
Expand All @@ -45,8 +46,16 @@ typedef enum WebPMuxAnimDispose {
WEBP_MUX_DISPOSE_BACKGROUND // Dispose to background color.
} WebPMuxAnimDispose;

// Blend operation (animation only). Indicates how transparent pixels of the
// current frame are blended with those of the previous canvas.
typedef enum WebPMuxAnimBlend {
WEBP_MUX_BLEND, // Blend.
WEBP_MUX_NO_BLEND // Do not blend.
} WebPMuxAnimBlend;

// Data type used to describe 'raw' data, e.g., chunk data
// (ICC profile, metadata) and WebP compressed image data.
// 'bytes' memory must be allocated using WebPMalloc() and such.
struct WebPData {
const uint8_t* bytes;
size_t size;
Expand All @@ -59,11 +68,11 @@ static WEBP_INLINE void WebPDataInit(WebPData* webp_data) {
}
}

// Clears the contents of the 'webp_data' object by calling free(). Does not
// deallocate the object itself.
// Clears the contents of the 'webp_data' object by calling WebPFree().
// Does not deallocate the object itself.
static WEBP_INLINE void WebPDataClear(WebPData* webp_data) {
if (webp_data != NULL) {
free((void*)webp_data->bytes);
WebPFree((void*)webp_data->bytes);
WebPDataInit(webp_data);
}
}
Expand All @@ -74,16 +83,16 @@ static WEBP_INLINE int WebPDataCopy(const WebPData* src, WebPData* dst) {
if (src == NULL || dst == NULL) return 0;
WebPDataInit(dst);
if (src->bytes != NULL && src->size != 0) {
dst->bytes = (uint8_t*)malloc(src->size);
dst->bytes = (uint8_t*)WebPMalloc(src->size);
if (dst->bytes == NULL) return 0;
memcpy((void*)dst->bytes, src->bytes, src->size);
dst->size = src->size;
}
return 1;
}

#if defined(__cplusplus) || defined(c_plusplus)
#ifdef __cplusplus
} // extern "C"
#endif

#endif /* WEBP_WEBP_MUX_TYPES_H_ */
#endif // WEBP_WEBP_MUX_TYPES_H_
33 changes: 27 additions & 6 deletions WEBP/include/webp/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// be found in the AUTHORS file in the root of the source tree.
// -----------------------------------------------------------------------------
//
// Common types
// Common types + memory wrappers
//
// Author: Skal ([email protected])

Expand All @@ -18,10 +18,11 @@

#ifndef _MSC_VER
#include <inttypes.h>
#ifdef __STRICT_ANSI__
#define WEBP_INLINE
#else /* __STRICT_ANSI__ */
#if defined(__cplusplus) || !defined(__STRICT_ANSI__) || \
(defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L)
#define WEBP_INLINE inline
#else
#define WEBP_INLINE
#endif
#else
typedef signed char int8_t;
Expand All @@ -38,10 +39,30 @@ typedef long long int int64_t;
#ifndef WEBP_EXTERN
// This explicitly marks library functions and allows for changing the
// signature for e.g., Windows DLL builds.
#define WEBP_EXTERN(type) extern type
# if defined(__GNUC__) && __GNUC__ >= 4
# define WEBP_EXTERN extern __attribute__ ((visibility ("default")))
# else
# define WEBP_EXTERN extern
# endif /* __GNUC__ >= 4 */
#endif /* WEBP_EXTERN */

// Macro to check ABI compatibility (same major revision number)
#define WEBP_ABI_IS_INCOMPATIBLE(a, b) (((a) >> 8) != ((b) >> 8))

#endif /* WEBP_WEBP_TYPES_H_ */
#ifdef __cplusplus
extern "C" {
#endif

// Allocates 'size' bytes of memory. Returns NULL upon error. Memory
// must be deallocated by calling WebPFree(). This function is made available
// by the core 'libwebp' library.
WEBP_EXTERN void* WebPMalloc(size_t size);

// Releases memory returned by the WebPDecode*() functions (from decode.h).
WEBP_EXTERN void WebPFree(void* ptr);

#ifdef __cplusplus
} // extern "C"
#endif

#endif // WEBP_WEBP_TYPES_H_
Binary file modified WEBP/lib/libwebp.lib
Binary file not shown.
Binary file modified WEBP/lib/libwebp64.lib
Binary file not shown.

0 comments on commit 60d4f83

Please sign in to comment.