commit: 7508d43375d83dd388006cc627705bad2df14ee8
parent a1cc2076f07c3357a42d2ca70bb27001ee3a841e
Author: Michael Forney <mforney@mforney.org>
Date: Tue, 18 Aug 2020 20:30:32 -0700
Add dav1d 0.7.1
Diffstat:
7 files changed, 310 insertions(+), 0 deletions(-)
diff --git a/.gitmodules b/.gitmodules
@@ -43,6 +43,10 @@
[submodule "pkg/cproc/src"]
path = pkg/cproc/src
url = https://git.sr.ht/~mcf/cproc
+[submodule "pkg/dav1d/src"]
+ path = pkg/dav1d/src
+ url = https://github.com/videolan/dav1d.git
+ ignore = all
[submodule "pkg/dmenu/src"]
path = pkg/dmenu/src
url = git://git.suckless.org/dmenu
diff --git a/pkg/dav1d/config.h b/pkg/dav1d/config.h
@@ -0,0 +1,19 @@
+#define ARCH_AARCH64 0
+#define ARCH_ARM 0
+#define ARCH_PPC64LE 0
+#ifdef __x86_64__
+#define ARCH_X86 1
+#define ARCH_X86_32 0
+#define ARCH_X86_64 1
+#endif
+#define CONFIG_16BPC 1
+#define CONFIG_8BPC 1
+#define CONFIG_LOG 1
+#define ENDIANNESS_BIG 0
+#define HAVE_ASM 1
+#define HAVE_AVX512ICL 1
+#define HAVE_CLOCK_GETTIME 1
+#define HAVE_DLSYM 1
+#define HAVE_POSIX_MEMALIGN 1
+#define HAVE_UNISTD_H 1
+#define STACK_ALIGNMENT 16
diff --git a/pkg/dav1d/gen.lua b/pkg/dav1d/gen.lua
@@ -0,0 +1,143 @@
+cflags{
+ '-Wall', '-Wno-maybe-uninitialized',
+ '-I $srcdir',
+ '-I $srcdir/include',
+ '-I $srcdir/tools',
+ '-I $outdir',
+ '-I $outdir/include/dav1d',
+ '-I $dir',
+}
+nasmflags{
+ '-i $srcdir/src/',
+ '-i $outdir/',
+ '-f elf64',
+}
+
+pkg.hdrs = {
+ copy('$outdir/include/dav1d', '$srcdir/include/dav1d', {
+ 'common.h',
+ 'data.h',
+ 'dav1d.h',
+ 'headers.h',
+ 'picture.h',
+ }),
+ '$outdir/include/dav1d/version.h',
+}
+pkg.deps = {
+ '$gendir/headers',
+ '$outdir/cli_config.h',
+ '$outdir/vcs_version.h',
+ '$outdir/config.asm',
+}
+
+build('sed', '$outdir/include/dav1d/version.h', '$srcdir/include/dav1d/version.h.in', {
+ expr={
+ '-e s,@DAV1D_API_VERSION_MAJOR@,4,',
+ '-e s,@DAV1D_API_VERSION_MINOR@,0,',
+ '-e s,@DAV1D_API_VERSION_PATCH@,2,',
+ },
+})
+build('awk', '$outdir/vcs_version.h', '$dir/ver', {
+ expr=[['{printf "#define DAV1D_VERSION \"%s\"\n", $$1}']],
+})
+build('awk', '$outdir/config.asm', '$dir/config.h', {
+ expr=[['$$1 == "#define" {print "%define " substr($$0, length("#define ") + 1)}']],
+})
+build('touch', '$outdir/cli_config.h')
+
+local srcs = paths[[
+ src/(
+ cdf.c
+ cpu.c
+ data.c
+ decode.c
+ dequant_tables.c
+ getbits.c
+ intra_edge.c
+ itx_1d.c
+ lf_mask.c
+ log.c
+ msac.c
+ obu.c
+ picture.c
+ qm.c
+ ref.c
+ refmvs.c
+ scan.c
+ tables.c
+ warpmv.c
+ wedge.c
+
+ lib.c
+ thread_task.c
+
+ @x86_64 x86/(
+ cpu.c msac_init.c
+ cpuid.asm msac.asm
+
+ cdef_avx512.asm
+ cdef_avx2.asm
+ film_grain.asm
+ ipred.asm
+ itx.asm
+ loopfilter.asm
+ looprestoration.asm
+ mc.asm
+ cdef_sse.asm
+ film_grain_ssse3.asm
+ ipred_ssse3.asm
+ itx_ssse3.asm
+ loopfilter_ssse3.asm
+ looprestoration_ssse3.asm
+ mc_sse.asm
+ )
+ )
+]]
+
+local tmpl = paths[[
+ cdef_apply_tmpl.c
+ cdef_tmpl.c
+ fg_apply_tmpl.c
+ film_grain_tmpl.c
+ ipred_prepare_tmpl.c
+ ipred_tmpl.c
+ itx_tmpl.c
+ lf_apply_tmpl.c
+ loopfilter_tmpl.c
+ looprestoration_tmpl.c
+ lr_apply_tmpl.c
+ mc_tmpl.c
+ recon_tmpl.c
+
+ @x86_64 x86/(
+ cdef_init_tmpl.c
+ film_grain_init_tmpl.c
+ ipred_init_tmpl.c
+ itx_init_tmpl.c
+ loopfilter_init_tmpl.c
+ looprestoration_init_tmpl.c
+ mc_init_tmpl.c
+ )
+]]
+for _, bit in ipairs{'8', '16'} do
+ for _, src in ipairs(tmpl) do
+ local obj = ('$outdir/%s/%s.o'):format(bit, src)
+ build('cc', obj, '$srcdir/src/'..src, {cflags='$cflags -D BITDEPTH='..bit})
+ table.insert(srcs, obj)
+ end
+end
+
+lib('libdav1d.a', srcs)
+
+exe('dav1d', [[
+ tools/(
+ dav1d.c
+ dav1d_cli_parse.c
+ input/(input.c annexb.c ivf.c section5.c)
+ output/(md5.c null.c output.c y4m2.c yuv.c)
+ )
+ libdav1d.a
+]])
+file('bin/dav1d', '755', '$outdir/dav1d')
+
+fetch 'git'
diff --git a/pkg/dav1d/patch/0001-Fix-compilation-with-nasm-2.15.patch b/pkg/dav1d/patch/0001-Fix-compilation-with-nasm-2.15.patch
@@ -0,0 +1,141 @@
+From 22bfed7225c79dfedf08fe6d5ce8a6febe51300c Mon Sep 17 00:00:00 2001
+From: Henrik Gramner <gramner@twoorioles.com>
+Date: Tue, 30 Jun 2020 23:33:27 +0200
+Subject: [PATCH] Fix compilation with nasm 2.15
+
+%{:} macro operand ranges were broken in nasm 2.15 which causes
+errors when compiling, so avoid using those for now.
+
+Some new warnings regarding use of empty macro parameters has also
+been added, adjust some x86inc code to silence those.
+---
+ src/ext/x86/x86inc.asm | 46 +++++++++++++++++++++++++++---------------
+ src/x86/mc_sse.asm | 6 +-----
+ 2 files changed, 31 insertions(+), 21 deletions(-)
+
+diff --git a/src/ext/x86/x86inc.asm b/src/ext/x86/x86inc.asm
+index c252e54..8d3767c 100644
+--- a/src/ext/x86/x86inc.asm
++++ b/src/ext/x86/x86inc.asm
+@@ -425,16 +425,6 @@ DECLARE_REG_TMP_SIZE 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14
+ %endif
+ %endmacro
+
+-%macro DEFINE_ARGS_INTERNAL 3+
+- %ifnum %2
+- DEFINE_ARGS %3
+- %elif %1 == 4
+- DEFINE_ARGS %2
+- %elif %1 > 4
+- DEFINE_ARGS %2, %3
+- %endif
+-%endmacro
+-
+ %if WIN64 ; Windows x64 ;=================================================
+
+ DECLARE_REG 0, rcx
+@@ -453,7 +443,7 @@ DECLARE_REG 12, R15, 104
+ DECLARE_REG 13, R12, 112
+ DECLARE_REG 14, R13, 120
+
+-%macro PROLOGUE 2-5+ 0 ; #args, #regs, #xmm_regs, [stack_size,] arg_names...
++%macro PROLOGUE 2-5+ 0, 0 ; #args, #regs, #xmm_regs, [stack_size,] arg_names...
+ %assign num_args %1
+ %assign regs_used %2
+ ASSERT regs_used >= num_args
+@@ -465,7 +455,15 @@ DECLARE_REG 14, R13, 120
+ WIN64_SPILL_XMM %3
+ %endif
+ LOAD_IF_USED 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
+- DEFINE_ARGS_INTERNAL %0, %4, %5
++ %if %0 > 4
++ %ifnum %4
++ DEFINE_ARGS %5
++ %else
++ DEFINE_ARGS %4, %5
++ %endif
++ %elifnnum %4
++ DEFINE_ARGS %4
++ %endif
+ %endmacro
+
+ %macro WIN64_PUSH_XMM 0
+@@ -561,7 +559,7 @@ DECLARE_REG 12, R15, 56
+ DECLARE_REG 13, R12, 64
+ DECLARE_REG 14, R13, 72
+
+-%macro PROLOGUE 2-5+ 0 ; #args, #regs, #xmm_regs, [stack_size,] arg_names...
++%macro PROLOGUE 2-5+ 0, 0 ; #args, #regs, #xmm_regs, [stack_size,] arg_names...
+ %assign num_args %1
+ %assign regs_used %2
+ %assign xmm_regs_used %3
+@@ -571,7 +569,15 @@ DECLARE_REG 14, R13, 72
+ PUSH_IF_USED 9, 10, 11, 12, 13, 14
+ ALLOC_STACK %4
+ LOAD_IF_USED 6, 7, 8, 9, 10, 11, 12, 13, 14
+- DEFINE_ARGS_INTERNAL %0, %4, %5
++ %if %0 > 4
++ %ifnum %4
++ DEFINE_ARGS %5
++ %else
++ DEFINE_ARGS %4, %5
++ %endif
++ %elifnnum %4
++ DEFINE_ARGS %4
++ %endif
+ %endmacro
+
+ %define has_epilogue regs_used > 9 || stack_size > 0 || vzeroupper_required
+@@ -612,7 +618,7 @@ DECLARE_REG 6, ebp, 28
+
+ DECLARE_ARG 7, 8, 9, 10, 11, 12, 13, 14
+
+-%macro PROLOGUE 2-5+ ; #args, #regs, #xmm_regs, [stack_size,] arg_names...
++%macro PROLOGUE 2-5+ 0, 0 ; #args, #regs, #xmm_regs, [stack_size,] arg_names...
+ %assign num_args %1
+ %assign regs_used %2
+ ASSERT regs_used >= num_args
+@@ -627,7 +633,15 @@ DECLARE_ARG 7, 8, 9, 10, 11, 12, 13, 14
+ PUSH_IF_USED 3, 4, 5, 6
+ ALLOC_STACK %4
+ LOAD_IF_USED 0, 1, 2, 3, 4, 5, 6
+- DEFINE_ARGS_INTERNAL %0, %4, %5
++ %if %0 > 4
++ %ifnum %4
++ DEFINE_ARGS %5
++ %else
++ DEFINE_ARGS %4, %5
++ %endif
++ %elifnnum %4
++ DEFINE_ARGS %4
++ %endif
+ %endmacro
+
+ %define has_epilogue regs_used > 3 || stack_size > 0 || vzeroupper_required
+diff --git a/src/x86/mc_sse.asm b/src/x86/mc_sse.asm
+index d98ac62..1fc7ae2 100644
+--- a/src/x86/mc_sse.asm
++++ b/src/x86/mc_sse.asm
+@@ -2740,7 +2740,7 @@ cglobal put_8tap, 1, 9, 0, dst, ds, src, ss, w, h, mx, my, ss3
+ %endif
+ %endmacro
+
+-%macro PREP_8TAP_HV_LOAD 4 ; dst0, src_memloc, tmp[1-2]
++%macro PREP_8TAP_HV 4 ; dst, src_memloc, tmp[1-2]
+ %if cpuflag(ssse3)
+ movu %1, [%2]
+ pshufb m2, %1, shufB
+@@ -2751,10 +2751,6 @@ cglobal put_8tap, 1, 9, 0, dst, ds, src, ss, w, h, mx, my, ss3
+ PREP_8TAP_H_LOAD4 m2, %2+4, m1, %3, %4
+ PREP_8TAP_H_LOAD4 m3, %2+8, m1, %3, %4
+ %endif
+-%endmacro
+-
+-%macro PREP_8TAP_HV 4 ; dst, src_memloc, tmp[1-2]
+- PREP_8TAP_HV_LOAD %{1:4}
+ mova m1, m2
+ PMADDUBSW m1, subpelh0, %3, %4, 1 ; subpel +0 C0
+ PMADDUBSW m3, subpelh1, %3, %4, 0 ; subpel +4 B4
+--
+2.28.0
+
diff --git a/pkg/dav1d/src b/pkg/dav1d/src
@@ -0,0 +1 @@
+Subproject commit e9df70c4348a3f9ba7269feacd17cfb57bf23852
diff --git a/pkg/dav1d/ver b/pkg/dav1d/ver
@@ -0,0 +1 @@
+0.7.1 r0
diff --git a/pkg/gen.lua b/pkg/gen.lua
@@ -17,6 +17,7 @@ subgen 'catgirl'
subgen 'cmark'
subgen 'cproc'
subgen 'curl'
+subgen 'dav1d'
subgen 'dosfstools'
subgen 'dmenu'
subgen 'dnssec-rr'