Updating SDL_image for OS X
This commit is contained in:
@@ -0,0 +1 @@
|
||||
Versions/Current/Frameworks
|
||||
+1
@@ -0,0 +1 @@
|
||||
Versions/Current/Headers
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
The source code to this library used with SDL_image can be found here:
|
||||
http://www.libsdl.org/projects/SDL_image/libs/
|
||||
---
|
||||
|
||||
Copyright (c) 2010, Google Inc. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in
|
||||
the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
|
||||
* Neither the name of Google nor the names of its contributors may
|
||||
be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
+1
@@ -0,0 +1 @@
|
||||
Versions/Current/Resources
|
||||
+396
@@ -0,0 +1,396 @@
|
||||
// Copyright 2010 Google Inc.
|
||||
//
|
||||
// This code is licensed under the same terms as WebM:
|
||||
// Software License Agreement: http://www.webmproject.org/license/software/
|
||||
// Additional IP Rights Grant: http://www.webmproject.org/license/additional/
|
||||
// -----------------------------------------------------------------------------
|
||||
//
|
||||
// Main decoding functions for WEBP images.
|
||||
//
|
||||
// Author: Skal ([email protected])
|
||||
|
||||
#ifndef WEBP_WEBP_DECODE_H_
|
||||
#define WEBP_WEBP_DECODE_H_
|
||||
|
||||
#include "./types.h"
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define WEBP_DECODER_ABI_VERSION 0x0002
|
||||
|
||||
// Return the decoder's version number, packed in hexadecimal using 8bits for
|
||||
// each of major/minor/revision. E.g: v2.5.7 is 0x020507.
|
||||
WEBP_EXTERN(int) WebPGetDecoderVersion(void);
|
||||
|
||||
// Retrieve basic header information: width, height.
|
||||
// This function will also validate the header and return 0 in
|
||||
// case of formatting error.
|
||||
// Pointers *width/*height can be passed NULL if deemed irrelevant.
|
||||
WEBP_EXTERN(int) WebPGetInfo(const uint8_t* data, uint32_t data_size,
|
||||
int* width, int* height);
|
||||
|
||||
// Decodes WEBP images pointed to by *data and returns RGB samples, along
|
||||
// with the dimensions in *width and *height.
|
||||
// The returned pointer should be deleted calling free().
|
||||
// Returns NULL in case of error.
|
||||
WEBP_EXTERN(uint8_t*) WebPDecodeRGB(const uint8_t* data, uint32_t data_size,
|
||||
int* width, int* height);
|
||||
|
||||
// Same as WebPDecodeRGB, but returning RGBA data.
|
||||
WEBP_EXTERN(uint8_t*) WebPDecodeRGBA(const uint8_t* data, uint32_t data_size,
|
||||
int* width, int* height);
|
||||
|
||||
// Same as WebPDecodeRGBA, but returning ARGB data.
|
||||
WEBP_EXTERN(uint8_t*) WebPDecodeARGB(const uint8_t* data, uint32_t data_size,
|
||||
int* width, int* height);
|
||||
|
||||
// This variant decode to BGR instead of RGB.
|
||||
WEBP_EXTERN(uint8_t*) WebPDecodeBGR(const uint8_t* data, uint32_t data_size,
|
||||
int* width, int* height);
|
||||
// This variant decodes to BGRA instead of RGBA.
|
||||
WEBP_EXTERN(uint8_t*) WebPDecodeBGRA(const uint8_t* data, uint32_t data_size,
|
||||
int* width, int* height);
|
||||
|
||||
// Decode WEBP images stored in *data in Y'UV format(*). The pointer returned is
|
||||
// the Y samples buffer. Upon return, *u and *v will point to the U and V
|
||||
// chroma data. These U and V buffers need NOT be free()'d, unlike the returned
|
||||
// Y luma one. The dimension of the U and V planes are both (*width + 1) / 2
|
||||
// and (*height + 1)/ 2.
|
||||
// Upon return, the Y buffer has a stride returned as '*stride', while U and V
|
||||
// have a common stride returned as '*uv_stride'.
|
||||
// Return NULL in case of error.
|
||||
// (*) Also named Y'CbCr. See: http://en.wikipedia.org/wiki/YCbCr
|
||||
WEBP_EXTERN(uint8_t*) WebPDecodeYUV(const uint8_t* data, uint32_t data_size,
|
||||
int* width, int* height,
|
||||
uint8_t** u, uint8_t** v,
|
||||
int* stride, int* uv_stride);
|
||||
|
||||
// These five functions are variants of the above ones, that decode the image
|
||||
// directly into a pre-allocated buffer 'output_buffer'. The maximum storage
|
||||
// available in this buffer is indicated by 'output_buffer_size'. If this
|
||||
// storage is not sufficient (or an error occurred), NULL is returned.
|
||||
// Otherwise, output_buffer is returned, for convenience.
|
||||
// The parameter 'output_stride' specifies the distance (in bytes)
|
||||
// between scanlines. Hence, output_buffer_size is expected to be at least
|
||||
// output_stride x picture-height.
|
||||
WEBP_EXTERN(uint8_t*) WebPDecodeRGBInto(
|
||||
const uint8_t* data, uint32_t data_size,
|
||||
uint8_t* output_buffer, int output_buffer_size, int output_stride);
|
||||
WEBP_EXTERN(uint8_t*) WebPDecodeRGBAInto(
|
||||
const uint8_t* data, uint32_t data_size,
|
||||
uint8_t* output_buffer, int output_buffer_size, int output_stride);
|
||||
WEBP_EXTERN(uint8_t*) WebPDecodeARGBInto(
|
||||
const uint8_t* data, uint32_t data_size,
|
||||
uint8_t* output_buffer, int output_buffer_size, int output_stride);
|
||||
// BGR variants
|
||||
WEBP_EXTERN(uint8_t*) WebPDecodeBGRInto(
|
||||
const uint8_t* data, uint32_t data_size,
|
||||
uint8_t* output_buffer, int output_buffer_size, int output_stride);
|
||||
WEBP_EXTERN(uint8_t*) WebPDecodeBGRAInto(
|
||||
const uint8_t* data, uint32_t data_size,
|
||||
uint8_t* output_buffer, int output_buffer_size, int output_stride);
|
||||
|
||||
// WebPDecodeYUVInto() is a variant of WebPDecodeYUV() that operates directly
|
||||
// into pre-allocated luma/chroma plane buffers. This function requires the
|
||||
// strides to be passed: one for the luma plane and one for each of the
|
||||
// chroma ones. The size of each plane buffer is passed as 'luma_size',
|
||||
// 'u_size' and 'v_size' respectively.
|
||||
// Pointer to the luma plane ('*luma') is returned or NULL if an error occurred
|
||||
// during decoding (or because some buffers were found to be too small).
|
||||
WEBP_EXTERN(uint8_t*) WebPDecodeYUVInto(
|
||||
const uint8_t* data, uint32_t data_size,
|
||||
uint8_t* luma, int luma_size, int luma_stride,
|
||||
uint8_t* u, int u_size, int u_stride,
|
||||
uint8_t* v, int v_size, int v_stride);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Output colorspaces and buffer
|
||||
|
||||
// Colorspaces
|
||||
typedef enum { MODE_RGB = 0, MODE_RGBA = 1,
|
||||
MODE_BGR = 2, MODE_BGRA = 3,
|
||||
MODE_ARGB = 4, MODE_RGBA_4444 = 5,
|
||||
MODE_RGB_565 = 6,
|
||||
// YUV modes must come after RGB ones.
|
||||
MODE_YUV = 7, MODE_YUVA = 8, // yuv 4:2:0
|
||||
MODE_LAST = 9
|
||||
} WEBP_CSP_MODE;
|
||||
|
||||
// Generic structure for describing the sample buffer.
|
||||
typedef struct { // view as RGBA
|
||||
uint8_t* rgba; // pointer to RGBA samples
|
||||
int stride; // stride in bytes from one scanline to the next.
|
||||
int size; // total size of the *rgba buffer.
|
||||
} WebPRGBABuffer;
|
||||
|
||||
typedef struct { // view as YUVA
|
||||
uint8_t* y, *u, *v, *a; // pointer to luma, chroma U/V, alpha samples
|
||||
int y_stride; // luma stride
|
||||
int u_stride, v_stride; // chroma strides
|
||||
int a_stride; // alpha stride
|
||||
int y_size; // luma plane size
|
||||
int u_size, v_size; // chroma planes size
|
||||
int a_size; // alpha-plane size
|
||||
} WebPYUVABuffer;
|
||||
|
||||
// Output buffer
|
||||
typedef struct {
|
||||
WEBP_CSP_MODE colorspace; // Colorspace.
|
||||
int width, height; // Dimensions.
|
||||
int is_external_memory; // If true, 'internal_memory' pointer is not used.
|
||||
union {
|
||||
WebPRGBABuffer RGBA;
|
||||
WebPYUVABuffer YUVA;
|
||||
} u; // Nameless union of buffer parameters.
|
||||
uint8_t* private_memory; // Internally allocated memory (only when
|
||||
// is_external_memory is false). Should not be used
|
||||
// externally, but accessed via the buffer union.
|
||||
} WebPDecBuffer;
|
||||
|
||||
// Internal, version-checked, entry point
|
||||
WEBP_EXTERN(int) WebPInitDecBufferInternal(WebPDecBuffer* const, int);
|
||||
|
||||
// Initialize the structure as empty. Must be called before any other use.
|
||||
// Returns false in case of version mismatch
|
||||
static WEBP_INLINE int WebPInitDecBuffer(WebPDecBuffer* const buffer) {
|
||||
return WebPInitDecBufferInternal(buffer, WEBP_DECODER_ABI_VERSION);
|
||||
}
|
||||
|
||||
// Free any memory associated with the buffer. Must always be called last.
|
||||
// Note: doesn't free the 'buffer' structure itself.
|
||||
WEBP_EXTERN(void) WebPFreeDecBuffer(WebPDecBuffer* const buffer);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Enumeration of the status codes
|
||||
|
||||
typedef enum {
|
||||
VP8_STATUS_OK = 0,
|
||||
VP8_STATUS_OUT_OF_MEMORY,
|
||||
VP8_STATUS_INVALID_PARAM,
|
||||
VP8_STATUS_BITSTREAM_ERROR,
|
||||
VP8_STATUS_UNSUPPORTED_FEATURE,
|
||||
VP8_STATUS_SUSPENDED,
|
||||
VP8_STATUS_USER_ABORT,
|
||||
VP8_STATUS_NOT_ENOUGH_DATA
|
||||
} VP8StatusCode;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Incremental decoding
|
||||
//
|
||||
// This API allows streamlined decoding of partial data.
|
||||
// Picture can be incrementally decoded as data become available thanks to the
|
||||
// WebPIDecoder object. This object can be left in a SUSPENDED state if the
|
||||
// picture is only partially decoded, pending additional input.
|
||||
// Code example:
|
||||
//
|
||||
// WebPIDecoder* const idec = WebPINew(mode);
|
||||
// while (has_more_data) {
|
||||
// // ... (get additional data)
|
||||
// status = WebPIAppend(idec, new_data, new_data_size);
|
||||
// if (status != VP8_STATUS_SUSPENDED ||
|
||||
// break;
|
||||
// }
|
||||
//
|
||||
// // The above call decodes the current available buffer.
|
||||
// // Part of the image can now be refreshed by calling to
|
||||
// // WebPIDecGetRGB()/WebPIDecGetYUV() etc.
|
||||
// }
|
||||
// WebPIDelete(idec);
|
||||
|
||||
typedef struct WebPIDecoder WebPIDecoder;
|
||||
|
||||
// Creates a new incremental decoder with the supplied buffer parameter.
|
||||
// This output_buffer can be passed NULL, in which case a default output buffer
|
||||
// is used (with MODE_RGB). Otherwise, an internal reference to 'output_buffer'
|
||||
// is kept, which means that the lifespan of 'output_buffer' must be larger than
|
||||
// that of the returned WebPIDecoder object.
|
||||
// Returns NULL if the allocation failed.
|
||||
WEBP_EXTERN(WebPIDecoder*) WebPINewDecoder(WebPDecBuffer* const output_buffer);
|
||||
|
||||
// Creates a WebPIDecoder object. Returns NULL in case of failure.
|
||||
// TODO(skal): DEPRECATED. Prefer using WebPINewDecoder().
|
||||
WEBP_EXTERN(WebPIDecoder*) WebPINew(WEBP_CSP_MODE mode);
|
||||
|
||||
// This function allocates and initializes an incremental-decoder object, which
|
||||
// will output the r/g/b(/a) samples specified by 'mode' into a preallocated
|
||||
// buffer 'output_buffer'. The size of this buffer is at least
|
||||
// 'output_buffer_size' and the stride (distance in bytes between two scanlines)
|
||||
// is specified by 'output_stride'. Returns NULL if the allocation failed.
|
||||
WEBP_EXTERN(WebPIDecoder*) WebPINewRGB(
|
||||
WEBP_CSP_MODE mode,
|
||||
uint8_t* output_buffer, int output_buffer_size, int output_stride);
|
||||
|
||||
// This function allocates and initializes an incremental-decoder object, which
|
||||
// will output the raw luma/chroma samples into a preallocated planes. The luma
|
||||
// plane is specified by its pointer 'luma', its size 'luma_size' and its stride
|
||||
// 'luma_stride'. Similarly, the chroma-u plane is specified by the 'u',
|
||||
// 'u_size' and 'u_stride' parameters, and the chroma-v plane by 'v', 'v_size'
|
||||
// and 'v_size'.
|
||||
// Returns NULL if the allocation failed.
|
||||
WEBP_EXTERN(WebPIDecoder*) WebPINewYUV(
|
||||
uint8_t* luma, int luma_size, int luma_stride,
|
||||
uint8_t* u, int u_size, int u_stride,
|
||||
uint8_t* v, int v_size, int v_stride);
|
||||
|
||||
// Deletes the WebPIDecoder object and associated memory. Must always be called
|
||||
// if WebPINew, WebPINewRGB or WebPINewYUV succeeded.
|
||||
WEBP_EXTERN(void) WebPIDelete(WebPIDecoder* const idec);
|
||||
|
||||
// Copies and decodes the next available data. Returns VP8_STATUS_OK when
|
||||
// the image is successfully decoded. Returns VP8_STATUS_SUSPENDED when more
|
||||
// data is expected. Returns error in other cases.
|
||||
WEBP_EXTERN(VP8StatusCode) WebPIAppend(
|
||||
WebPIDecoder* const idec, const uint8_t* data, uint32_t data_size);
|
||||
|
||||
// A variant of the above function to be used when data buffer contains
|
||||
// partial data from the beginning. In this case data buffer is not copied
|
||||
// to the internal memory.
|
||||
// Note that the value of the 'data' pointer can change between calls to
|
||||
// WebPIUpdate, for instance when the data buffer is resized to fit larger data.
|
||||
WEBP_EXTERN(VP8StatusCode) WebPIUpdate(
|
||||
WebPIDecoder* const idec, const uint8_t* data, uint32_t data_size);
|
||||
|
||||
// Returns the r/g/b/(a) image decoded so far. Returns NULL if output params
|
||||
// are not initialized yet. The r/g/b/(a) output type corresponds to the mode
|
||||
// specified in WebPINew()/WebPINewRGB(). *last_y is the index of last decoded
|
||||
// row in raster scan order. Some pointers (*last_y, *width etc.) can be NULL if
|
||||
// corresponding information is not needed.
|
||||
WEBP_EXTERN(uint8_t*) WebPIDecGetRGB(
|
||||
const WebPIDecoder* const idec, int* last_y,
|
||||
int* width, int* height, int* stride);
|
||||
|
||||
// Same as above function to get YUV image. Returns pointer to the luma plane
|
||||
// or NULL in case of error.
|
||||
WEBP_EXTERN(uint8_t*) WebPIDecGetYUV(
|
||||
const WebPIDecoder* const idec, int* last_y,
|
||||
uint8_t** u, uint8_t** v,
|
||||
int* width, int* height, int* stride, int* uv_stride);
|
||||
|
||||
// Generic call to retrieve information about the displayable area.
|
||||
// If non NULL, the left/right/width/height pointers are filled with the visible
|
||||
// rectangular area so far.
|
||||
// Returns NULL in case the incremental decoder object is in an invalid state.
|
||||
// Otherwise returns the pointer to the internal representation. This structure
|
||||
// is read-only, tied to WebPIDecoder's lifespan and should not be modified.
|
||||
WEBP_EXTERN(const WebPDecBuffer*) WebPIDecodedArea(
|
||||
const WebPIDecoder* const idec,
|
||||
int* const left, int* const top,
|
||||
int* const width, int* const height);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Advanced decoding parametrization
|
||||
//
|
||||
// Code sample for using the advanced decoding API
|
||||
/*
|
||||
// A) Init a configuration object
|
||||
WebPDecoderConfig config;
|
||||
CHECK(WebPInitDecoderConfig(&config));
|
||||
|
||||
// B) optional: retrieve the bitstream's features.
|
||||
CHECK(WebPGetFeatures(data, data_size, &config.input) == VP8_STATUS_OK);
|
||||
|
||||
// C) Adjust 'config', if needed
|
||||
config.no_fancy = 1;
|
||||
config.output.colorspace = MODE_BGRA;
|
||||
// etc.
|
||||
|
||||
// Note that you can also make config.output point to an externally
|
||||
// supplied memory buffer, provided it's big enough to store the decoded
|
||||
// picture. Otherwise, config.output will just be used to allocate memory
|
||||
// and store the decoded picture.
|
||||
|
||||
// D) Decode!
|
||||
CHECK(WebPDecode(data, data_size, &config) == VP8_STATUS_OK);
|
||||
|
||||
// E) Decoded image is now in config.output (and config.output.u.RGBA)
|
||||
|
||||
// F) Reclaim memory allocated in config's object. It's safe to call
|
||||
// this function even if the memory is external and wasn't allocated
|
||||
// by WebPDecode().
|
||||
WebPFreeDecBuffer(&config.output);
|
||||
*/
|
||||
|
||||
// Features gathered from the bitstream
|
||||
typedef struct {
|
||||
int width; // the original width, as read from the bitstream
|
||||
int height; // the original height, as read from the bitstream
|
||||
int has_alpha; // true if bitstream contains an alpha channel
|
||||
int no_incremental_decoding; // if true, using incremental decoding is not
|
||||
// recommended.
|
||||
int rotate; // TODO(later)
|
||||
int uv_sampling; // should be 0 for now. TODO(later)
|
||||
int bitstream_version; // should be 0 for now. TODO(later)
|
||||
} WebPBitstreamFeatures;
|
||||
|
||||
// Internal, version-checked, entry point
|
||||
WEBP_EXTERN(VP8StatusCode) WebPGetFeaturesInternal(
|
||||
const uint8_t*, uint32_t, WebPBitstreamFeatures* const, int);
|
||||
|
||||
// Retrieve features from the bitstream. The *features structure is filled
|
||||
// with information gathered from the bitstream.
|
||||
// Returns false in case of error or version mismatch.
|
||||
// In case of error, features->bitstream_status will reflect the error code.
|
||||
static WEBP_INLINE VP8StatusCode WebPGetFeatures(
|
||||
const uint8_t* data, uint32_t data_size,
|
||||
WebPBitstreamFeatures* const features) {
|
||||
return WebPGetFeaturesInternal(data, data_size, features,
|
||||
WEBP_DECODER_ABI_VERSION);
|
||||
}
|
||||
|
||||
// Decoding options
|
||||
typedef struct {
|
||||
int bypass_filtering; // if true, skip the in-loop filtering
|
||||
int no_fancy_upsampling; // if true, use faster pointwise upsampler
|
||||
int use_cropping; // if true, cropping is applied _first_
|
||||
int crop_left, crop_top; // top-left position for cropping.
|
||||
// Will be snapped to even values.
|
||||
int crop_width, crop_height; // dimension of the cropping area
|
||||
int use_scaling; // if true, scaling is applied _afterward_
|
||||
int scaled_width, scaled_height; // final resolution
|
||||
int force_rotation; // forced rotation (to be applied _last_)
|
||||
int no_enhancement; // if true, discard enhancement layer
|
||||
int use_threads; // if true, use multi-threaded decoding
|
||||
} WebPDecoderOptions;
|
||||
|
||||
// Main object storing the configuration for advanced decoding.
|
||||
typedef struct {
|
||||
WebPBitstreamFeatures input; // Immutable bitstream features (optional)
|
||||
WebPDecBuffer output; // Output buffer (can point to external mem)
|
||||
WebPDecoderOptions options; // Decoding options
|
||||
} WebPDecoderConfig;
|
||||
|
||||
// Internal, version-checked, entry point
|
||||
WEBP_EXTERN(int) WebPInitDecoderConfigInternal(WebPDecoderConfig* const, int);
|
||||
|
||||
// Initialize the configuration as empty. This function must always be
|
||||
// called first, unless WebPGetFeatures() is to be called.
|
||||
// Returns false in case of mismatched version.
|
||||
static WEBP_INLINE int WebPInitDecoderConfig(WebPDecoderConfig* const config) {
|
||||
return WebPInitDecoderConfigInternal(config, WEBP_DECODER_ABI_VERSION);
|
||||
}
|
||||
|
||||
// Instantiate a new incremental decoder object with requested configuration.
|
||||
// The bitstream can be passed using *data and data_size parameter,
|
||||
// in which case the features will be parsed and stored into config->input.
|
||||
// Otherwise, 'data' can be NULL and now parsing will occur.
|
||||
// Note that 'config' can be NULL too, in which case a default configuration is
|
||||
// used.
|
||||
// The return WebPIDecoder object must always be deleted calling WebPIDelete().
|
||||
// Returns NULL in case of error (and config->status will then reflect
|
||||
// the error condition).
|
||||
WEBP_EXTERN(WebPIDecoder*) WebPIDecode(const uint8_t* data, uint32_t data_size,
|
||||
WebPDecoderConfig* const config);
|
||||
|
||||
// Non-incremental version. This version decodes the full data at once, taking
|
||||
// 'config' into account. Return decoding status (VP8_STATUS_OK if decoding
|
||||
// was successful).
|
||||
WEBP_EXTERN(VP8StatusCode) WebPDecode(const uint8_t* data, uint32_t data_size,
|
||||
WebPDecoderConfig* const config);
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif /* WEBP_WEBP_DECODE_H_ */
|
||||
+157
@@ -0,0 +1,157 @@
|
||||
// Copyright 2010 Google Inc.
|
||||
//
|
||||
// This code is licensed under the same terms as WebM:
|
||||
// Software License Agreement: http://www.webmproject.org/license/software/
|
||||
// Additional IP Rights Grant: http://www.webmproject.org/license/additional/
|
||||
// -----------------------------------------------------------------------------
|
||||
//
|
||||
// Low-level API for VP8 decoder
|
||||
//
|
||||
// Author: Skal ([email protected])
|
||||
|
||||
#ifndef WEBP_WEBP_DECODE_VP8_H_
|
||||
#define WEBP_WEBP_DECODE_VP8_H_
|
||||
|
||||
#include "./decode.h"
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Lower-level API
|
||||
//
|
||||
// These functions provide fine-grained control of the decoding process.
|
||||
// The call flow should resemble:
|
||||
//
|
||||
// VP8Io io;
|
||||
// VP8InitIo(&io);
|
||||
// io.data = data;
|
||||
// io.data_size = size;
|
||||
// /* customize io's functions (setup()/put()/teardown()) if needed. */
|
||||
//
|
||||
// VP8Decoder* dec = VP8New();
|
||||
// bool ok = VP8Decode(dec);
|
||||
// if (!ok) printf("Error: %s\n", VP8StatusMessage(dec));
|
||||
// VP8Delete(dec);
|
||||
// return ok;
|
||||
|
||||
// Input / Output
|
||||
typedef struct VP8Io VP8Io;
|
||||
typedef int (*VP8IoPutHook)(const VP8Io* io);
|
||||
typedef int (*VP8IoSetupHook)(VP8Io* io);
|
||||
typedef void (*VP8IoTeardownHook)(const VP8Io* io);
|
||||
|
||||
struct VP8Io {
|
||||
// set by VP8GetHeaders()
|
||||
int width, height; // picture dimensions, in pixels (invariable).
|
||||
// These are the original, uncropped dimensions.
|
||||
// The actual area passed to put() is stored
|
||||
// in mb_w / mb_h fields.
|
||||
|
||||
// set before calling put()
|
||||
int mb_y; // position of the current rows (in pixels)
|
||||
int mb_w; // number of columns in the sample
|
||||
int mb_h; // number of rows in the sample
|
||||
const uint8_t* y, *u, *v; // rows to copy (in yuv420 format)
|
||||
int y_stride; // row stride for luma
|
||||
int uv_stride; // row stride for chroma
|
||||
|
||||
void* opaque; // user data
|
||||
|
||||
// called when fresh samples are available. Currently, samples are in
|
||||
// YUV420 format, and can be up to width x 24 in size (depending on the
|
||||
// in-loop filtering level, e.g.). Should return false in case of error
|
||||
// or abort request. The actual size of the area to update is mb_w x mb_h
|
||||
// in size, taking cropping into account.
|
||||
VP8IoPutHook put;
|
||||
|
||||
// called just before starting to decode the blocks.
|
||||
// Must return false in case of setup error, true otherwise. If false is
|
||||
// returned, teardown() will NOT be called. But if the setup succeeded
|
||||
// and true is returned, then teardown() will always be called afterward.
|
||||
VP8IoSetupHook setup;
|
||||
|
||||
// Called just after block decoding is finished (or when an error occurred
|
||||
// during put()). Is NOT called if setup() failed.
|
||||
VP8IoTeardownHook teardown;
|
||||
|
||||
// this is a recommendation for the user-side yuv->rgb converter. This flag
|
||||
// is set when calling setup() hook and can be overwritten by it. It then
|
||||
// can be taken into consideration during the put() method.
|
||||
int fancy_upsampling;
|
||||
|
||||
// Input buffer.
|
||||
uint32_t data_size;
|
||||
const uint8_t* data;
|
||||
|
||||
// If true, in-loop filtering will not be performed even if present in the
|
||||
// bitstream. Switching off filtering may speed up decoding at the expense
|
||||
// of more visible blocking. Note that output will also be non-compliant
|
||||
// with the VP8 specifications.
|
||||
int bypass_filtering;
|
||||
|
||||
// Cropping parameters.
|
||||
int use_cropping;
|
||||
int crop_left, crop_right, crop_top, crop_bottom;
|
||||
|
||||
// Scaling parameters.
|
||||
int use_scaling;
|
||||
int scaled_width, scaled_height;
|
||||
|
||||
// pointer to the alpha data (if present) corresponding to the rows
|
||||
const uint8_t* a;
|
||||
};
|
||||
|
||||
// Internal, version-checked, entry point
|
||||
WEBP_EXTERN(int) VP8InitIoInternal(VP8Io* const, int);
|
||||
|
||||
// Set the custom IO function pointers and user-data. The setter for IO hooks
|
||||
// should be called before initiating incremental decoding. Returns true if
|
||||
// WebPIDecoder object is successfully modified, false otherwise.
|
||||
WEBP_EXTERN(int) WebPISetIOHooks(WebPIDecoder* const idec,
|
||||
VP8IoPutHook put,
|
||||
VP8IoSetupHook setup,
|
||||
VP8IoTeardownHook teardown,
|
||||
void* user_data);
|
||||
|
||||
// Main decoding object. This is an opaque structure.
|
||||
typedef struct VP8Decoder VP8Decoder;
|
||||
|
||||
// Create a new decoder object.
|
||||
WEBP_EXTERN(VP8Decoder*) VP8New(void);
|
||||
|
||||
// Must be called to make sure 'io' is initialized properly.
|
||||
// Returns false in case of version mismatch. Upon such failure, no other
|
||||
// decoding function should be called (VP8Decode, VP8GetHeaders, ...)
|
||||
static WEBP_INLINE int VP8InitIo(VP8Io* const io) {
|
||||
return VP8InitIoInternal(io, WEBP_DECODER_ABI_VERSION);
|
||||
}
|
||||
|
||||
// Start decoding a new picture. Returns true if ok.
|
||||
WEBP_EXTERN(int) VP8GetHeaders(VP8Decoder* const dec, VP8Io* const io);
|
||||
|
||||
// Decode a picture. Will call VP8GetHeaders() if it wasn't done already.
|
||||
// Returns false in case of error.
|
||||
WEBP_EXTERN(int) VP8Decode(VP8Decoder* const dec, VP8Io* const io);
|
||||
|
||||
// Return current status of the decoder:
|
||||
WEBP_EXTERN(VP8StatusCode) VP8Status(VP8Decoder* const dec);
|
||||
|
||||
// return readable string corresponding to the last status.
|
||||
WEBP_EXTERN(const char*) VP8StatusMessage(VP8Decoder* const dec);
|
||||
|
||||
// Resets the decoder in its initial state, reclaiming memory.
|
||||
// Not a mandatory call between calls to VP8Decode().
|
||||
WEBP_EXTERN(void) VP8Clear(VP8Decoder* const dec);
|
||||
|
||||
// Destroy the decoder object.
|
||||
WEBP_EXTERN(void) VP8Delete(VP8Decoder* const dec);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif /* WEBP_WEBP_DECODE_VP8_H_ */
|
||||
+294
@@ -0,0 +1,294 @@
|
||||
// Copyright 2011 Google Inc.
|
||||
//
|
||||
// This code is licensed under the same terms as WebM:
|
||||
// Software License Agreement: http://www.webmproject.org/license/software/
|
||||
// Additional IP Rights Grant: http://www.webmproject.org/license/additional/
|
||||
// -----------------------------------------------------------------------------
|
||||
//
|
||||
// WebP encoder: main interface
|
||||
//
|
||||
// Author: Skal ([email protected])
|
||||
|
||||
#ifndef WEBP_WEBP_ENCODE_H_
|
||||
#define WEBP_WEBP_ENCODE_H_
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "./types.h"
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define WEBP_ENCODER_ABI_VERSION 0x0003
|
||||
|
||||
// Return the encoder's version number, packed in hexadecimal using 8bits for
|
||||
// each of major/minor/revision. E.g: v2.5.7 is 0x020507.
|
||||
WEBP_EXTERN(int) WebPGetEncoderVersion(void);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// One-stop-shop call! No questions asked:
|
||||
|
||||
// Returns the size of the compressed data (pointed to by *output), or 0 if
|
||||
// an error occurred. The compressed data must be released by the caller
|
||||
// using the call 'free(*output)'.
|
||||
WEBP_EXTERN(size_t) WebPEncodeRGB(const uint8_t* rgb,
|
||||
int width, int height, int stride,
|
||||
float quality_factor, uint8_t** output);
|
||||
WEBP_EXTERN(size_t) WebPEncodeBGR(const uint8_t* bgr,
|
||||
int width, int height, int stride,
|
||||
float quality_factor, uint8_t** output);
|
||||
WEBP_EXTERN(size_t) WebPEncodeRGBA(const uint8_t* rgba,
|
||||
int width, int height, int stride,
|
||||
float quality_factor, uint8_t** output);
|
||||
WEBP_EXTERN(size_t) WebPEncodeBGRA(const uint8_t* bgra,
|
||||
int width, int height, int stride,
|
||||
float quality_factor, uint8_t** output);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Coding parameters
|
||||
|
||||
typedef struct {
|
||||
float quality; // between 0 (smallest file) and 100 (biggest)
|
||||
int target_size; // if non-zero, set the desired target size in bytes.
|
||||
// Takes precedence over the 'compression' parameter.
|
||||
float target_PSNR; // if non-zero, specifies the minimal distortion to
|
||||
// try to achieve. Takes precedence over target_size.
|
||||
int method; // quality/speed trade-off (0=fast, 6=slower-better)
|
||||
int segments; // maximum number of segments to use, in [1..4]
|
||||
int sns_strength; // Spatial Noise Shaping. 0=off, 100=maximum.
|
||||
int filter_strength; // range: [0 = off .. 100 = strongest]
|
||||
int filter_sharpness; // range: [0 = off .. 7 = least sharp]
|
||||
int filter_type; // filtering type: 0 = simple, 1 = strong
|
||||
// (only used if filter_strength > 0 or autofilter > 0)
|
||||
int autofilter; // Auto adjust filter's strength [0 = off, 1 = on]
|
||||
int pass; // number of entropy-analysis passes (in [1..10]).
|
||||
|
||||
int show_compressed; // if true, export the compressed picture back.
|
||||
// In-loop filtering is not applied.
|
||||
int preprocessing; // preprocessing filter (0=none, 1=segment-smooth)
|
||||
int partitions; // log2(number of token partitions) in [0..3]
|
||||
// Default is set to 0 for easier progressive decoding.
|
||||
int partition_limit; // quality degradation allowed to fit the 512k limit on
|
||||
// prediction modes coding (0=no degradation, 100=full)
|
||||
int alpha_compression; // Algorithm for encoding the alpha plane (0 = none,
|
||||
// 1 = backward reference counts encoded with
|
||||
// arithmetic encoder). Default is 1.
|
||||
int alpha_quality; // Between 0 (smallest size) and 100 (lossless).
|
||||
// Default is 100.
|
||||
} WebPConfig;
|
||||
|
||||
// Enumerate some predefined settings for WebPConfig, depending on the type
|
||||
// of source picture. These presets are used when calling WebPConfigPreset().
|
||||
typedef enum {
|
||||
WEBP_PRESET_DEFAULT = 0, // default preset.
|
||||
WEBP_PRESET_PICTURE, // digital picture, like portrait, inner shot
|
||||
WEBP_PRESET_PHOTO, // outdoor photograph, with natural lighting
|
||||
WEBP_PRESET_DRAWING, // hand or line drawing, with high-contrast details
|
||||
WEBP_PRESET_ICON, // small-sized colorful images
|
||||
WEBP_PRESET_TEXT // text-like
|
||||
} WebPPreset;
|
||||
|
||||
// Internal, version-checked, entry point
|
||||
WEBP_EXTERN(int) WebPConfigInitInternal(
|
||||
WebPConfig* const, WebPPreset, float, int);
|
||||
|
||||
// Should always be called, to initialize a fresh WebPConfig structure before
|
||||
// modification. Returns 0 in case of version mismatch. WebPConfigInit() must
|
||||
// have succeeded before using the 'config' object.
|
||||
static WEBP_INLINE int WebPConfigInit(WebPConfig* const config) {
|
||||
return WebPConfigInitInternal(config, WEBP_PRESET_DEFAULT, 75.f,
|
||||
WEBP_ENCODER_ABI_VERSION);
|
||||
}
|
||||
|
||||
// This function will initialize the configuration according to a predefined
|
||||
// set of parameters (referred to by 'preset') and a given quality factor.
|
||||
// This function can be called as a replacement to WebPConfigInit(). Will
|
||||
// return 0 in case of error.
|
||||
static WEBP_INLINE int WebPConfigPreset(WebPConfig* const config,
|
||||
WebPPreset preset, float quality) {
|
||||
return WebPConfigInitInternal(config, preset, quality,
|
||||
WEBP_ENCODER_ABI_VERSION);
|
||||
}
|
||||
|
||||
// Returns 1 if all parameters are in valid range and the configuration is OK.
|
||||
WEBP_EXTERN(int) WebPValidateConfig(const WebPConfig* const config);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Input / Output
|
||||
|
||||
typedef struct WebPPicture WebPPicture; // main structure for I/O
|
||||
|
||||
// non-essential structure for storing auxiliary statistics
|
||||
typedef struct {
|
||||
float PSNR[4]; // peak-signal-to-noise ratio for Y/U/V/All
|
||||
int coded_size; // final size
|
||||
int block_count[3]; // number of intra4/intra16/skipped macroblocks
|
||||
int header_bytes[2]; // approximate number of bytes spent for header
|
||||
// and mode-partition #0
|
||||
int residual_bytes[3][4]; // approximate number of bytes spent for
|
||||
// DC/AC/uv coefficients for each (0..3) segments.
|
||||
int segment_size[4]; // number of macroblocks in each segments
|
||||
int segment_quant[4]; // quantizer values for each segments
|
||||
int segment_level[4]; // filtering strength for each segments [0..63]
|
||||
|
||||
int alpha_data_size; // size of the transparency data
|
||||
int layer_data_size; // size of the enhancement layer data
|
||||
|
||||
void* user_data; // this field is free to be set to any value and
|
||||
// used during callbacks (like progress-report e.g.).
|
||||
} WebPAuxStats;
|
||||
|
||||
// Signature for output function. Should return 1 if writing was successful.
|
||||
// data/data_size is the segment of data to write, and 'picture' is for
|
||||
// reference (and so one can make use of picture->custom_ptr).
|
||||
typedef int (*WebPWriterFunction)(const uint8_t* data, size_t data_size,
|
||||
const WebPPicture* const picture);
|
||||
|
||||
// Progress hook, called from time to time to report progress. It can return 0
|
||||
// to request an abort of the encoding process, or 1 otherwise if all is OK.
|
||||
typedef int (*WebPProgressHook)(int percent, const WebPPicture* const picture);
|
||||
|
||||
typedef enum {
|
||||
// chroma sampling
|
||||
WEBP_YUV420 = 0, // 4:2:0
|
||||
WEBP_YUV422 = 1, // 4:2:2
|
||||
WEBP_YUV444 = 2, // 4:4:4
|
||||
WEBP_YUV400 = 3, // grayscale
|
||||
WEBP_CSP_UV_MASK = 3, // bit-mask to get the UV sampling factors
|
||||
// alpha channel variants
|
||||
WEBP_YUV420A = 4,
|
||||
WEBP_YUV422A = 5,
|
||||
WEBP_YUV444A = 6,
|
||||
WEBP_YUV400A = 7, // grayscale + alpha
|
||||
WEBP_CSP_ALPHA_BIT = 4 // bit that is set if alpha is present
|
||||
} WebPEncCSP;
|
||||
|
||||
// Encoding error conditions.
|
||||
typedef enum {
|
||||
VP8_ENC_OK = 0,
|
||||
VP8_ENC_ERROR_OUT_OF_MEMORY, // memory error allocating objects
|
||||
VP8_ENC_ERROR_BITSTREAM_OUT_OF_MEMORY, // memory error while flushing bits
|
||||
VP8_ENC_ERROR_NULL_PARAMETER, // a pointer parameter is NULL
|
||||
VP8_ENC_ERROR_INVALID_CONFIGURATION, // configuration is invalid
|
||||
VP8_ENC_ERROR_BAD_DIMENSION, // picture has invalid width/height
|
||||
VP8_ENC_ERROR_PARTITION0_OVERFLOW, // partition is bigger than 512k
|
||||
VP8_ENC_ERROR_PARTITION_OVERFLOW, // partition is bigger than 16M
|
||||
VP8_ENC_ERROR_BAD_WRITE, // error while flushing bytes
|
||||
VP8_ENC_ERROR_FILE_TOO_BIG, // file is bigger than 4G
|
||||
VP8_ENC_ERROR_USER_ABORT, // abort request by user
|
||||
VP8_ENC_ERROR_LAST // list terminator. always last.
|
||||
} WebPEncodingError;
|
||||
|
||||
// maximum width/height allowed (inclusive), in pixels
|
||||
#define WEBP_MAX_DIMENSION 16383
|
||||
|
||||
struct WebPPicture {
|
||||
// input
|
||||
WebPEncCSP colorspace; // colorspace: should be YUV420 for now (=Y'CbCr).
|
||||
int width, height; // dimensions (less or equal to WEBP_MAX_DIMENSION)
|
||||
uint8_t *y, *u, *v; // pointers to luma/chroma planes.
|
||||
int y_stride, uv_stride; // luma/chroma strides.
|
||||
uint8_t *a; // pointer to the alpha plane
|
||||
int a_stride; // stride of the alpha plane
|
||||
|
||||
// output
|
||||
WebPWriterFunction writer; // can be NULL
|
||||
void* custom_ptr; // can be used by the writer.
|
||||
|
||||
// map for extra information
|
||||
int extra_info_type; // 1: intra type, 2: segment, 3: quant
|
||||
// 4: intra-16 prediction mode,
|
||||
// 5: chroma prediction mode,
|
||||
// 6: bit cost, 7: distortion
|
||||
uint8_t* extra_info; // if not NULL, points to an array of size
|
||||
// ((width + 15) / 16) * ((height + 15) / 16) that
|
||||
// will be filled with a macroblock map, depending
|
||||
// on extra_info_type.
|
||||
|
||||
// where to store statistics, if not NULL:
|
||||
WebPAuxStats* stats;
|
||||
|
||||
// original samples (for non-YUV420 modes)
|
||||
uint8_t *u0, *v0;
|
||||
int uv0_stride;
|
||||
|
||||
WebPEncodingError error_code; // error code in case of problem.
|
||||
|
||||
WebPProgressHook progress_hook; // if not NULL, called while encoding.
|
||||
};
|
||||
|
||||
// Internal, version-checked, entry point
|
||||
WEBP_EXTERN(int) WebPPictureInitInternal(WebPPicture* const, int);
|
||||
|
||||
// Should always be called, to initialize the structure. Returns 0 in case of
|
||||
// version mismatch. WebPPictureInit() must have succeeded before using the
|
||||
// 'picture' object.
|
||||
static WEBP_INLINE int WebPPictureInit(WebPPicture* const picture) {
|
||||
return WebPPictureInitInternal(picture, WEBP_ENCODER_ABI_VERSION);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// WebPPicture utils
|
||||
|
||||
// Convenience allocation / deallocation based on picture->width/height:
|
||||
// Allocate y/u/v buffers as per colorspace/width/height specification.
|
||||
// Note! This function will free the previous buffer if needed.
|
||||
// Returns 0 in case of memory error.
|
||||
WEBP_EXTERN(int) WebPPictureAlloc(WebPPicture* const picture);
|
||||
|
||||
// Release memory allocated by WebPPictureAlloc() or WebPPictureImport*()
|
||||
// Note that this function does _not_ free the memory pointed to by 'picture'.
|
||||
WEBP_EXTERN(void) WebPPictureFree(WebPPicture* const picture);
|
||||
|
||||
// Copy the pixels of *src into *dst, using WebPPictureAlloc.
|
||||
// Returns 0 in case of memory allocation error.
|
||||
WEBP_EXTERN(int) WebPPictureCopy(const WebPPicture* const src,
|
||||
WebPPicture* const dst);
|
||||
|
||||
// self-crops a picture to the rectangle defined by top/left/width/height.
|
||||
// Returns 0 in case of memory allocation error, or if the rectangle is
|
||||
// outside of the source picture.
|
||||
WEBP_EXTERN(int) WebPPictureCrop(WebPPicture* const picture,
|
||||
int left, int top, int width, int height);
|
||||
|
||||
// Rescale a picture to new dimension width x height.
|
||||
// Now gamma correction is applied.
|
||||
// Returns false in case of error (invalid parameter or insufficient memory).
|
||||
WEBP_EXTERN(int) WebPPictureRescale(WebPPicture* const pic,
|
||||
int width, int height);
|
||||
|
||||
// Colorspace conversion function to import RGB samples.
|
||||
// Previous buffer will be free'd, if any.
|
||||
// *rgb buffer should have a size of at least height * rgb_stride.
|
||||
// Returns 0 in case of memory error.
|
||||
WEBP_EXTERN(int) WebPPictureImportRGB(
|
||||
WebPPicture* const picture, const uint8_t* const rgb, int rgb_stride);
|
||||
// Same, but for RGBA buffer
|
||||
WEBP_EXTERN(int) WebPPictureImportRGBA(
|
||||
WebPPicture* const picture, const uint8_t* const rgba, int rgba_stride);
|
||||
|
||||
// Variant of the above, but taking BGR(A) input:
|
||||
WEBP_EXTERN(int) WebPPictureImportBGR(
|
||||
WebPPicture* const picture, const uint8_t* const bgr, int bgr_stride);
|
||||
WEBP_EXTERN(int) WebPPictureImportBGRA(
|
||||
WebPPicture* const picture, const uint8_t* const bgra, int bgra_stride);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Main call
|
||||
|
||||
// Main encoding call, after config and picture have been initialized.
|
||||
// 'picture' must be less than 16384x16384 in dimension (cf WEBP_MAX_DIMENSION),
|
||||
// and the 'config' object must be a valid one.
|
||||
// Returns false in case of error, true otherwise.
|
||||
// In case of error, picture->error_code is updated accordingly.
|
||||
WEBP_EXTERN(int) WebPEncode(
|
||||
const WebPConfig* const config, WebPPicture* const picture);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif /* WEBP_WEBP_ENCODE_H_ */
|
||||
+467
@@ -0,0 +1,467 @@
|
||||
// Copyright 2011 Google Inc.
|
||||
//
|
||||
// This code is licensed under the same terms as WebM:
|
||||
// Software License Agreement: http://www.webmproject.org/license/software/
|
||||
// Additional IP Rights Grant: http://www.webmproject.org/license/additional/
|
||||
// -----------------------------------------------------------------------------
|
||||
//
|
||||
// RIFF container manipulation for WEBP images.
|
||||
//
|
||||
// Authors: Urvang ([email protected])
|
||||
// Vikas ([email protected])
|
||||
|
||||
// This API allows manipulation of WebP container images containing features
|
||||
// like Color profile, XMP metadata, Animation & Tiling.
|
||||
//
|
||||
// Code Example#1: Creating a MUX with image data, color profile & XMP metadata.
|
||||
//
|
||||
// int copy_data = 0;
|
||||
// WebPMux* mux = WebPMuxNew();
|
||||
// // ... (Prepare image data).
|
||||
// WebPMuxSetImage(mux, image_data, image_data_size, alpha_data, alpha_size,
|
||||
// copy_data);
|
||||
// // ... (Prepare ICCP color profile data).
|
||||
// WebPMuxSetColorProfile(mux, icc_data, icc_data_size, copy_data);
|
||||
// // ... (Prepare XMP metadata).
|
||||
// WebPMuxSetMetadata(mux, xmp_data, xmp_data_size, copy_data);
|
||||
// // Get data from mux in WebP RIFF format.
|
||||
// WebPMuxAssemble(mux, &output_data, &output_data_size);
|
||||
// WebPMuxDelete(mux);
|
||||
// // ... (Consume output_data; e.g. write output_data to file).
|
||||
// free(output_data);
|
||||
//
|
||||
// Code Example#2: Get image & color profile data from a WebP file.
|
||||
//
|
||||
// int copy_data = 0;
|
||||
// // ... (Read data from file).
|
||||
// WebPMux* mux = WebPMuxCreate(data, data_size, copy_data);
|
||||
// WebPMuxGetImage(mux, &image_data, &image_data_size,
|
||||
// &alpha_data, &alpha_size);
|
||||
// // ... (Consume image_data; e.g. call WebPDecode() to decode the data).
|
||||
// WebPMuxGetColorProfile(mux, &icc_data, &icc_data_size);
|
||||
// // ... (Consume icc_data).
|
||||
// WebPMuxDelete(mux);
|
||||
// free(data);
|
||||
|
||||
#ifndef WEBP_WEBP_MUX_H_
|
||||
#define WEBP_WEBP_MUX_H_
|
||||
|
||||
#include "./types.h"
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Error codes
|
||||
typedef enum {
|
||||
WEBP_MUX_OK = 1,
|
||||
WEBP_MUX_ERROR = 0,
|
||||
WEBP_MUX_NOT_FOUND = -1,
|
||||
WEBP_MUX_INVALID_ARGUMENT = -2,
|
||||
WEBP_MUX_INVALID_PARAMETER = -3,
|
||||
WEBP_MUX_BAD_DATA = -4,
|
||||
WEBP_MUX_MEMORY_ERROR = -5
|
||||
} WebPMuxError;
|
||||
|
||||
// Flag values for different features used in VP8X chunk.
|
||||
typedef enum {
|
||||
TILE_FLAG = 0x00000001,
|
||||
ANIMATION_FLAG = 0x00000002,
|
||||
ICCP_FLAG = 0x00000004,
|
||||
META_FLAG = 0x00000008,
|
||||
ALPHA_FLAG = 0x00000010
|
||||
} FeatureFlags;
|
||||
|
||||
typedef struct WebPMux WebPMux; // main opaque object.
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Life of a Mux object
|
||||
|
||||
// Creates an empty mux object.
|
||||
// Returns:
|
||||
// A pointer to the newly created empty mux object.
|
||||
WEBP_EXTERN(WebPMux*) WebPMuxNew(void);
|
||||
|
||||
// Deletes the mux object.
|
||||
// Parameters:
|
||||
// mux - (in/out) object to be deleted
|
||||
WEBP_EXTERN(void) WebPMuxDelete(WebPMux* const mux);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Mux creation.
|
||||
|
||||
// Creates a mux object from raw data given in WebP RIFF format.
|
||||
// Parameters:
|
||||
// data - (in) the raw data in WebP RIFF format
|
||||
// size - (in) size of raw data
|
||||
// copy_data - (in) value 1 indicates given data WILL copied to the mux, and
|
||||
// value 0 indicates data will NOT be copied.
|
||||
// Returns:
|
||||
// A pointer to the mux object created from given data - on success.
|
||||
// NULL - In case of invalid data or memory error.
|
||||
WEBP_EXTERN(WebPMux*) WebPMuxCreate(const uint8_t* data, uint32_t size,
|
||||
int copy_data);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Single Image.
|
||||
|
||||
// Sets the image in the mux object. Any existing images (including frame/tile)
|
||||
// will be removed.
|
||||
// Parameters:
|
||||
// mux - (in/out) object in which the image is to be set
|
||||
// data - (in) the image data to be set. The data can be either a VP8
|
||||
// bitstream or a single-image WebP file (non-animated & non-tiled)
|
||||
// size - (in) size of the image data
|
||||
// alpha_data - (in) the alpha data corresponding to the image (if present)
|
||||
// alpha_size - (in) size of alpha chunk data
|
||||
// copy_data - (in) value 1 indicates given data WILL copied to the mux, and
|
||||
// value 0 indicates data will NOT be copied.
|
||||
// Returns:
|
||||
// WEBP_MUX_INVALID_ARGUMENT - if mux is NULL or data is NULL.
|
||||
// WEBP_MUX_MEMORY_ERROR - on memory allocation error.
|
||||
// WEBP_MUX_OK - on success.
|
||||
WEBP_EXTERN(WebPMuxError) WebPMuxSetImage(WebPMux* const mux,
|
||||
const uint8_t* data, uint32_t size,
|
||||
const uint8_t* alpha_data,
|
||||
uint32_t alpha_size, int copy_data);
|
||||
|
||||
// Gets a reference to the image in the mux object.
|
||||
// The caller should NOT free the returned data.
|
||||
// Parameters:
|
||||
// mux - (in) object from which the image is to be fetched
|
||||
// data - (out) the returned image data
|
||||
// size - (out) size of the returned image data
|
||||
// alpha_data - (in) the returned alpha data of the image (if present)
|
||||
// alpha_size - (in) size of alpha chunk data
|
||||
// Returns:
|
||||
// WEBP_MUX_INVALID_ARGUMENT - if either of mux, data or size is NULL
|
||||
// OR if mux contains animation/tiling.
|
||||
// WEBP_MUX_NOT_FOUND - if image is not present in mux object.
|
||||
// WEBP_MUX_OK - on success.
|
||||
WEBP_EXTERN(WebPMuxError) WebPMuxGetImage(const WebPMux* const mux,
|
||||
const uint8_t** data, uint32_t* size,
|
||||
const uint8_t** alpha_data,
|
||||
uint32_t* alpha_size);
|
||||
|
||||
// Deletes the image in the mux object.
|
||||
// Parameters:
|
||||
// mux - (in/out) object from which the image is to be deleted
|
||||
// Returns:
|
||||
// WEBP_MUX_INVALID_ARGUMENT - if mux is NULL
|
||||
// OR if mux contains animation/tiling.
|
||||
// WEBP_MUX_NOT_FOUND - if image is not present in mux object.
|
||||
// WEBP_MUX_OK - on success.
|
||||
WEBP_EXTERN(WebPMuxError) WebPMuxDeleteImage(WebPMux* const mux);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// XMP Metadata.
|
||||
|
||||
// Sets the XMP metadata in the mux object. Any existing metadata chunk(s) will
|
||||
// be removed.
|
||||
// Parameters:
|
||||
// mux - (in/out) object to which the XMP metadata is to be added
|
||||
// data - (in) the XMP metadata data to be added
|
||||
// size - (in) size of the XMP metadata data
|
||||
// copy_data - (in) value 1 indicates given data WILL copied to the mux, and
|
||||
// value 0 indicates data will NOT be copied.
|
||||
// Returns:
|
||||
// WEBP_MUX_INVALID_ARGUMENT - if mux is NULL or data is NULL.
|
||||
// WEBP_MUX_MEMORY_ERROR - on memory allocation error.
|
||||
// WEBP_MUX_OK - on success.
|
||||
WEBP_EXTERN(WebPMuxError) WebPMuxSetMetadata(WebPMux* const mux,
|
||||
const uint8_t* data,
|
||||
uint32_t size, int copy_data);
|
||||
|
||||
// Gets a reference to the XMP metadata in the mux object.
|
||||
// The caller should NOT free the returned data.
|
||||
// Parameters:
|
||||
// mux - (in) object from which the XMP metadata is to be fetched
|
||||
// data - (out) the returned XMP metadata
|
||||
// size - (out) size of the returned XMP metadata
|
||||
// Returns:
|
||||
// WEBP_MUX_INVALID_ARGUMENT - if either of mux, data or size is NULL
|
||||
// WEBP_MUX_NOT_FOUND - if metadata is not present in mux object.
|
||||
// WEBP_MUX_OK - on success.
|
||||
WEBP_EXTERN(WebPMuxError) WebPMuxGetMetadata(const WebPMux* const mux,
|
||||
const uint8_t** data,
|
||||
uint32_t* size);
|
||||
|
||||
// Deletes the XMP metadata in the mux object.
|
||||
// Parameters:
|
||||
// mux - (in/out) object from which XMP metadata is to be deleted
|
||||
// Returns:
|
||||
// WEBP_MUX_INVALID_ARGUMENT - if mux is NULL
|
||||
// WEBP_MUX_NOT_FOUND - If mux does not contain metadata.
|
||||
// WEBP_MUX_OK - on success.
|
||||
WEBP_EXTERN(WebPMuxError) WebPMuxDeleteMetadata(WebPMux* const mux);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// ICC Color Profile.
|
||||
|
||||
// Sets the color profile in the mux object. Any existing color profile chunk(s)
|
||||
// will be removed.
|
||||
// Parameters:
|
||||
// mux - (in/out) object to which the color profile is to be added
|
||||
// data - (in) the color profile data to be added
|
||||
// size - (in) size of the color profile data
|
||||
// copy_data - (in) value 1 indicates given data WILL copied to the mux, and
|
||||
// value 0 indicates data will NOT be copied.
|
||||
// Returns:
|
||||
// WEBP_MUX_INVALID_ARGUMENT - if mux is NULL or data is NULL
|
||||
// WEBP_MUX_MEMORY_ERROR - on memory allocation error
|
||||
// WEBP_MUX_OK - on success
|
||||
WEBP_EXTERN(WebPMuxError) WebPMuxSetColorProfile(WebPMux* const mux,
|
||||
const uint8_t* data,
|
||||
uint32_t size, int copy_data);
|
||||
|
||||
// Gets a reference to the color profile in the mux object.
|
||||
// The caller should NOT free the returned data.
|
||||
// Parameters:
|
||||
// mux - (in) object from which the color profile data is to be fetched
|
||||
// data - (out) the returned color profile data
|
||||
// size - (out) size of the returned color profile data
|
||||
// Returns:
|
||||
// WEBP_MUX_INVALID_ARGUMENT - if either of mux, data or size is NULL
|
||||
// WEBP_MUX_NOT_FOUND - if color profile is not present in mux object.
|
||||
// WEBP_MUX_OK - on success.
|
||||
WEBP_EXTERN(WebPMuxError) WebPMuxGetColorProfile(const WebPMux* const mux,
|
||||
const uint8_t** data,
|
||||
uint32_t* size);
|
||||
|
||||
// Deletes the color profile in the mux object.
|
||||
// Parameters:
|
||||
// mux - (in/out) object from which color profile is to be deleted
|
||||
// Returns:
|
||||
// WEBP_MUX_INVALID_ARGUMENT - if mux is NULL
|
||||
// WEBP_MUX_NOT_FOUND - If mux does not contain color profile.
|
||||
// WEBP_MUX_OK - on success.
|
||||
WEBP_EXTERN(WebPMuxError) WebPMuxDeleteColorProfile(WebPMux* const mux);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Animation.
|
||||
|
||||
// Adds an animation frame to the mux object.
|
||||
// nth=0 has a special meaning - last position.
|
||||
// Parameters:
|
||||
// mux - (in/out) object to which an animation frame is to be added
|
||||
// nth - (in) The position at which the frame is to be added.
|
||||
// data - (in) the raw VP8 image data corresponding to frame image. The data
|
||||
// can be either a VP8 bitstream or a single-image WebP file
|
||||
// (non-animated & non-tiled)
|
||||
// size - (in) size of frame chunk data
|
||||
// alpha_data - (in) the alpha data corresponding to frame image (if present)
|
||||
// alpha_size - (in) size of alpha chunk data
|
||||
// x_offset - (in) x-offset of the frame to be added
|
||||
// y_offset - (in) y-offset of the frame to be added
|
||||
// duration - (in) duration of the frame to be added (in milliseconds)
|
||||
// copy_data - (in) value 1 indicates given data WILL copied to the mux, and
|
||||
// value 0 indicates data will NOT be copied.
|
||||
// Returns:
|
||||
// WEBP_MUX_INVALID_ARGUMENT - if mux is NULL or data is NULL
|
||||
// WEBP_MUX_NOT_FOUND - If we have less than (nth-1) frames before adding.
|
||||
// WEBP_MUX_MEMORY_ERROR - on memory allocation error.
|
||||
// WEBP_MUX_OK - on success.
|
||||
WEBP_EXTERN(WebPMuxError) WebPMuxAddFrame(WebPMux* const mux, uint32_t nth,
|
||||
const uint8_t* data, uint32_t size,
|
||||
const uint8_t* alpha_data,
|
||||
uint32_t alpha_size,
|
||||
uint32_t x_offset, uint32_t y_offset,
|
||||
uint32_t duration, int copy_data);
|
||||
|
||||
// TODO(urvang): Create a struct as follows to reduce argument list size:
|
||||
// typedef struct {
|
||||
// int nth;
|
||||
// uint8_t* data;
|
||||
// uint32_t data_size;
|
||||
// uint8_t* alpha;
|
||||
// uint32_t alpha_size;
|
||||
// uint32_t x_offset, y_offset;
|
||||
// uint32_t duration;
|
||||
// } FrameInfo;
|
||||
|
||||
// Gets a reference to the nth animation frame from the mux object.
|
||||
// The caller should NOT free the returned data.
|
||||
// nth=0 has a special meaning - last position.
|
||||
// Parameters:
|
||||
// mux - (in) object from which the info is to be fetched
|
||||
// nth - (in) index of the frame in the mux object
|
||||
// data - (out) the returned image data
|
||||
// size - (out) size of the returned image data
|
||||
// alpha_data - (in) the alpha data corresponding to frame image (if present)
|
||||
// alpha_size - (in) size of alpha chunk data
|
||||
// x_offset - (out) x-offset of the returned frame
|
||||
// y_offset - (out) y-offset of the returned frame
|
||||
// duration - (out) duration of the returned frame (in milliseconds)
|
||||
// Returns:
|
||||
// WEBP_MUX_INVALID_ARGUMENT - if either mux, data, size, x_offset,
|
||||
// y_offset, or duration is NULL
|
||||
// WEBP_MUX_NOT_FOUND - if there are less than nth frames in the mux object.
|
||||
// WEBP_MUX_BAD_DATA - if nth frame chunk in mux is invalid.
|
||||
// WEBP_MUX_OK - on success.
|
||||
WEBP_EXTERN(WebPMuxError) WebPMuxGetFrame(const WebPMux* const mux,
|
||||
uint32_t nth,
|
||||
const uint8_t** data, uint32_t* size,
|
||||
const uint8_t** alpha_data,
|
||||
uint32_t* alpha_size,
|
||||
uint32_t* x_offset,
|
||||
uint32_t* y_offset,
|
||||
uint32_t* duration);
|
||||
|
||||
// Deletes an animation frame from the mux object.
|
||||
// nth=0 has a special meaning - last position.
|
||||
// Parameters:
|
||||
// mux - (in/out) object from which a frame is to be deleted
|
||||
// nth - (in) The position from which the frame is to be deleted
|
||||
// Returns:
|
||||
// WEBP_MUX_INVALID_ARGUMENT - if mux is NULL
|
||||
// WEBP_MUX_NOT_FOUND - If there are less than nth frames in the mux object
|
||||
// before deletion.
|
||||
// WEBP_MUX_OK - on success.
|
||||
WEBP_EXTERN(WebPMuxError) WebPMuxDeleteFrame(WebPMux* const mux, uint32_t nth);
|
||||
|
||||
// Sets the animation loop count in the mux object. Any existing loop count
|
||||
// value(s) will be removed.
|
||||
// Parameters:
|
||||
// mux - (in/out) object in which loop chunk is to be set/added
|
||||
// loop_count - (in) animation loop count value.
|
||||
// Note that loop_count of zero denotes infinite loop.
|
||||
// Returns:
|
||||
// WEBP_MUX_INVALID_ARGUMENT - if mux is NULL
|
||||
// WEBP_MUX_MEMORY_ERROR - on memory allocation error.
|
||||
// WEBP_MUX_OK - on success.
|
||||
WEBP_EXTERN(WebPMuxError) WebPMuxSetLoopCount(WebPMux* const mux,
|
||||
uint32_t loop_count);
|
||||
|
||||
// Gets the animation loop count from the mux object.
|
||||
// Parameters:
|
||||
// mux - (in) object from which the loop count is to be fetched
|
||||
// loop_count - (out) the loop_count value present in the LOOP chunk
|
||||
// Returns:
|
||||
// WEBP_MUX_INVALID_ARGUMENT - if either of mux or loop_count is NULL
|
||||
// WEBP_MUX_NOT_FOUND - if loop chunk is not present in mux object.
|
||||
// WEBP_MUX_OK - on success.
|
||||
WEBP_EXTERN(WebPMuxError) WebPMuxGetLoopCount(const WebPMux* const mux,
|
||||
uint32_t* loop_count);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Tiling.
|
||||
|
||||
// Adds a tile to the mux object.
|
||||
// nth=0 has a special meaning - last position.
|
||||
// Parameters:
|
||||
// mux - (in/out) object to which a tile is to be added
|
||||
// nth - (in) The position at which the tile is to be added.
|
||||
// data - (in) the raw VP8 image data corresponding to tile image. The data
|
||||
// can be either a VP8 bitstream or a single-image WebP file
|
||||
// (non-animated & non-tiled)
|
||||
// size - (in) size of tile chunk data
|
||||
// alpha_data - (in) the alpha data corresponding to tile image (if present)
|
||||
// alpha_size - (in) size of alpha chunk data
|
||||
// x_offset - (in) x-offset of the tile to be added
|
||||
// y_offset - (in) y-offset of the tile to be added
|
||||
// copy_data - (in) value 1 indicates given data WILL copied to the mux, and
|
||||
// value 0 indicates data will NOT be copied.
|
||||
// Returns:
|
||||
// WEBP_MUX_INVALID_ARGUMENT - if mux is NULL or data is NULL
|
||||
// WEBP_MUX_NOT_FOUND - If we have less than (nth-1) tiles before adding.
|
||||
// WEBP_MUX_MEMORY_ERROR - on memory allocation error.
|
||||
// WEBP_MUX_OK - on success.
|
||||
WEBP_EXTERN(WebPMuxError) WebPMuxAddTile(WebPMux* const mux, uint32_t nth,
|
||||
const uint8_t* data, uint32_t size,
|
||||
const uint8_t* alpha_data,
|
||||
uint32_t alpha_size,
|
||||
uint32_t x_offset, uint32_t y_offset,
|
||||
int copy_data);
|
||||
|
||||
// Gets a reference to the nth tile from the mux object.
|
||||
// The caller should NOT free the returned data.
|
||||
// nth=0 has a special meaning - last position.
|
||||
// Parameters:
|
||||
// mux - (in) object from which the info is to be fetched
|
||||
// nth - (in) index of the tile in the mux object
|
||||
// data - (out) the returned image data
|
||||
// size - (out) size of the returned image data
|
||||
// alpha_data - (in) the alpha data corresponding to tile image (if present)
|
||||
// alpha_size - (in) size of alpha chunk data
|
||||
// x_offset - (out) x-offset of the returned tile
|
||||
// y_offset - (out) y-offset of the returned tile
|
||||
// Returns:
|
||||
// WEBP_MUX_INVALID_ARGUMENT - if either mux, data, size, x_offset or
|
||||
// y_offset is NULL
|
||||
// WEBP_MUX_NOT_FOUND - if there are less than nth tiles in the mux object.
|
||||
// WEBP_MUX_BAD_DATA - if nth tile chunk in mux is invalid.
|
||||
// WEBP_MUX_OK - on success.
|
||||
WEBP_EXTERN(WebPMuxError) WebPMuxGetTile(const WebPMux* const mux, uint32_t nth,
|
||||
const uint8_t** data, uint32_t* size,
|
||||
const uint8_t** alpha_data,
|
||||
uint32_t* alpha_size,
|
||||
uint32_t* x_offset,
|
||||
uint32_t* y_offset);
|
||||
|
||||
// Deletes a tile from the mux object.
|
||||
// nth=0 has a special meaning - last position
|
||||
// Parameters:
|
||||
// mux - (in/out) object from which a tile is to be deleted
|
||||
// nth - (in) The position from which the tile is to be deleted
|
||||
// Returns:
|
||||
// WEBP_MUX_INVALID_ARGUMENT - if mux is NULL
|
||||
// WEBP_MUX_NOT_FOUND - If there are less than nth tiles in the mux object
|
||||
// before deletion.
|
||||
// WEBP_MUX_OK - on success.
|
||||
WEBP_EXTERN(WebPMuxError) WebPMuxDeleteTile(WebPMux* const mux, uint32_t nth);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Misc Utilities.
|
||||
|
||||
// Gets the feature flags from the mux object.
|
||||
// Parameters:
|
||||
// mux - (in) object from which the features are to be fetched
|
||||
// flags - (out) the flags specifying which features are present in the
|
||||
// mux object. This will be an OR of various flag values.
|
||||
// Enum 'FeatureFlags' can be used to test for individual flag values.
|
||||
// Returns:
|
||||
// WEBP_MUX_INVALID_ARGUMENT - if mux is NULL or flags is NULL
|
||||
// WEBP_MUX_NOT_FOUND - if VP8X chunk is not present in mux object.
|
||||
// WEBP_MUX_BAD_DATA - if VP8X chunk in mux is invalid.
|
||||
// WEBP_MUX_OK - on success.
|
||||
WEBP_EXTERN(WebPMuxError) WebPMuxGetFeatures(const WebPMux* const mux,
|
||||
uint32_t* flags);
|
||||
|
||||
// Gets number of chunks having tag value tag in the mux object.
|
||||
// Parameters:
|
||||
// mux - (in) object from which the info is to be fetched
|
||||
// tag - (in) tag name specifying the type of chunk
|
||||
// num_elements - (out) number of chunks corresponding to the specified tag
|
||||
// Returns:
|
||||
// WEBP_MUX_INVALID_ARGUMENT - if either mux, tag or num_elements is NULL
|
||||
// WEBP_MUX_OK - on success.
|
||||
WEBP_EXTERN(WebPMuxError) WebPMuxNumNamedElements(const WebPMux* const mux,
|
||||
const char* tag,
|
||||
int* num_elements);
|
||||
|
||||
// Assembles all chunks in WebP RIFF format and returns in output_data.
|
||||
// This function also validates the mux object.
|
||||
// The content of '*output_data' is allocated using malloc(), and NOT
|
||||
// owned by the 'mux' object.
|
||||
// It MUST be deallocated by the caller by calling free().
|
||||
// Parameters:
|
||||
// mux - (in/out) object whose chunks are to be assembled
|
||||
// output_data - (out) byte array where assembled WebP data is returned
|
||||
// output_size - (out) size of returned data
|
||||
// Returns:
|
||||
// WEBP_MUX_BAD_DATA - if mux object is invalid.
|
||||
// WEBP_MUX_INVALID_ARGUMENT - if either mux, output_data or output_size is
|
||||
// NULL.
|
||||
// WEBP_MUX_MEMORY_ERROR - on memory allocation error.
|
||||
// WEBP_MUX_OK - on success
|
||||
WEBP_EXTERN(WebPMuxError) WebPMuxAssemble(WebPMux* const mux,
|
||||
uint8_t** output_data,
|
||||
uint32_t* output_size);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif /* WEBP_WEBP_MUX_H_ */
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
// Copyright 2010 Google Inc.
|
||||
//
|
||||
// This code is licensed under the same terms as WebM:
|
||||
// Software License Agreement: http://www.webmproject.org/license/software/
|
||||
// Additional IP Rights Grant: http://www.webmproject.org/license/additional/
|
||||
// -----------------------------------------------------------------------------
|
||||
//
|
||||
// Common types
|
||||
//
|
||||
// Author: Skal ([email protected])
|
||||
|
||||
#ifndef WEBP_WEBP_TYPES_H_
|
||||
#define WEBP_WEBP_TYPES_H_
|
||||
|
||||
#ifndef _MSC_VER
|
||||
#include <inttypes.h>
|
||||
#ifdef __STRICT_ANSI__
|
||||
#define WEBP_INLINE
|
||||
#else /* __STRICT_ANSI__ */
|
||||
#define WEBP_INLINE inline
|
||||
#endif
|
||||
#else
|
||||
typedef signed char int8_t;
|
||||
typedef unsigned char uint8_t;
|
||||
typedef signed short int16_t;
|
||||
typedef unsigned short uint16_t;
|
||||
typedef signed int int32_t;
|
||||
typedef unsigned int uint32_t;
|
||||
typedef unsigned long long int uint64_t;
|
||||
typedef long long int int64_t;
|
||||
#define WEBP_INLINE __forceinline
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
#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
|
||||
#endif /* WEBP_EXTERN */
|
||||
|
||||
#endif /* WEBP_WEBP_TYPES_H_ */
|
||||
BIN
Binary file not shown.
+24
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>FLAC</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>libwebp 0.1.3</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>FLAC</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.1.3</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>0.1.3</string>
|
||||
</dict>
|
||||
</plist>
|
||||
Executable
BIN
Binary file not shown.
Symlink
+1
@@ -0,0 +1 @@
|
||||
A
|
||||
+1
@@ -0,0 +1 @@
|
||||
Versions/Current/webp
|
||||
@@ -1,23 +1,22 @@
|
||||
/*
|
||||
SDL_image: An example image loading library for use with SDL
|
||||
Copyright (C) 1997-2009 Sam Lantinga
|
||||
SDL_image: An example image loading library for use with SDL
|
||||
Copyright (C) 1997-2012 Sam Lantinga <[email protected]>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
[email protected]
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/* A simple library to load images of various formats as SDL surfaces */
|
||||
@@ -25,9 +24,9 @@
|
||||
#ifndef _SDL_IMAGE_H
|
||||
#define _SDL_IMAGE_H
|
||||
|
||||
#include "SDL.h"
|
||||
#include "SDL_version.h"
|
||||
#include "begin_code.h"
|
||||
#include <SDL/SDL.h>
|
||||
#include <SDL/SDL_version.h>
|
||||
#include <SDL/begin_code.h>
|
||||
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
@@ -38,7 +37,7 @@ extern "C" {
|
||||
*/
|
||||
#define SDL_IMAGE_MAJOR_VERSION 1
|
||||
#define SDL_IMAGE_MINOR_VERSION 2
|
||||
#define SDL_IMAGE_PATCHLEVEL 10
|
||||
#define SDL_IMAGE_PATCHLEVEL 12
|
||||
|
||||
/* This macro can be used to fill a version structure with the compile-time
|
||||
* version of the SDL_image library.
|
||||
@@ -60,7 +59,8 @@ typedef enum
|
||||
{
|
||||
IMG_INIT_JPG = 0x00000001,
|
||||
IMG_INIT_PNG = 0x00000002,
|
||||
IMG_INIT_TIF = 0x00000004
|
||||
IMG_INIT_TIF = 0x00000004,
|
||||
IMG_INIT_WEBP = 0x00000008
|
||||
} IMG_InitFlags;
|
||||
|
||||
/* Loads dynamic libraries and prepares them for use. Flags should be
|
||||
@@ -104,6 +104,7 @@ extern DECLSPEC int SDLCALL IMG_isTIF(SDL_RWops *src);
|
||||
extern DECLSPEC int SDLCALL IMG_isXCF(SDL_RWops *src);
|
||||
extern DECLSPEC int SDLCALL IMG_isXPM(SDL_RWops *src);
|
||||
extern DECLSPEC int SDLCALL IMG_isXV(SDL_RWops *src);
|
||||
extern DECLSPEC int SDLCALL IMG_isWEBP(SDL_RWops *src);
|
||||
|
||||
/* Individual loading functions */
|
||||
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadICO_RW(SDL_RWops *src);
|
||||
@@ -120,6 +121,7 @@ extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadTIF_RW(SDL_RWops *src);
|
||||
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadXCF_RW(SDL_RWops *src);
|
||||
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadXPM_RW(SDL_RWops *src);
|
||||
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadXV_RW(SDL_RWops *src);
|
||||
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadWEBP_RW(SDL_RWops *src);
|
||||
|
||||
extern DECLSPEC SDL_Surface * SDLCALL IMG_ReadXPMFromArray(char **xpm);
|
||||
|
||||
@@ -131,6 +133,6 @@ extern DECLSPEC SDL_Surface * SDLCALL IMG_ReadXPMFromArray(char **xpm);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
#include <SDL/close_code.h>
|
||||
|
||||
#endif /* _SDL_IMAGE_H */
|
||||
|
||||
@@ -2,25 +2,37 @@
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>BuildMachineOSBuild</key>
|
||||
<string>11C74</string>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>SDL_image</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>http://www.libsdl.org</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>SDL_image</string>
|
||||
<string>org.libsdl.SDL-image</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>Simple DirectMedia Layer</string>
|
||||
<string>SDL_image</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.2.10</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>SDL_imageX</string>
|
||||
<string>1.2.12</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.2.10</string>
|
||||
<string>1.2.12</string>
|
||||
<key>DTCompiler</key>
|
||||
<string></string>
|
||||
<key>DTPlatformBuild</key>
|
||||
<string>4D502</string>
|
||||
<key>DTPlatformVersion</key>
|
||||
<string>GM</string>
|
||||
<key>DTSDKBuild</key>
|
||||
<string>11C63</string>
|
||||
<key>DTSDKName</key>
|
||||
<string>macosx10.7</string>
|
||||
<key>DTXcode</key>
|
||||
<string>0421</string>
|
||||
<key>DTXcodeBuild</key>
|
||||
<string>4D502</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user