update libwebp up to 0.3.0

This commit is contained in:
AoD314
2013-04-02 15:22:10 +04:00
parent db45e04d58
commit 740941c8b8
64 changed files with 5394 additions and 2773 deletions

View File

@@ -7,11 +7,14 @@
//
// Misc. common utility functions
//
// Author: Skal (pascal.massimino@gmail.com)
// Authors: Skal (pascal.massimino@gmail.com)
// Urvang (urvang@google.com)
#ifndef WEBP_UTILS_UTILS_H_
#define WEBP_UTILS_UTILS_H_
#include <assert.h>
#include "../webp/types.h"
#if defined(__cplusplus) || defined(c_plusplus)
@@ -35,6 +38,40 @@ void* WebPSafeMalloc(uint64_t nmemb, size_t size);
// in order to favor the "calloc(num_foo, sizeof(foo))" pattern.
void* WebPSafeCalloc(uint64_t nmemb, size_t size);
//------------------------------------------------------------------------------
// Reading/writing data.
// Read 16, 24 or 32 bits stored in little-endian order.
static WEBP_INLINE int GetLE16(const uint8_t* const data) {
return (int)(data[0] << 0) | (data[1] << 8);
}
static WEBP_INLINE int GetLE24(const uint8_t* const data) {
return GetLE16(data) | (data[2] << 16);
}
static WEBP_INLINE uint32_t GetLE32(const uint8_t* const data) {
return (uint32_t)GetLE16(data) | (GetLE16(data + 2) << 16);
}
// Store 16, 24 or 32 bits in little-endian order.
static WEBP_INLINE void PutLE16(uint8_t* const data, int val) {
assert(val < (1 << 16));
data[0] = (val >> 0);
data[1] = (val >> 8);
}
static WEBP_INLINE void PutLE24(uint8_t* const data, int val) {
assert(val < (1 << 24));
PutLE16(data, val & 0xffff);
data[2] = (val >> 16);
}
static WEBP_INLINE void PutLE32(uint8_t* const data, uint32_t val) {
PutLE16(data, (int)(val & 0xffff));
PutLE16(data + 2, (int)(val >> 16));
}
//------------------------------------------------------------------------------
#if defined(__cplusplus) || defined(c_plusplus)