2 unstable releases
0.2.0 | Jul 29, 2024 |
---|---|
0.1.0 | Oct 1, 2023 |
#208 in Unix APIs
67 downloads per month
135KB
3.5K
SLoC
Onix
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>
Dependencies
~1.6–9.5MB
~114K SLoC