replace 'typedef struct {} X;" by "typedef struct X X; struct X {};"

Change-Id: I937dc8781bc87ef0c4e109d49dc1cf6f18033f12
This commit is contained in:
skal 2012-09-25 18:39:22 +02:00
parent 2afee60a7c
commit 28d25c8256
3 changed files with 95 additions and 68 deletions

View File

@ -20,6 +20,16 @@ extern "C" {
#define WEBP_DECODER_ABI_VERSION 0x0200 // MAJOR(8b) + MINOR(8b) #define WEBP_DECODER_ABI_VERSION 0x0200 // MAJOR(8b) + MINOR(8b)
typedef struct WebPRGBABuffer WebPRGBABuffer;
typedef struct WebPYUVABuffer WebPYUVABuffer;
typedef struct WebPDecBuffer WebPDecBuffer;
typedef enum VP8StatusCode VP8StatusCode;
typedef enum WEBP_CSP_MODE WEBP_CSP_MODE;
typedef struct WebPIDecoder WebPIDecoder;
typedef struct WebPBitstreamFeatures WebPBitstreamFeatures;
typedef struct WebPDecoderOptions WebPDecoderOptions;
typedef struct WebPDecoderConfig WebPDecoderConfig;
// Return the decoder's version number, packed in hexadecimal using 8bits for // Return the decoder's version number, packed in hexadecimal using 8bits for
// each of major/minor/revision. E.g: v2.5.7 is 0x020507. // each of major/minor/revision. E.g: v2.5.7 is 0x020507.
WEBP_EXTERN(int) WebPGetDecoderVersion(void); WEBP_EXTERN(int) WebPGetDecoderVersion(void);
@ -119,19 +129,20 @@ WEBP_EXTERN(uint8_t*) WebPDecodeYUVInto(
// For instance, MODE_BGRA relates to samples ordered as B,G,R,A,B,G,R,A,... // For instance, MODE_BGRA relates to samples ordered as B,G,R,A,B,G,R,A,...
// Non-capital names (e.g.:MODE_Argb) relates to pre-multiplied RGB channels. // Non-capital names (e.g.:MODE_Argb) relates to pre-multiplied RGB channels.
// RGB-565 and RGBA-4444 are also endian-agnostic and byte-oriented. // RGB-565 and RGBA-4444 are also endian-agnostic and byte-oriented.
typedef enum { MODE_RGB = 0, MODE_RGBA = 1, enum WEBP_CSP_MODE {
MODE_BGR = 2, MODE_BGRA = 3, MODE_RGB = 0, MODE_RGBA = 1,
MODE_ARGB = 4, MODE_RGBA_4444 = 5, MODE_BGR = 2, MODE_BGRA = 3,
MODE_RGB_565 = 6, MODE_ARGB = 4, MODE_RGBA_4444 = 5,
// RGB-premultiplied transparent modes (alpha value is preserved) MODE_RGB_565 = 6,
MODE_rgbA = 7, // RGB-premultiplied transparent modes (alpha value is preserved)
MODE_bgrA = 8, MODE_rgbA = 7,
MODE_Argb = 9, MODE_bgrA = 8,
MODE_rgbA_4444 = 10, MODE_Argb = 9,
// YUV modes must come after RGB ones. MODE_rgbA_4444 = 10,
MODE_YUV = 11, MODE_YUVA = 12, // yuv 4:2:0 // YUV modes must come after RGB ones.
MODE_LAST = 13 MODE_YUV = 11, MODE_YUVA = 12, // yuv 4:2:0
} WEBP_CSP_MODE; MODE_LAST = 13
};
// Some useful macros: // Some useful macros:
static WEBP_INLINE int WebPIsPremultipliedMode(WEBP_CSP_MODE mode) { static WEBP_INLINE int WebPIsPremultipliedMode(WEBP_CSP_MODE mode) {
@ -152,13 +163,13 @@ static WEBP_INLINE int WebPIsRGBMode(WEBP_CSP_MODE mode) {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// WebPDecBuffer: Generic structure for describing the output sample buffer. // WebPDecBuffer: Generic structure for describing the output sample buffer.
typedef struct { // view as RGBA struct WebPRGBABuffer { // view as RGBA
uint8_t* rgba; // pointer to RGBA samples uint8_t* rgba; // pointer to RGBA samples
int stride; // stride in bytes from one scanline to the next. int stride; // stride in bytes from one scanline to the next.
size_t size; // total size of the *rgba buffer. size_t size; // total size of the *rgba buffer.
} WebPRGBABuffer; };
typedef struct { // view as YUVA struct WebPYUVABuffer { // view as YUVA
uint8_t* y, *u, *v, *a; // pointer to luma, chroma U/V, alpha samples uint8_t* y, *u, *v, *a; // pointer to luma, chroma U/V, alpha samples
int y_stride; // luma stride int y_stride; // luma stride
int u_stride, v_stride; // chroma strides int u_stride, v_stride; // chroma strides
@ -166,10 +177,10 @@ typedef struct { // view as YUVA
size_t y_size; // luma plane size size_t y_size; // luma plane size
size_t u_size, v_size; // chroma planes size size_t u_size, v_size; // chroma planes size
size_t a_size; // alpha-plane size size_t a_size; // alpha-plane size
} WebPYUVABuffer; };
// Output buffer // Output buffer
typedef struct { struct WebPDecBuffer {
WEBP_CSP_MODE colorspace; // Colorspace. WEBP_CSP_MODE colorspace; // Colorspace.
int width, height; // Dimensions. int width, height; // Dimensions.
int is_external_memory; // If true, 'internal_memory' pointer is not used. int is_external_memory; // If true, 'internal_memory' pointer is not used.
@ -182,7 +193,7 @@ typedef struct {
uint8_t* private_memory; // Internally allocated memory (only when uint8_t* private_memory; // Internally allocated memory (only when
// is_external_memory is false). Should not be used // is_external_memory is false). Should not be used
// externally, but accessed via the buffer union. // externally, but accessed via the buffer union.
} WebPDecBuffer; };
// Internal, version-checked, entry point // Internal, version-checked, entry point
WEBP_EXTERN(int) WebPInitDecBufferInternal(WebPDecBuffer*, int); WEBP_EXTERN(int) WebPInitDecBufferInternal(WebPDecBuffer*, int);
@ -200,7 +211,7 @@ WEBP_EXTERN(void) WebPFreeDecBuffer(WebPDecBuffer* buffer);
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// Enumeration of the status codes // Enumeration of the status codes
typedef enum { enum VP8StatusCode {
VP8_STATUS_OK = 0, VP8_STATUS_OK = 0,
VP8_STATUS_OUT_OF_MEMORY, VP8_STATUS_OUT_OF_MEMORY,
VP8_STATUS_INVALID_PARAM, VP8_STATUS_INVALID_PARAM,
@ -209,7 +220,7 @@ typedef enum {
VP8_STATUS_SUSPENDED, VP8_STATUS_SUSPENDED,
VP8_STATUS_USER_ABORT, VP8_STATUS_USER_ABORT,
VP8_STATUS_NOT_ENOUGH_DATA VP8_STATUS_NOT_ENOUGH_DATA
} VP8StatusCode; };
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// Incremental decoding // Incremental decoding
@ -237,8 +248,6 @@ typedef enum {
// } // }
// WebPIDelete(idec); // WebPIDelete(idec);
typedef struct WebPIDecoder WebPIDecoder;
// Creates a new incremental decoder with the supplied buffer parameter. // Creates a new incremental decoder with the supplied buffer parameter.
// This output_buffer can be passed NULL, in which case a default output buffer // 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 used (with MODE_RGB). Otherwise, an internal reference to 'output_buffer'
@ -365,7 +374,7 @@ WEBP_EXTERN(const WebPDecBuffer*) WebPIDecodedArea(
*/ */
// Features gathered from the bitstream // Features gathered from the bitstream
typedef struct { struct WebPBitstreamFeatures {
int width; // Width in pixels, as read from the bitstream. int width; // Width in pixels, as read from the bitstream.
int height; // Height in pixels, as read from the bitstream. int height; // Height in pixels, as read from the bitstream.
int has_alpha; // True if the bitstream contains an alpha channel. int has_alpha; // True if the bitstream contains an alpha channel.
@ -377,7 +386,7 @@ typedef struct {
int rotate; // TODO(later) int rotate; // TODO(later)
int uv_sampling; // should be 0 for now. TODO(later) int uv_sampling; // should be 0 for now. TODO(later)
uint32_t pad[3]; // padding for later use uint32_t pad[3]; // padding for later use
} WebPBitstreamFeatures; };
// Internal, version-checked, entry point // Internal, version-checked, entry point
WEBP_EXTERN(VP8StatusCode) WebPGetFeaturesInternal( WEBP_EXTERN(VP8StatusCode) WebPGetFeaturesInternal(
@ -395,7 +404,7 @@ static WEBP_INLINE VP8StatusCode WebPGetFeatures(
} }
// Decoding options // Decoding options
typedef struct { struct WebPDecoderOptions {
int bypass_filtering; // if true, skip the in-loop filtering int bypass_filtering; // if true, skip the in-loop filtering
int no_fancy_upsampling; // if true, use faster pointwise upsampler int no_fancy_upsampling; // if true, use faster pointwise upsampler
int use_cropping; // if true, cropping is applied _first_ int use_cropping; // if true, cropping is applied _first_
@ -410,14 +419,14 @@ typedef struct {
int force_rotation; // forced rotation (to be applied _last_) int force_rotation; // forced rotation (to be applied _last_)
int no_enhancement; // if true, discard enhancement layer int no_enhancement; // if true, discard enhancement layer
uint32_t pad[6]; // padding for later use uint32_t pad[6]; // padding for later use
} WebPDecoderOptions; };
// Main object storing the configuration for advanced decoding. // Main object storing the configuration for advanced decoding.
typedef struct { struct WebPDecoderConfig {
WebPBitstreamFeatures input; // Immutable bitstream features (optional) WebPBitstreamFeatures input; // Immutable bitstream features (optional)
WebPDecBuffer output; // Output buffer (can point to external mem) WebPDecBuffer output; // Output buffer (can point to external mem)
WebPDecoderOptions options; // Decoding options WebPDecoderOptions options; // Decoding options
} WebPDecoderConfig; };
// Internal, version-checked, entry point // Internal, version-checked, entry point
WEBP_EXTERN(int) WebPInitDecoderConfigInternal(WebPDecoderConfig*, int); WEBP_EXTERN(int) WebPInitDecoderConfigInternal(WebPDecoderConfig*, int);

View File

@ -20,6 +20,15 @@ extern "C" {
#define WEBP_ENCODER_ABI_VERSION 0x0200 // MAJOR(8b) + MINOR(8b) #define WEBP_ENCODER_ABI_VERSION 0x0200 // MAJOR(8b) + MINOR(8b)
typedef enum WebPImageHint WebPImageHint;
typedef enum WebPEncCSP WebPEncCSP;
typedef struct WebPConfig WebPConfig;
typedef enum WebPPreset WebPPreset;
typedef struct WebPPicture WebPPicture; // main structure for I/O
typedef struct WebPAuxStats WebPAuxStats;
typedef struct WebPMemoryWriter WebPMemoryWriter;
typedef enum WebPEncodingError WebPEncodingError;
// Return the encoder's version number, packed in hexadecimal using 8bits for // Return the encoder's version number, packed in hexadecimal using 8bits for
// each of major/minor/revision. E.g: v2.5.7 is 0x020507. // each of major/minor/revision. E.g: v2.5.7 is 0x020507.
WEBP_EXTERN(int) WebPGetEncoderVersion(void); WEBP_EXTERN(int) WebPGetEncoderVersion(void);
@ -66,15 +75,16 @@ WEBP_EXTERN(size_t) WebPEncodeLosslessBGRA(const uint8_t* bgra,
// Coding parameters // Coding parameters
// Image characteristics hint for the underlying encoder. // Image characteristics hint for the underlying encoder.
typedef enum { enum WebPImageHint {
WEBP_HINT_DEFAULT = 0, // default preset. WEBP_HINT_DEFAULT = 0, // default preset.
WEBP_HINT_PICTURE, // digital picture, like portrait, inner shot WEBP_HINT_PICTURE, // digital picture, like portrait, inner shot
WEBP_HINT_PHOTO, // outdoor photograph, with natural lighting WEBP_HINT_PHOTO, // outdoor photograph, with natural lighting
WEBP_HINT_GRAPH, // Discrete tone image (graph, map-tile etc). WEBP_HINT_GRAPH, // Discrete tone image (graph, map-tile etc).
WEBP_HINT_LAST WEBP_HINT_LAST
} WebPImageHint; };
typedef struct { // Compression parameters.
struct WebPConfig {
int lossless; // Lossless encoding (0=lossy(default), 1=lossless). int lossless; // Lossless encoding (0=lossy(default), 1=lossless).
float quality; // between 0 (smallest file) and 100 (biggest) float quality; // between 0 (smallest file) and 100 (biggest)
int method; // quality/speed trade-off (0=fast, 6=slower-better) int method; // quality/speed trade-off (0=fast, 6=slower-better)
@ -111,18 +121,18 @@ typedef struct {
// 100: maximum possible degradation). // 100: maximum possible degradation).
uint32_t pad[8]; // padding for later use uint32_t pad[8]; // padding for later use
} WebPConfig; };
// Enumerate some predefined settings for WebPConfig, depending on the type // Enumerate some predefined settings for WebPConfig, depending on the type
// of source picture. These presets are used when calling WebPConfigPreset(). // of source picture. These presets are used when calling WebPConfigPreset().
typedef enum { enum WebPPreset {
WEBP_PRESET_DEFAULT = 0, // default preset. WEBP_PRESET_DEFAULT = 0, // default preset.
WEBP_PRESET_PICTURE, // digital picture, like portrait, inner shot WEBP_PRESET_PICTURE, // digital picture, like portrait, inner shot
WEBP_PRESET_PHOTO, // outdoor photograph, with natural lighting WEBP_PRESET_PHOTO, // outdoor photograph, with natural lighting
WEBP_PRESET_DRAWING, // hand or line drawing, with high-contrast details WEBP_PRESET_DRAWING, // hand or line drawing, with high-contrast details
WEBP_PRESET_ICON, // small-sized colorful images WEBP_PRESET_ICON, // small-sized colorful images
WEBP_PRESET_TEXT // text-like WEBP_PRESET_TEXT // text-like
} WebPPreset; };
// Internal, version-checked, entry point // Internal, version-checked, entry point
WEBP_EXTERN(int) WebPConfigInitInternal(WebPConfig*, WebPPreset, float, int); WEBP_EXTERN(int) WebPConfigInitInternal(WebPConfig*, WebPPreset, float, int);
@ -152,11 +162,9 @@ WEBP_EXTERN(int) WebPValidateConfig(const WebPConfig* config);
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// Input / Output // Input / Output
typedef struct WebPPicture WebPPicture; // main structure for I/O
// Structure for storing auxiliary statistics (mostly for lossy encoding). // Structure for storing auxiliary statistics (mostly for lossy encoding).
typedef struct {
struct WebPAuxStats {
int coded_size; // final size int coded_size; // final size
float PSNR[5]; // peak-signal-to-noise ratio for Y/U/V/All/Alpha float PSNR[5]; // peak-signal-to-noise ratio for Y/U/V/All/Alpha
@ -182,7 +190,7 @@ typedef struct {
int lossless_size; // final lossless size int lossless_size; // final lossless size
uint32_t pad[4]; // padding for later use uint32_t pad[4]; // padding for later use
} WebPAuxStats; };
// Signature for output function. Should return true if writing was successful. // Signature for output function. Should return true if writing was successful.
// data/data_size is the segment of data to write, and 'picture' is for // data/data_size is the segment of data to write, and 'picture' is for
@ -192,12 +200,12 @@ typedef int (*WebPWriterFunction)(const uint8_t* data, size_t data_size,
// WebPMemoryWrite: a special WebPWriterFunction that writes to memory using // WebPMemoryWrite: a special WebPWriterFunction that writes to memory using
// the following WebPMemoryWriter object (to be set as a custom_ptr). // the following WebPMemoryWriter object (to be set as a custom_ptr).
typedef struct { struct WebPMemoryWriter {
uint8_t* mem; // final buffer (of size 'max_size', larger than 'size'). uint8_t* mem; // final buffer (of size 'max_size', larger than 'size').
size_t size; // final size size_t size; // final size
size_t max_size; // total capacity size_t max_size; // total capacity
uint32_t pad[1]; // padding for later use uint32_t pad[1]; // padding for later use
} WebPMemoryWriter; };
// The following must be called first before any use. // The following must be called first before any use.
WEBP_EXTERN(void) WebPMemoryWriterInit(WebPMemoryWriter* writer); WEBP_EXTERN(void) WebPMemoryWriterInit(WebPMemoryWriter* writer);
@ -212,7 +220,8 @@ WEBP_EXTERN(int) WebPMemoryWrite(const uint8_t* data, size_t data_size,
// everything is OK. // everything is OK.
typedef int (*WebPProgressHook)(int percent, const WebPPicture* picture); typedef int (*WebPProgressHook)(int percent, const WebPPicture* picture);
typedef enum { // Color spaces.
enum WebPEncCSP {
// chroma sampling // chroma sampling
WEBP_YUV420 = 0, // 4:2:0 WEBP_YUV420 = 0, // 4:2:0
WEBP_YUV422 = 1, // 4:2:2 WEBP_YUV422 = 1, // 4:2:2
@ -225,10 +234,10 @@ typedef enum {
WEBP_YUV444A = 6, WEBP_YUV444A = 6,
WEBP_YUV400A = 7, // grayscale + alpha WEBP_YUV400A = 7, // grayscale + alpha
WEBP_CSP_ALPHA_BIT = 4 // bit that is set if alpha is present WEBP_CSP_ALPHA_BIT = 4 // bit that is set if alpha is present
} WebPEncCSP; };
// Encoding error conditions. // Encoding error conditions.
typedef enum { enum WebPEncodingError {
VP8_ENC_OK = 0, VP8_ENC_OK = 0,
VP8_ENC_ERROR_OUT_OF_MEMORY, // memory error allocating objects 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_BITSTREAM_OUT_OF_MEMORY, // memory error while flushing bits
@ -241,7 +250,7 @@ typedef enum {
VP8_ENC_ERROR_FILE_TOO_BIG, // file is bigger than 4G VP8_ENC_ERROR_FILE_TOO_BIG, // file is bigger than 4G
VP8_ENC_ERROR_USER_ABORT, // abort request by user VP8_ENC_ERROR_USER_ABORT, // abort request by user
VP8_ENC_ERROR_LAST // list terminator. always last. VP8_ENC_ERROR_LAST // list terminator. always last.
} WebPEncodingError; };
// maximum width/height allowed (inclusive), in pixels // maximum width/height allowed (inclusive), in pixels
#define WEBP_MAX_DIMENSION 16383 #define WEBP_MAX_DIMENSION 16383

View File

@ -53,27 +53,40 @@ extern "C" {
#define WEBP_MUX_ABI_VERSION 0x0100 // MAJOR(8b) + MINOR(8b) #define WEBP_MUX_ABI_VERSION 0x0100 // MAJOR(8b) + MINOR(8b)
typedef struct WebPMux WebPMux; // main opaque object.
typedef struct WebPData WebPData;
typedef enum WebPMuxError WebPMuxError;
typedef enum WebPFeatureFlags WebPFeatureFlags;
typedef enum WebPChunkId WebPChunkId;
typedef struct WebPMuxFrameInfo WebPMuxFrameInfo;
typedef struct WebPDemuxer WebPDemuxer;
typedef enum WebPDemuxState WebPDemuxState;
typedef enum WebPFormatFeature WebPFormatFeature;
typedef struct WebPIterator WebPIterator;
typedef struct WebPChunkIterator WebPChunkIterator;
// Error codes // Error codes
typedef enum { enum WebPMuxError {
WEBP_MUX_OK = 1, WEBP_MUX_OK = 1,
WEBP_MUX_NOT_FOUND = 0, WEBP_MUX_NOT_FOUND = 0,
WEBP_MUX_INVALID_ARGUMENT = -1, WEBP_MUX_INVALID_ARGUMENT = -1,
WEBP_MUX_BAD_DATA = -2, WEBP_MUX_BAD_DATA = -2,
WEBP_MUX_MEMORY_ERROR = -3, WEBP_MUX_MEMORY_ERROR = -3,
WEBP_MUX_NOT_ENOUGH_DATA = -4 WEBP_MUX_NOT_ENOUGH_DATA = -4
} WebPMuxError; };
// Flag values for different features used in VP8X chunk. // Flag values for different features used in VP8X chunk.
typedef enum { enum WebPFeatureFlags {
TILE_FLAG = 0x00000001, TILE_FLAG = 0x00000001,
ANIMATION_FLAG = 0x00000002, ANIMATION_FLAG = 0x00000002,
ICCP_FLAG = 0x00000004, ICCP_FLAG = 0x00000004,
META_FLAG = 0x00000008, META_FLAG = 0x00000008,
ALPHA_FLAG = 0x00000010 ALPHA_FLAG = 0x00000010
} WebPFeatureFlags; };
// IDs for different types of chunks. // IDs for different types of chunks.
typedef enum { enum WebPChunkId {
WEBP_CHUNK_VP8X, // VP8X WEBP_CHUNK_VP8X, // VP8X
WEBP_CHUNK_ICCP, // ICCP WEBP_CHUNK_ICCP, // ICCP
WEBP_CHUNK_LOOP, // LOOP WEBP_CHUNK_LOOP, // LOOP
@ -84,16 +97,14 @@ typedef enum {
WEBP_CHUNK_META, // META WEBP_CHUNK_META, // META
WEBP_CHUNK_UNKNOWN, // Other chunks. WEBP_CHUNK_UNKNOWN, // Other chunks.
WEBP_CHUNK_NIL WEBP_CHUNK_NIL
} WebPChunkId; };
typedef struct WebPMux WebPMux; // main opaque object.
// Data type used to describe 'raw' data, e.g., chunk data // Data type used to describe 'raw' data, e.g., chunk data
// (ICC profile, metadata) and WebP compressed image data. // (ICC profile, metadata) and WebP compressed image data.
typedef struct { struct WebPData {
const uint8_t* bytes_; const uint8_t* bytes_;
size_t size_; size_t size_;
} WebPData; };
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// Manipulation of a WebPData object. // Manipulation of a WebPData object.
@ -246,14 +257,14 @@ WEBP_EXTERN(WebPMuxError) WebPMuxDeleteChunk(
// Animation. // Animation.
// Encapsulates data about a single frame/tile. // Encapsulates data about a single frame/tile.
typedef struct { struct WebPMuxFrameInfo {
WebPData bitstream_; // image data: can either be a raw VP8/VP8L bitstream WebPData bitstream_; // image data: can either be a raw VP8/VP8L bitstream
// or a single-image WebP file. // or a single-image WebP file.
int x_offset_; // x-offset of the frame. int x_offset_; // x-offset of the frame.
int y_offset_; // y-offset of the frame. int y_offset_; // y-offset of the frame.
int duration_; // duration of the frame (in milliseconds). int duration_; // duration of the frame (in milliseconds).
uint32_t pad[3]; // padding for later use uint32_t pad[3]; // padding for later use
} WebPMuxFrameInfo; };
// Adds an animation frame at the end of the mux object. // Adds an animation frame at the end of the mux object.
// Note: as WebP only supports even offsets, any odd offset will be snapped to // Note: as WebP only supports even offsets, any odd offset will be snapped to
@ -423,13 +434,11 @@ WEBP_EXTERN(WebPMuxError) WebPMuxAssemble(WebPMux* mux,
#define WEBP_DEMUX_ABI_VERSION 0x0100 // MAJOR(8b) + MINOR(8b) #define WEBP_DEMUX_ABI_VERSION 0x0100 // MAJOR(8b) + MINOR(8b)
typedef struct WebPDemuxer WebPDemuxer; enum WebPDemuxState {
typedef enum {
WEBP_DEMUX_PARSING_HEADER, // Not enough data to parse full header. WEBP_DEMUX_PARSING_HEADER, // Not enough data to parse full header.
WEBP_DEMUX_PARSED_HEADER, // Header parsing complete, data may be available. WEBP_DEMUX_PARSED_HEADER, // Header parsing complete, data may be available.
WEBP_DEMUX_DONE // Entire file has been parsed. WEBP_DEMUX_DONE // Entire file has been parsed.
} WebPDemuxState; };
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// Life of a Demux object // Life of a Demux object
@ -459,12 +468,12 @@ WEBP_EXTERN(void) WebPDemuxDelete(WebPDemuxer* dmux);
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// Data/information extraction. // Data/information extraction.
typedef enum { enum WebPFormatFeature {
WEBP_FF_FORMAT_FLAGS, // Extended format flags present in the 'VP8X' chunk. WEBP_FF_FORMAT_FLAGS, // Extended format flags present in the 'VP8X' chunk.
WEBP_FF_CANVAS_WIDTH, WEBP_FF_CANVAS_WIDTH,
WEBP_FF_CANVAS_HEIGHT, WEBP_FF_CANVAS_HEIGHT,
WEBP_FF_LOOP_COUNT WEBP_FF_LOOP_COUNT
} WebPFormatFeature; };
// Get the 'feature' value from the 'dmux'. // Get the 'feature' value from the 'dmux'.
// NOTE: values are only valid if WebPDemux() was used or WebPDemuxPartial() // NOTE: values are only valid if WebPDemux() was used or WebPDemuxPartial()
@ -475,7 +484,7 @@ WEBP_EXTERN(uint32_t) WebPDemuxGetI(
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// Frame iteration. // Frame iteration.
typedef struct { struct WebPIterator {
int frame_num_; int frame_num_;
int num_frames_; int num_frames_;
int tile_num_; int tile_num_;
@ -489,7 +498,7 @@ typedef struct {
uint32_t pad[4]; // padding for later use uint32_t pad[4]; // padding for later use
void* private_; void* private_;
} WebPIterator; };
// Retrieves frame 'frame_number' from 'dmux'. // Retrieves frame 'frame_number' from 'dmux'.
// 'iter->tile_' points to the first tile on return from this function. // 'iter->tile_' points to the first tile on return from this function.
@ -519,7 +528,7 @@ WEBP_EXTERN(void) WebPDemuxReleaseIterator(WebPIterator* iter);
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// Chunk iteration. // Chunk iteration.
typedef struct { struct WebPChunkIterator {
// The current and total number of chunks with the fourcc given to // The current and total number of chunks with the fourcc given to
// WebPDemuxGetChunk(). // WebPDemuxGetChunk().
int chunk_num_; int chunk_num_;
@ -528,7 +537,7 @@ typedef struct {
uint32_t pad[6]; // padding for later use uint32_t pad[6]; // padding for later use
void* private_; void* private_;
} WebPChunkIterator; };
// Retrieves the 'chunk_number' instance of the chunk with id 'fourcc' from // Retrieves the 'chunk_number' instance of the chunk with id 'fourcc' from
// 'dmux'. // 'dmux'.