1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 ffmpeg-full,
6 libaom,
7 meson,
8 nasm,
9 ninja,
10 testers,
11 xxd,
12}:
13
14stdenv.mkDerivation (finalAttrs: {
15 pname = "libvmaf";
16 version = "3.0.0";
17
18 src = fetchFromGitHub {
19 owner = "netflix";
20 repo = "vmaf";
21 rev = "v${finalAttrs.version}";
22 sha256 = "sha256-6mwU2so1YM2pyWkJbDHVl443GgWtQazbBv3gTMBq5NA=";
23 };
24
25 sourceRoot = "${finalAttrs.src.name}/libvmaf";
26
27 nativeBuildInputs = [
28 meson
29 ninja
30 nasm
31 xxd
32 ];
33
34 postPatch = lib.optionalString stdenv.hostPlatform.isFreeBSD ''
35 substituteInPlace meson.build --replace-fail '_XOPEN_SOURCE=600' '_XOPEN_SOURCE=700'
36 '';
37
38 env = lib.optionalAttrs stdenv.hostPlatform.isFreeBSD {
39 NIX_CFLAGS_COMPILE = "-D__BSD_VISIBLE=1";
40 };
41
42 mesonFlags = [ "-Denable_avx512=true" ];
43
44 outputs = [
45 "out"
46 "dev"
47 ];
48 doCheck = false;
49
50 passthru.tests = {
51 inherit libaom ffmpeg-full;
52 version = testers.testVersion {
53 package = finalAttrs.finalPackage;
54 };
55 pkg-config = testers.hasPkgConfigModules {
56 package = finalAttrs.finalPackage;
57 moduleNames = [ "libvmaf" ];
58 };
59 };
60
61 meta = with lib; {
62 description = "Perceptual video quality assessment based on multi-method fusion (VMAF)";
63 homepage = "https://github.com/Netflix/vmaf";
64 changelog = "https://github.com/Netflix/vmaf/blob/v${finalAttrs.version}/CHANGELOG.md";
65 license = licenses.bsd2Patent;
66 maintainers = [ maintainers.cfsmp3 ];
67 mainProgram = "vmaf";
68 platforms = platforms.unix;
69 };
70})