Image decoder specialization for JPEG images.
More...
#include <jpeg_decoder.h>
|
| | JpegDecoder (RuntimeImage *image) |
| | Construct a new JPEG Decoder object.
|
| |
| int | prepare (size_t expected_size) override |
| |
| int HOT | decode (uint8_t *buffer, size_t size) override |
| |
| void | reset () override |
| |
| bool | supports_source () const override |
| | The source is read as the decode needs it, through JPEGDEC's own 2 KB buffer.
|
| |
| int | begin_source (DecodeSource *source) 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.
|
| |
| int | get_scale () const |
| | JPEGDEC decodes the image at 1/get_scale() of its size: 1, 2, 4 or 8.
|
| |
| void | draw_rgb565 (int x, int y, int w, int h, const uint8_t *pixels) |
| |
| | ImageDecoder (RuntimeImage *image, ImageFormat format) |
| | Construct a new Image Decoder object.
|
| |
| virtual | ~ImageDecoder ()=default |
| |
| ImageFormat | get_format () const |
| | Get the image format handled by this decoder.
|
| |
| bool | is_active () const |
| | Check if a decoding session is in progress (prepare() called, reset() not yet).
|
| |
| bool | set_size (int width, int height) |
| | Request the image to be resized once the actual dimensions are known.
|
| |
| void | draw (int x, int y, int w, int h, const Color &color) |
| | Fill a rectangle on the display_buffer using the defined color.
|
| |
| size_t | get_decoded_bytes () const |
| | Bytes of the image the decoder has used so far.
|
| |
| virtual bool | is_finished () const |
| | Check if the decoder has finished processing.
|
| |
| virtual bool | knows_end () const |
| | Whether is_finished() can tell a complete image from a cut-off one.
|
| |
| bool | uses_direct_rgb565 () const |
| | The image is opaque RGB565, so draw() writes it straight into the buffer.
|
| |
|
| int | start_ () |
| | Set up an opened image for decoding. Returns 0, or a DecodeError.
|
| |
| int | scale_option_ () const |
| | The JPEGDEC option for scale_: JPEG_SCALE_HALF, _QUARTER and _EIGHTH are the divisors themselves.
|
| |
| int | fail_ () |
| | The DecodeError for a failed read of the source or JPEGDEC's last error, closing the image.
|
| |
| bool | resize_image_ (int width, int height) |
| | Resize the image for a width x height source, without preparing to draw. prepare_draw_() must follow.
|
| |
| void | prepare_draw_ (int width, int height) |
| | Draw a source of width x height over the whole buffer from now on.
|
| |
| void | draw_rgb565_ (int x, int y, int w, int h, uint16_t rgb565) |
| | Paint a block of source pixels in one color straight into the buffer. Only while uses_direct_rgb565().
|
| |
| uint8_t * | image_buffer_ () const |
| | The image's pixel buffer, for decoders that write their output straight into it.
|
| |
| bool | image_is_big_endian_ () const |
| |
Image decoder specialization for JPEG images.
Definition at line 14 of file jpeg_decoder.h.
◆ JpegDecoder()
| esphome::runtime_image::JpegDecoder::JpegDecoder |
( |
RuntimeImage * | image | ) |
|
Construct a new JPEG Decoder object.
- Parameters
-
Definition at line 101 of file jpeg_decoder.cpp.
◆ begin_source()
| int esphome::runtime_image::JpegDecoder::begin_source |
( |
DecodeSource * | source | ) |
|
|
overridevirtual |
◆ decode()
| int HOT esphome::runtime_image::JpegDecoder::decode |
( |
uint8_t * | buffer, |
|
|
size_t | size ) |
|
overridevirtual |
◆ decode_step()
| int HOT esphome::runtime_image::JpegDecoder::decode_step |
( |
| ) |
|
|
overridevirtual |
Decodes one row of MCUs (8 or 16 pixel rows), or waits part way through one for more of the source.
A progressive image is decoded one row of one scan per step, and drawn in the steps after its last scan.
Reimplemented from esphome::runtime_image::ImageDecoder.
Definition at line 280 of file jpeg_decoder.cpp.
◆ draw_rgb565()
| void esphome::runtime_image::JpegDecoder::draw_rgb565 |
( |
int | x, |
|
|
int | y, |
|
|
int | w, |
|
|
int | h, |
|
|
const uint8_t * | pixels ) |
◆ fail_()
| int esphome::runtime_image::JpegDecoder::fail_ |
( |
| ) |
|
|
protected |
The DecodeError for a failed read of the source or JPEGDEC's last error, closing the image.
Definition at line 193 of file jpeg_decoder.cpp.
◆ get_scale()
| int esphome::runtime_image::JpegDecoder::get_scale |
( |
| ) |
const |
|
inline |
JPEGDEC decodes the image at 1/get_scale() of its size: 1, 2, 4 or 8.
Definition at line 35 of file jpeg_decoder.h.
◆ prepare()
| int esphome::runtime_image::JpegDecoder::prepare |
( |
size_t | expected_size | ) |
|
|
overridevirtual |
◆ reset()
| void esphome::runtime_image::JpegDecoder::reset |
( |
| ) |
|
|
overridevirtual |
◆ scale_option_()
| int esphome::runtime_image::JpegDecoder::scale_option_ |
( |
| ) |
const |
|
inlineprotected |
The JPEGDEC option for scale_: JPEG_SCALE_HALF, _QUARTER and _EIGHTH are the divisors themselves.
Definition at line 42 of file jpeg_decoder.h.
◆ source_close()
| static void esphome::runtime_image::JpegDecoder::source_close |
( |
void * | handle | ) |
|
|
inlinestaticprotected |
◆ source_read()
| int32_t esphome::runtime_image::JpegDecoder::source_read |
( |
JPEGFILE * | file, |
|
|
uint8_t * | buf, |
|
|
int32_t | len ) |
|
staticprotected |
◆ source_seek()
| int32_t esphome::runtime_image::JpegDecoder::source_seek |
( |
JPEGFILE * | file, |
|
|
int32_t | position ) |
|
staticprotected |
◆ start_()
| int esphome::runtime_image::JpegDecoder::start_ |
( |
| ) |
|
|
protected |
Set up an opened image for decoding. Returns 0, or a DecodeError.
Definition at line 152 of file jpeg_decoder.cpp.
◆ supports_source()
| bool esphome::runtime_image::JpegDecoder::supports_source |
( |
| ) |
const |
|
inlineoverridevirtual |
◆ jpeg_
| RAMUniquePtr<JPEGDEC> esphome::runtime_image::JpegDecoder::jpeg_ |
|
protected |
About 18 KB of decoder state: PSRAM first, nullptr if out of memory.
Definition at line 51 of file jpeg_decoder.h.
◆ scale_
| int esphome::runtime_image::JpegDecoder::scale_ {1} |
|
protected |
◆ source_
| DecodeSource* esphome::runtime_image::JpegDecoder::source_ {nullptr} |
|
protected |
◆ source_failed_
| bool esphome::runtime_image::JpegDecoder::source_failed_ {false} |
|
protected |
The documentation for this class was generated from the following files: