onix

Crates.ioonix
lib.rsonix
version0.2.0
sourcesrc
created_at2023-10-01 17:47:12.43825
updated_at2024-07-29 09:28:24.373835
descriptionDecode image files using V4L2
homepagehttps://linkmauve.fr/dev/onix/
repositoryhttps://git.linkmauve.fr/onix.git
max_upload_size
id989344
size179,491
(linkmauve)

documentation

README

Onix

crates.io docs.rs License Join the XMPP chat at onix@muc.linkmauve.fr

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.

Format support, by SoC

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

How to use

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>
Commit count: 0

cargo fmt