summaryrefslogtreecommitdiffstats
path: root/third_party/libwebp/webp
diff options
context:
space:
mode:
authorabarth@chromium.org <abarth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-05 07:16:54 +0000
committerabarth@chromium.org <abarth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-05 07:16:54 +0000
commita6e603e0d0e60c9ac7470871106e5c984fa25694 (patch)
treeb507ca7a1858ca0c37a40322f37a4a5d59137853 /third_party/libwebp/webp
parentfe245ae465ec8fa8919d31545bb5ddae0b8bd79c (diff)
downloadchromium_src-a6e603e0d0e60c9ac7470871106e5c984fa25694.zip
chromium_src-a6e603e0d0e60c9ac7470871106e5c984fa25694.tar.gz
chromium_src-a6e603e0d0e60c9ac7470871106e5c984fa25694.tar.bz2
Update libwebp to libwebp-0.1.2.
Patch originally by Pascal Massimino: http://codereview.chromium.org/6760004/ Review URL: http://codereview.chromium.org/6793035 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@80421 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party/libwebp/webp')
-rw-r--r--third_party/libwebp/webp/decode.h102
-rw-r--r--third_party/libwebp/webp/decode_vp8.h18
-rw-r--r--third_party/libwebp/webp/encode.h6
3 files changed, 109 insertions, 17 deletions
diff --git a/third_party/libwebp/webp/decode.h b/third_party/libwebp/webp/decode.h
index 78b9016..6c63d54 100644
--- a/third_party/libwebp/webp/decode.h
+++ b/third_party/libwebp/webp/decode.h
@@ -12,12 +12,16 @@
#ifndef WEBP_WEBP_DECODE_H_
#define WEBP_WEBP_DECODE_H_
-#include "../webp/types.h"
+#include "webp/types.h"
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
+// Return the decoder's version number, packed in hexadecimal using 8bits for
+// each of major/minor/revision. E.g: v2.5.7 is 0x020507.
+int WebPGetDecoderVersion(void);
+
// Retrieve basic header information: width, height.
// This function will also validate the header and return 0 in
// case of formatting error.
@@ -92,6 +96,102 @@ uint8_t* WebPDecodeYUVInto(const uint8_t* data, uint32_t data_size,
//-----------------------------------------------------------------------------
+// Output colorspaces
+typedef enum { MODE_RGB = 0, MODE_RGBA = 1,
+ MODE_BGR = 2, MODE_BGRA = 3,
+ MODE_YUV = 4 } WEBP_CSP_MODE;
+
+// 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 WebPIDecoder object. Returns NULL in case of failure.
+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.
+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.
+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 WebpBuffer object and associated memory. Must always be called
+// if WebPINew, WebPINewRGB or WebPINewYUV succeeded.
+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.
+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.
+VP8StatusCode WebPIUpdate(WebPIDecoder* const idec, const uint8_t* data,
+ uint32_t data_size);
+
+// Returns the RGB image decoded so far. Returns NULL if output params are not
+// initialized yet. *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.
+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.
+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);
+
+
#if defined(__cplusplus) || defined(c_plusplus)
} // extern "C"
#endif
diff --git a/third_party/libwebp/webp/decode_vp8.h b/third_party/libwebp/webp/decode_vp8.h
index 08c6f69..153a4c5 100644
--- a/third_party/libwebp/webp/decode_vp8.h
+++ b/third_party/libwebp/webp/decode_vp8.h
@@ -12,7 +12,7 @@
#ifndef WEBP_WEBP_DECODE_VP8_H_
#define WEBP_WEBP_DECODE_VP8_H_
-#include "decode.h"
+#include "webp/decode.h"
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
@@ -83,13 +83,13 @@ struct VP8Io {
};
// Internal, version-checked, entry point
-extern int VP8InitIoInternal(VP8Io* const, int);
+int VP8InitIoInternal(VP8Io* const, int);
// Main decoding object. This is an opaque structure.
typedef struct VP8Decoder VP8Decoder;
// Create a new decoder object.
-VP8Decoder* VP8New();
+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
@@ -105,18 +105,6 @@ int VP8GetHeaders(VP8Decoder* const dec, VP8Io* const io);
// Returns false in case of error.
int VP8Decode(VP8Decoder* const dec, VP8Io* const io);
-// Enumeration of the codes returned by VP8Status()
-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;
-
// Return current status of the decoder:
VP8StatusCode VP8Status(VP8Decoder* const dec);
diff --git a/third_party/libwebp/webp/encode.h b/third_party/libwebp/webp/encode.h
index 8fb8ff4..e0cc5dc 100644
--- a/third_party/libwebp/webp/encode.h
+++ b/third_party/libwebp/webp/encode.h
@@ -14,7 +14,7 @@
#include <stdlib.h>
-#include "../webp/types.h"
+#include "webp/types.h"
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
@@ -22,6 +22,10 @@ extern "C" {
#define WEBP_ENCODER_ABI_VERSION 0x0001
+// Return the encoder's version number, packed in hexadecimal using 8bits for
+// each of major/minor/revision. E.g: v2.5.7 is 0x020507.
+int WebPGetEncoderVersion(void);
+
//-----------------------------------------------------------------------------
// One-stop-shop call! No questions asked: