chromium/third_party/crabbyavif/src/include/avif/avif.h

#ifndef AVIF_H
#define AVIF_H

#include <cstdarg>
#include <cstddef>
#include <cstdint>
#include <cstdlib>
#include <ostream>
#include <new>

Box;
namespace crabbyavif {
struct avifImage;
struct avifIO;
}


namespace crabbyavif {

constexpr static const uint32_t CRABBY_AVIF_DEFAULT_IMAGE_SIZE_LIMIT =;

constexpr static const uint32_t CRABBY_AVIF_DEFAULT_IMAGE_DIMENSION_LIMIT =;

constexpr static const uint32_t CRABBY_AVIF_DEFAULT_IMAGE_COUNT_LIMIT =;

constexpr static const size_t CRABBY_AVIF_MAX_AV1_LAYER_COUNT =;

constexpr static const int CRABBY_AVIF_TRUE =;

constexpr static const int CRABBY_AVIF_FALSE =;

constexpr static const uint32_t AVIF_STRICT_DISABLED =;

constexpr static const uint32_t AVIF_STRICT_PIXI_REQUIRED =;

constexpr static const uint32_t AVIF_STRICT_CLAP_VALID =;

constexpr static const uint32_t AVIF_STRICT_ALPHA_ISPE_REQUIRED =;

constexpr static const uint32_t AVIF_STRICT_ENABLED =;

constexpr static const size_t CRABBY_AVIF_DIAGNOSTICS_ERROR_BUFFER_SIZE =;

constexpr static const size_t CRABBY_AVIF_PLANE_COUNT_YUV =;

constexpr static const int32_t CRABBY_AVIF_REPETITION_COUNT_INFINITE =;

constexpr static const int32_t CRABBY_AVIF_REPETITION_COUNT_UNKNOWN =;

constexpr static const uint32_t AVIF_TRANSFORM_NONE =;

constexpr static const uint32_t AVIF_TRANSFORM_PASP =;

constexpr static const uint32_t AVIF_TRANSFORM_CLAP =;

constexpr static const uint32_t AVIF_TRANSFORM_IROT =;

constexpr static const uint32_t AVIF_TRANSFORM_IMIR =;

constexpr static const uint32_t AVIF_COLOR_PRIMARIES_BT709 =;

constexpr static const uint32_t AVIF_COLOR_PRIMARIES_IEC61966_2_4 =;

constexpr static const uint32_t AVIF_COLOR_PRIMARIES_BT2100 =;

constexpr static const uint32_t AVIF_COLOR_PRIMARIES_DCI_P3 =;

constexpr static const uint32_t AVIF_TRANSFER_CHARACTERISTICS_SMPTE2084 =;

enum avifChromaDownsampling {};

enum avifChromaSamplePosition {};

enum avifChromaUpsampling {};

enum avifColorPrimaries : uint16_t {};

enum avifRGBFormat {};

enum avifMatrixCoefficients : uint16_t {};

enum avifPixelFormat {};

enum avifProgressiveState {};

enum avifDecoderSource {};

enum avifTransferCharacteristics : uint16_t {};

enum avifRange {};

enum avifChannelIndex {};

enum avifCodecChoice {};

enum avifCodecFlag {};

enum avifHeaderFormat {};

enum avifPlanesFlag {};

enum avifResult {};

struct Decoder;

avifBool;

avifStrictFlags;

struct avifRWData {};

struct ContentLightLevelInformation {};

avifContentLightLevelInformationBox;

avifTransformFlags;

struct PixelAspectRatio {};

avifPixelAspectRatioBox;

struct avifCleanApertureBox {};

struct avifImageRotation {};

struct avifImageMirror {};

struct avifGainMapMetadata {};

struct avifGainMap {};

struct avifImage {};

struct avifImageTiming {};

struct avifIOStats {};

struct avifDiagnostics {};

struct avifDecoderData {};

struct avifDecoder {};

avifIODestroyFunc;

struct avifROData {};

avifIOReadFunc;

avifIOWriteFunc;

struct avifIO {};

struct Extent {};

avifExtent;

avifPlanesFlags;

struct CropRect {};

avifCropRect;

struct avifRGBImage {};

struct avifPixelFormatInfo {};

avifCodecFlags;











extern "C" {

avifDecoder *crabby_avifDecoderCreate();

void crabby_avifDecoderSetIO(avifDecoder *decoder, avifIO *io);

avifResult crabby_avifDecoderSetIOFile(avifDecoder *decoder, const char *filename);

avifResult crabby_avifDecoderSetIOMemory(avifDecoder *decoder, const uint8_t *data, size_t size);

avifResult crabby_avifDecoderSetSource(avifDecoder *decoder, avifDecoderSource source);

avifResult crabby_avifDecoderParse(avifDecoder *decoder);

avifResult crabby_avifDecoderNextImage(avifDecoder *decoder);

avifResult crabby_avifDecoderNthImage(avifDecoder *decoder, uint32_t frameIndex);

avifResult crabby_avifDecoderNthImageTiming(const avifDecoder *decoder,
                                            uint32_t frameIndex,
                                            avifImageTiming *outTiming);

void crabby_avifDecoderDestroy(avifDecoder *decoder);

avifResult crabby_avifDecoderRead(avifDecoder *decoder, avifImage *image);

avifResult crabby_avifDecoderReadMemory(avifDecoder *decoder,
                                        avifImage *image,
                                        const uint8_t *data,
                                        size_t size);

avifResult crabby_avifDecoderReadFile(avifDecoder *decoder, avifImage *image, const char *filename);

avifBool crabby_avifDecoderIsKeyframe(const avifDecoder *decoder, uint32_t frameIndex);

uint32_t crabby_avifDecoderNearestKeyframe(const avifDecoder *decoder, uint32_t frameIndex);

uint32_t crabby_avifDecoderDecodedRowCount(const avifDecoder *decoder);

avifResult crabby_avifDecoderNthImageMaxExtent(const avifDecoder *decoder,
                                               uint32_t frameIndex,
                                               avifExtent *outExtent);

avifBool crabby_avifPeekCompatibleFileType(const avifROData *input);

avifImage *crabby_avifImageCreateEmpty();

avifImage *crabby_avifImageCreate(uint32_t width,
                                  uint32_t height,
                                  uint32_t depth,
                                  avifPixelFormat yuvFormat);

avifResult crabby_avifImageAllocatePlanes(avifImage *image, avifPlanesFlags planes);

void crabby_avifImageFreePlanes(avifImage *image, avifPlanesFlags planes);

void crabby_avifImageDestroy(avifImage *image);

avifBool crabby_avifImageUsesU16(const avifImage *image);

avifBool crabby_avifImageIsOpaque(const avifImage *image);

uint8_t *crabby_avifImagePlane(const avifImage *image, int channel);

uint32_t crabby_avifImagePlaneRowBytes(const avifImage *image, int channel);

uint32_t crabby_avifImagePlaneWidth(const avifImage *image, int channel);

uint32_t crabby_avifImagePlaneHeight(const avifImage *image, int channel);

avifResult crabby_avifImageSetViewRect(avifImage *dstImage,
                                       const avifImage *srcImage,
                                       const avifCropRect *rect);

avifResult crabby_avifRWDataRealloc(avifRWData *raw, size_t newSize);

avifResult crabby_avifRWDataSet(avifRWData *raw, const uint8_t *data, size_t size);

void crabby_avifRWDataFree(avifRWData *raw);

void cioDestroy(avifIO *_io);

avifResult cioRead(avifIO *io, uint32_t _readFlags, uint64_t offset, size_t size, avifROData *out);

avifResult cioWrite(avifIO *_io,
                    uint32_t _writeFlags,
                    uint64_t _offset,
                    const uint8_t *_data,
                    size_t _size);

avifIO *crabby_avifIOCreateMemoryReader(const uint8_t *data, size_t size);

avifIO *crabby_avifIOCreateFileReader(const char *filename);

void crabby_avifIODestroy(avifIO *io);

void crabby_avifRGBImageSetDefaults(avifRGBImage *rgb, const avifImage *image);

avifResult crabby_avifImageYUVToRGB(const avifImage *image, avifRGBImage *rgb);

const char *crabby_avifResultToString(avifResult _res);

avifBool crabby_avifCropRectConvertCleanApertureBox(avifCropRect *cropRect,
                                                    const avifCleanApertureBox *clap,
                                                    uint32_t imageW,
                                                    uint32_t imageH,
                                                    avifPixelFormat yuvFormat,
                                                    avifDiagnostics *_diag);

void crabby_avifGetPixelFormatInfo(avifPixelFormat format, avifPixelFormatInfo *info);

void crabby_avifDiagnosticsClearError(avifDiagnostics *diag);

void *crabby_avifAlloc(size_t size);

void crabby_avifFree(void *p);

} // extern "C"

} // namespace crabbyavif

#endif // AVIF_H