Blame imageio/webpdec.h

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