-
-
Notifications
You must be signed in to change notification settings - Fork 676
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hardware JPEG decoder #4576
base: main
Are you sure you want to change the base?
Hardware JPEG decoder #4576
Conversation
|
Can you post the results of the benchmark? I.e. how much faster is it than SW decoding on the same chip? Also are there any limitations of the HW decoder when compared to SW encoding? |
For 380×520 color images, software decoding takes approximately 600 ms, while hardware decoding takes about 10 ms (both include YCbCr to RGB conversion and display presentation). According to the STM datasheet, the hardware decoder should comply with the JPEG standard and parse all standard JPEG headers. Unfortunately, it cannot decode progressive JPEGs (though the same applies to the software decoder we currently use). One current limitation of the hardware decoder, compared to the software decoder we use, is that it cannot scale JPEG images. As a result, we cannot display a small preview of the uploaded image. However, this is not a problem if we slightly change the UI. |
852b6d6
to
b565601
Compare
we should be able to scale the image while streaming it -- unless the jpeg decoder is barfing pixels directly into the framebuffer? |
Yes, it would definitely be possible - and it wouldn’t be too slow if we simply skipped pixels and used (1/2, 1/4, …) scaling as before. However, it would still be much slower than just copying with DMA2D. You also have to consider that the image quality wouldn’t be perfect for some images due to aliasing. |
[no changelog]
[no changelog]
[no changelog]
4019044
to
86c2993
Compare
[no changelog]
This PR implements a hardware JPEG decoder for T3W1.
gfx/jpegdec
module that wraps the STM32 hardware JPEG decoder.trezorhal/jpegdec.rs
module that provides the JpegDecoder API for Rust.shape::JpegImage
to support the hardware jpeg decoder.hw_jpeg_decoder
andui_jpeg
- which replacejpeg
andui_jpeg_decoder
.JpegImage
shape limitations on T3W1:The simulator is still using the original JPEG decoder implemented in Rust.
All other models (except T3W1) should not be affected by this PR.