04fa38e3ff
libyuv could be used to optimize some operations, applications use libavif may slightly benefit from that. A trivial benchmark: (Sample picture is converted with `avifenc pic.png pic.avif`) - without libyuv ``` $ hyperfine --warmup 4 'avifdec pic.avif /tmp/pic.png' Benchmark 1: avifdec pic.avif /tmp/pic.png Time (mean ± σ): 641.4 ms ± 2.5 ms [User: 631.9 ms, System: 9.1 ms] Range (min … max): 637.7 ms … 645.3 ms 10 runs ``` - with libyuv ``` $ hyperfine --warmup 4 './result/bin/avifdec pic.avif /tmp/pic.png' Benchmark 1: ./result/bin/avifdec pic.avif /tmp/pic.png Time (mean ± σ): 627.5 ms ± 4.6 ms [User: 618.0 ms, System: 9.0 ms] Range (min … max): 622.4 ms … 635.9 ms 10 runs ```
63 lines
1.4 KiB
Nix
63 lines
1.4 KiB
Nix
{ lib, stdenv
|
|
, fetchFromGitHub
|
|
, libaom
|
|
, cmake
|
|
, pkg-config
|
|
, zlib
|
|
, libpng
|
|
, libjpeg
|
|
, dav1d
|
|
, libyuv
|
|
}:
|
|
|
|
stdenv.mkDerivation rec {
|
|
pname = "libavif";
|
|
version = "0.10.0";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "AOMediaCodec";
|
|
repo = pname;
|
|
rev = "v${version}";
|
|
sha256 = "sha256-EGu2avkqQXHFX4gKWsVfVdQN99f4J7Hm86C0sAhuP1Y=";
|
|
};
|
|
|
|
# reco: encode libaom slowest but best, decode dav1d fastest
|
|
|
|
cmakeFlags = [
|
|
"-DBUILD_SHARED_LIBS=ON"
|
|
"-DAVIF_CODEC_AOM=ON" # best encoder (slow but small)
|
|
"-DAVIF_CODEC_DAV1D=ON" # best decoder (fast)
|
|
"-DAVIF_CODEC_AOM_DECODE=OFF"
|
|
"-DAVIF_BUILD_APPS=ON"
|
|
];
|
|
|
|
nativeBuildInputs = [
|
|
cmake
|
|
pkg-config
|
|
];
|
|
|
|
buildInputs = [
|
|
libaom
|
|
zlib
|
|
libpng
|
|
libjpeg
|
|
dav1d
|
|
libyuv
|
|
];
|
|
|
|
meta = with lib; {
|
|
description = "C implementation of the AV1 Image File Format";
|
|
longDescription = ''
|
|
Libavif aims to be a friendly, portable C implementation of the
|
|
AV1 Image File Format. It is a work-in-progress, but can already
|
|
encode and decode all AOM supported YUV formats and bit depths
|
|
(with alpha). It also features an encoder and a decoder
|
|
(avifenc/avifdec).
|
|
'';
|
|
homepage = "https://github.com/AOMediaCodec/libavif";
|
|
changelog = "https://github.com/AOMediaCodec/libavif/blob/v${version}/CHANGELOG.md";
|
|
maintainers = with maintainers; [ mkg20001 ];
|
|
platforms = platforms.all;
|
|
license = licenses.bsd2;
|
|
};
|
|
}
|