Crates.io | onix |
lib.rs | onix |
version | 0.2.0 |
source | src |
created_at | 2023-10-01 17:47:12.43825 |
updated_at | 2024-07-29 09:28:24.373835 |
description | Decode image files using V4L2 |
homepage | https://linkmauve.fr/dev/onix/ |
repository | https://git.linkmauve.fr/onix.git |
max_upload_size | |
id | 989344 |
size | 179,491 |
Onix is an image format library, which relies on hardware decoders and encoders using the V4L2 API. It currently supports both JPEG and WebP (lossy, opaque, static), and will support AVIF in the future.
I have tested it on AllWinner platforms using the cedrus driver, namely on the A10 (Olimex Lime), A20 (Olimex Lime2) and A64 (Pine64 PinePhone), as well as with the hantro driver on the RockChip RK3568 (ODROID-M1) and RK3588 (Radxa Rock 5B). Additional testing on other platforms which support VP8 or JPEG in hardware would be very welcome, especially on different drivers!
The display-to-drm
examples take a single image and display it for five
seconds in the current TTY if no compositor is running. The
display-to-wayland
example takes the image and displays it using Wayland, if
a compositor is running and supports the wp_viewporter
and
zwp_linux_dmabuf_v1
protocols. The dump-to-file
example outputs to a file
in raw format (including padding if the decoder needs it), and the
jpeg-encoder
example outputs to a compressed file. Future examples will
include how to import into EGL or Vulkan.
SoC | JPEG | WebP |
---|---|---|
Allwinner A10 | Decode (only 4:2:0) | Decode |
Allwinner A20 | Decode (only 4:2:0) | Decode |
Allwinner A64 | Decode | Decode |
Rockchip RK3568 | Encode | Decode broken |
Rockchip RK3588 | Encode | Decode broken |
Clone the repository:
% git clone https://git.linkmauve.fr/onix.git
Build:
% cd onix
% cargo build --release --examples
Then, in a TTY, run:
% target/release/examples/display-to-drm <image.webp>
Or in Wayland:
% target/release/examples/display-to-wayland <image.jpeg>
If you have no display hardware, you can also dump to a file:
% target/release/examples/dump-to-file <image.jpeg> <output.nv12>