gecko-dev/image/decoders/nsAVIFDecoder.h
Jon Bauman 2db43533f3 Bug 1625363 - AVIF (AV1 Image File Format): experimental support. r=aosmond,necko-reviewers,valentin
There are many limitations currently, but this prototype should successfully
render most basic AVIF images. Known limitations:

- No support for any derived image items (crop, rotate, etc.)
- No support for alpha planes
- No support for ICC profiles (bug 1634741)
- The primary image item must be an av01 (no grid support)
- HDR images aren't tone-mapped

Differential Revision: https://phabricator.services.mozilla.com/D68498
2020-05-01 22:56:04 +00:00

52 lines
1.4 KiB
C++

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_image_decoders_nsAVIFDecoder_h
#define mozilla_image_decoders_nsAVIFDecoder_h
#include "Decoder.h"
#include "mp4parse.h"
#include "SurfacePipe.h"
#include "aom/aom_decoder.h"
namespace mozilla {
namespace image {
class RasterImage;
class nsAVIFDecoder final : public Decoder {
public:
virtual ~nsAVIFDecoder();
DecoderType GetType() const override { return DecoderType::AVIF; }
protected:
LexerResult DoDecode(SourceBufferIterator& aIterator,
IResumable* aOnResume) override;
private:
friend class DecoderFactory;
// Decoders should only be instantiated via DecoderFactory.
explicit nsAVIFDecoder(RasterImage* aImage);
static intptr_t read_source(uint8_t* aDestBuf, uintptr_t aDestBufSize,
void* aUserData);
Mp4parseAvifParser* mParser;
Maybe<aom_codec_ctx_t> mCodecContext;
Vector<uint8_t> mBufferedData;
/// Pointer to the next place to read from mBufferedData
const uint8_t* mReadCursor = nullptr;
};
} // namespace image
} // namespace mozilla
#endif // mozilla_image_decoders_nsAVIFDecoder_h