From 02f27fbd3bb2d70be4e491e00575435d0610c451 Mon Sep 17 00:00:00 2001 From: James Zern Date: Fri, 27 Apr 2012 19:20:13 -0700 Subject: [PATCH] dec: remove deprecated WebPINew() Change-Id: I22ad1d297333f5ebc84456d142426a4e0e9a044b --- README | 6 +++++- src/dec/idec.c | 7 ------- src/webp/decode.h | 18 +++++++++--------- 3 files changed, 14 insertions(+), 17 deletions(-) diff --git a/README b/README index 6d62f575..e6b47839 100644 --- a/README +++ b/README @@ -348,7 +348,11 @@ is stored into an instance of the WebPIDecoder object. This object can be created with the purpose of decoding either RGB or Y'CbCr samples. For instance: - WebPIDecoder* idec = WebPINew(MODE_BGR); + WebPDecBuffer buffer; + WebPInitDecBuffer(&buffer); + buffer.colorspace = MODE_BGR; + ... + WebPIDecoder* idec = WebPINewDecoder(&buffer); As data is made progressively available, this incremental-decoder object can be used to decode the picture further. There are two (mutually exclusive) diff --git a/src/dec/idec.c b/src/dec/idec.c index 7ab0878a..0f451339 100644 --- a/src/dec/idec.c +++ b/src/dec/idec.c @@ -587,13 +587,6 @@ void WebPIDelete(WebPIDecoder* const idec) { //------------------------------------------------------------------------------ // Wrapper toward WebPINewDecoder -WebPIDecoder* WebPINew(WEBP_CSP_MODE mode) { - WebPIDecoder* const idec = WebPINewDecoder(NULL); - if (!idec) return NULL; - idec->output_.colorspace = mode; - return idec; -} - WebPIDecoder* WebPINewRGB(WEBP_CSP_MODE mode, uint8_t* output_buffer, size_t output_buffer_size, int output_stride) { WebPIDecoder* idec; diff --git a/src/webp/decode.h b/src/webp/decode.h index 52e5111f..2cd6043d 100644 --- a/src/webp/decode.h +++ b/src/webp/decode.h @@ -185,7 +185,10 @@ typedef enum { // picture is only partially decoded, pending additional input. // Code example: // -// WebPIDecoder* const idec = WebPINew(mode); +// WebPInitDecBuffer(&buffer); +// buffer.colorspace = mode; +// ... +// WebPIDecoder* const idec = WebPINew(&buffer); // while (has_more_data) { // // ... (get additional data) // status = WebPIAppend(idec, new_data, new_data_size); @@ -209,10 +212,6 @@ typedef struct WebPIDecoder WebPIDecoder; // 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 @@ -235,7 +234,7 @@ WEBP_EXTERN(WebPIDecoder*) WebPINewYUV( uint8_t* v, size_t v_size, int v_stride); // Deletes the WebPIDecoder object and associated memory. Must always be called -// if WebPINew, WebPINewRGB or WebPINewYUV succeeded. +// if WebPINewDecoder, WebPINewRGB or WebPINewYUV succeeded. WEBP_EXTERN(void) WebPIDelete(WebPIDecoder* const idec); // Copies and decodes the next available data. Returns VP8_STATUS_OK when @@ -254,9 +253,10 @@ WEBP_EXTERN(VP8StatusCode) WebPIUpdate( // 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. +// specified in WebPINewDecoder()/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);