6#ifdef USE_RUNTIME_IMAGE_JPEG
23 int prepare(
size_t expected_size)
override;
25 void reset()
override;
36 void draw_rgb565(
int x,
int y,
int w,
int h,
const uint8_t *pixels);
46 static int32_t
source_read(JPEGFILE *file, uint8_t *buf, int32_t
len);
Input that a decoder reads itself as it goes, so the whole image never has to be in memory at once.
Class to abstract decoding different image formats.
Image decoder specialization for JPEG images.
RAMUniquePtr< JPEGDEC > jpeg_
About 18 KB of decoder state: PSRAM first, nullptr if out of memory.
int prepare(size_t expected_size) override
int begin_source(DecodeSource *source) override
void draw_rgb565(int x, int y, int w, int h, const uint8_t *pixels)
int start_()
Set up an opened image for decoding. Returns 0, or a DecodeError.
static int32_t source_read(JPEGFILE *file, uint8_t *buf, int32_t len)
int scale_option_() const
The JPEGDEC option for scale_: JPEG_SCALE_HALF, _QUARTER and _EIGHTH are the divisors themselves.
JpegDecoder(RuntimeImage *image)
Construct a new JPEG Decoder object.
bool supports_source() const override
The source is read as the decode needs it, through JPEGDEC's own 2 KB buffer.
int fail_()
The DecodeError for a failed read of the source or JPEGDEC's last error, closing the image.
int get_scale() const
JPEGDEC decodes the image at 1/get_scale() of its size: 1, 2, 4 or 8.
int HOT decode(uint8_t *buffer, size_t size) override
int HOT decode_step() override
Decodes one row of MCUs (8 or 16 pixel rows), or waits part way through one for more of the source.
static int32_t source_seek(JPEGFILE *file, int32_t position)
static void source_close(void *handle)
A dynamic image that can be loaded and decoded at runtime.
std::unique_ptr< T, RAMDeleter< T > > RAMUniquePtr
unique_ptr over RAMAllocator storage
spi_device_handle_t handle