Repository navigation
Releases
1.8.4-esphome.4
JPEGDEC 1.8.4 plus the changes ESPHome needs.
Added
- Decode progressive images in full at every scale, in one call or in steps as their input arrives (#2). Before, only the first scan was drawn, at 1/8 size. A buffer for the DCT coefficients is allocated by
decodeBegin(): 3 bytes per pixel for 4:2:0 colour, less at 1/4 and 1/8 scale. If it cannot be allocated, each block is drawn in one colour, without an error. On ESP32 it goes in PSRAM when possible. - Decode 8-bit extended sequential (SOF1) images, with up to 3 DC and 3 AC Huffman tables numbered 0-3 (#2). A third table of either kind takes 4.8 KB, allocated only for images that use one.
- Run the tests in GitHub Actions with GCC, Clang and AddressSanitizer (#3).
Fixed
- Fix wrong pixels from the AC bit refill in baseline images (#2).
- Refuse frames with too many components rather than overwriting memory (#2).
- Fix quarter-scale RGB8888 output of 4:4:0 images (#2).
- Clip MCUs at the edge of a framebuffer: output whose width is not a multiple of the MCU width was wrong, and the last row could overrun the framebuffer (#1, bitbank2#131).
- Fix the SSE marker filter's mask, which failed on x86_64 builds made with clang (#1).
- Start a dither's errors at zero, so the output no longer depends on what the file held before it (#2).
- Refuse rows too wide to dither, which overwrote memory and crashed (#2).
- Close a file opened by name when the image is bad, on reopen and in the destructor;
close()can be called more than once (#2).
Behaviour changes
- A
JPEGDECmust be made by its constructor, notmalloc()alone, asopen()frees what the object holds. It cannot be copied. - With the C API, call
JPEG_close()before reopening aJPEGIMAGE, or its buffers leak. AJPEGIMAGEneed not be cleared before it is opened. - Read and seek callbacks must keep
iPosof theJPEGFILEup to date. A progressive image finds where its input ends by comparing it withiSize. - Now refused: sampling with no MCU layout, baseline colour images whose chroma is not 1x1, 12-bit progressive images, a bad first scan header, sequential images with a scan per component, and a scan using an undefined Huffman table.
decodeDither()fails withJPEG_INVALID_PARAMETERwhen a row of MCUs at the scale asked for is over 4088 pixels wide, or 2040 withJPEG_USES_DMA. Dithered output also differs slightly from before.- An image is decoded once per
open(). A seconddecode()ordecodeBegin()fails withJPEG_INVALID_PARAMETER. - During the scans of a progressive image,
decodeRows()returns without calling the draw callback, and a singledecode()does not call it until they are done.
Known
- ESPHome still refuses progressive images. Using them needs a change there as well as this release.
JPEGDisplayhas only been tested against stub classes, not on hardware. File-based decoding has not been tested with a real SD card.- Dither errors are kept in the framebuffer when one is set, so they do not start at zero there.
Checked on an ESP32-S3 at 800x480, before the last dither and iPos fixes: baseline decode 130 ms and progressive 383 ms.
1.8.4-esphome.3
JPEGDEC 1.8.4 plus the changes ESPHome needs. Pull requests for these are open or proposed upstream.
- Add
decodeBegin()/decodeRows()to decode a few MCU rows at a time. - Add
JPEG_DECODE_NEED_DATA, so a decode can pause for input that has not arrived. - Fix filter faults on short reads: zero-length
JPEGFilter, SIMD over-read, overlappingmemcpy. - Fix a wild pointer for skipped blocks in progressive images (bitbank2#127).
- Fix RGB8888 output for grayscale images (bitbank2#128).
- Fix cropping, especially with scaling (bitbank2#129).
- Fix swapped red and blue in the NEON 4:2:0 RGB8888 path (bitbank2#121).
- Use the ESP32-S3 SIMD colour conversion in ESP-IDF builds too, not only Arduino ones. Checked on an ESP32-S3: within 2 levels of the C code for RGB8888 output and 4 for RGB565; full-size decodes 12-19% faster.
- Build the library with
-O2(library.jsonbuild.flags). ESP-IDF builds default to-Os; JPEG decodes are 3-5% faster on an ESP32-S3. - Include upstream
81aa9f6(NEON clipped-MCU overwrite) and8628297(skip AC Huffman tables for progressive images).
Known: framebuffer output is wrong for widths that are not a multiple of the MCU width (bitbank2#131).
1.8.4-esphome.2
JPEGDEC 1.8.4 plus the changes ESPHome needs. Pull requests for these are open or proposed upstream.
- Add
decodeBegin()/decodeRows()to decode a few MCU rows at a time. - Add
JPEG_DECODE_NEED_DATA, so a decode can pause for input that has not arrived. - Fix filter faults on short reads: zero-length
JPEGFilter, SIMD over-read, overlappingmemcpy. - Fix a wild pointer for skipped blocks in progressive images (bitbank2#127).
- Fix RGB8888 output for grayscale images (bitbank2#128).
- Fix cropping, especially with scaling (bitbank2#129).
- Fix swapped red and blue in the NEON 4:2:0 RGB8888 path (bitbank2#121).
- Use the ESP32-S3 SIMD colour conversion in ESP-IDF builds too, not only Arduino ones. Checked on an ESP32-S3: within 2 levels of the C code for RGB8888 output and 4 for RGB565; full-size decodes 12-19% faster.
- Include upstream
81aa9f6(NEON clipped-MCU overwrite) and8628297(skip AC Huffman tables for progressive images).
Known: framebuffer output is wrong for widths that are not a multiple of the MCU width (bitbank2#131).
1.8.4-esphome.1
JPEGDEC 1.8.4 plus the changes ESPHome needs. Pull requests for these are open or proposed upstream.
- Add
decodeBegin()/decodeRows()to decode a few MCU rows at a time. - Add
JPEG_DECODE_NEED_DATA, so a decode can pause for input that has not arrived. - Fix filter faults on short reads: zero-length
JPEGFilter, SIMD over-read, overlappingmemcpy. - Fix a wild pointer for skipped blocks in progressive images (bitbank2#127).
- Fix RGB8888 output for grayscale images (bitbank2#128).
- Fix cropping, especially with scaling (bitbank2#129).
- Fix swapped red and blue in the NEON 4:2:0 RGB8888 path (bitbank2#121).
- Include upstream
81aa9f6(NEON clipped-MCU overwrite) and8628297(skip AC Huffman tables for progressive images).
Known: framebuffer output is wrong for widths that are not a multiple of the MCU width (bitbank2#131).