2014-04-23 04:30:27 +02:00
|
|
|
// Copyright 2014 Google Inc. All Rights Reserved.
|
|
|
|
//
|
|
|
|
// Use of this source code is governed by a BSD-style license
|
|
|
|
// that can be found in the COPYING file in the root of the source
|
|
|
|
// tree. An additional intellectual property rights grant can be found
|
|
|
|
// in the file PATENTS. All contributing project authors may
|
|
|
|
// be found in the AUTHORS file in the root of the source tree.
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// WebP decode.
|
|
|
|
|
2016-07-20 01:02:55 +02:00
|
|
|
#ifndef WEBP_IMAGEIO_WEBPDEC_H_
|
|
|
|
#define WEBP_IMAGEIO_WEBPDEC_H_
|
2014-04-23 04:30:27 +02:00
|
|
|
|
2016-07-21 03:25:00 +02:00
|
|
|
#include "webp/decode.h"
|
2015-12-08 08:22:41 +01:00
|
|
|
|
2014-04-23 04:30:27 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
struct Metadata;
|
|
|
|
struct WebPPicture;
|
|
|
|
|
2016-07-21 03:25:00 +02:00
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
// WebP decoding
|
|
|
|
|
|
|
|
// Prints an informative error message regarding decode failure of 'in_file'.
|
|
|
|
// 'status' is treated as a VP8StatusCode and if valid will be printed as a
|
|
|
|
// text string.
|
2016-07-22 00:53:23 +02:00
|
|
|
void PrintWebPError(const char* const in_file, int status);
|
2016-07-21 03:25:00 +02:00
|
|
|
|
|
|
|
// Reads a WebP from 'in_file', returning the contents and size in 'data' and
|
|
|
|
// 'data_size'. If not NULL, 'bitstream' is populated using WebPGetFeatures().
|
|
|
|
// Returns true on success.
|
2016-07-22 00:53:23 +02:00
|
|
|
int LoadWebP(const char* const in_file,
|
|
|
|
const uint8_t** data, size_t* data_size,
|
|
|
|
WebPBitstreamFeatures* bitstream);
|
2016-07-21 03:25:00 +02:00
|
|
|
|
|
|
|
// Decodes the WebP contained in 'data'.
|
|
|
|
// 'config' is a structure previously initialized by WebPInitDecoderConfig().
|
2016-12-12 22:01:36 +01:00
|
|
|
// 'config->output' should have the desired colorspace selected.
|
2016-07-21 03:25:00 +02:00
|
|
|
// Returns the decoder status. On success 'config->output' will contain the
|
|
|
|
// decoded picture.
|
2016-07-22 00:53:23 +02:00
|
|
|
VP8StatusCode DecodeWebP(const uint8_t* const data, size_t data_size,
|
2016-12-12 22:01:36 +01:00
|
|
|
WebPDecoderConfig* const config);
|
2016-07-21 03:25:00 +02:00
|
|
|
|
2016-07-22 00:53:23 +02:00
|
|
|
// Same as DecodeWebP(), but using the incremental decoder.
|
|
|
|
VP8StatusCode DecodeWebPIncremental(
|
2016-07-21 03:25:00 +02:00
|
|
|
const uint8_t* const data, size_t data_size,
|
2016-12-12 22:01:36 +01:00
|
|
|
WebPDecoderConfig* const config);
|
2016-07-21 03:25:00 +02:00
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
|
2014-04-23 04:30:27 +02:00
|
|
|
// Reads a WebP from 'in_file', returning the decoded output in 'pic'.
|
2015-10-27 22:54:11 +01:00
|
|
|
// Output is RGBA or YUVA, depending on pic->use_argb value.
|
2015-10-28 10:04:28 +01:00
|
|
|
// If 'keep_alpha' is true and the WebP has an alpha channel, the output is RGBA
|
2015-10-27 22:54:11 +01:00
|
|
|
// or YUVA. Otherwise, alpha channel is dropped and output is RGB or YUV.
|
2014-04-23 04:30:27 +02:00
|
|
|
// Returns true on success.
|
2015-12-08 08:22:41 +01:00
|
|
|
int ReadWebP(const uint8_t* const data, size_t data_size,
|
|
|
|
struct WebPPicture* const pic,
|
2014-04-23 04:30:27 +02:00
|
|
|
int keep_alpha, struct Metadata* const metadata);
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
} // extern "C"
|
|
|
|
#endif
|
|
|
|
|
2016-07-20 01:02:55 +02:00
|
|
|
#endif // WEBP_IMAGEIO_WEBPDEC_H_
|