shithub: dav1d

Download patch

ref: 265d0e6862eca0ac326208f67cfc7ef3682500b3
parent: 0c9a16c6708ef4ba53f753ec322e3404c5754ac7
author: Sigrid Haflínudóttir <ftrvxmtrx@gmail.com>
date: Fri Sep 4 04:49:22 EDT 2020

build both 8 and 16 bpc logic

--- a/src/cdef.h
+++ b/src/cdef.h
@@ -60,10 +60,12 @@
 int (name)(const pixel *dst, ptrdiff_t dst_stride, unsigned *var HIGHBD_DECL_SUFFIX)
 typedef decl_cdef_dir_fn(*cdef_dir_fn);
 
-typedef struct Dav1dCdefDSPContext {
+typedef struct  {
     cdef_dir_fn dir;
     cdef_fn fb[3 /* 444/luma, 422, 420 */];
 } Dav1dCdefDSPContext;
+
+#pragma incomplete Dav1dCdefDSPContext
 
 bitfn_decls(void dav1d_cdef_dsp_init, Dav1dCdefDSPContext *c);
 bitfn_decls(void dav1d_cdef_dsp_init_arm, Dav1dCdefDSPContext *c);
--- a/src/fg_apply.h
+++ b/src/fg_apply.h
@@ -34,8 +34,10 @@
 
 #include "src/film_grain.h"
 
-bitfn_decls(void dav1d_apply_grain, const Dav1dFilmGrainDSPContext *const dsp,
-                                    Dav1dPicture *const out,
-                                    Dav1dPicture *const in);
+#pragma incomplete Dav1dFilmGrainDSPContext
+
+bitfn_decls(void dav1d_apply_grain, Dav1dFilmGrainDSPContext *dsp,
+                                    Dav1dPicture *out,
+                                    Dav1dPicture *in);
 
 #endif /* DAV1D_SRC_FG_APPLY_H */
--- a/src/fg_apply_tmpl.c
+++ b/src/fg_apply_tmpl.c
@@ -89,9 +89,9 @@
 }
 
 #ifndef UNIT_TEST
-void bitfn(dav1d_apply_grain)(const Dav1dFilmGrainDSPContext *const dsp,
-                              Dav1dPicture *const out,
-                              Dav1dPicture *const in)
+void bitfn(dav1d_apply_grain)(Dav1dFilmGrainDSPContext *dsp,
+                              Dav1dPicture *out,
+                              Dav1dPicture *in)
 {
     const Dav1dFilmGrainData *const data = &out->frame_hdr->film_grain.data;
 
--- a/src/film_grain.h
+++ b/src/film_grain.h
@@ -79,6 +79,8 @@
     fguv_32x32xn_fn fguv_32x32xn[3];
 } Dav1dFilmGrainDSPContext;
 
+#pragma incomplete Dav1dFilmGrainDSPContext
+
 bitfn_decls(void dav1d_film_grain_dsp_init, Dav1dFilmGrainDSPContext *c);
 bitfn_decls(void dav1d_film_grain_dsp_init_x86, Dav1dFilmGrainDSPContext *c);
 
--- a/src/internal.h
+++ b/src/internal.h
@@ -246,6 +246,8 @@
     } tile_thread;
 };
 
+#pragma incomplete Dav1dFrameContext
+
 struct Dav1dTileState {
     CdfContext cdf;
     MsacContext msac;
@@ -345,5 +347,7 @@
         int die;
     } tile_thread;
 };
+
+#pragma incomplete Dav1dTileContext
 
 #endif /* DAV1D_SRC_INTERNAL_H */
--- a/src/ipred.h
+++ b/src/ipred.h
@@ -88,6 +88,8 @@
     pal_pred_fn pal_pred;
 } Dav1dIntraPredDSPContext;
 
+#pragma incomplete Dav1dIntraPredDSPContext
+
 bitfn_decls(void dav1d_intra_pred_dsp_init, Dav1dIntraPredDSPContext *c);
 bitfn_decls(void dav1d_intra_pred_dsp_init_arm, Dav1dIntraPredDSPContext *c);
 bitfn_decls(void dav1d_intra_pred_dsp_init_x86, Dav1dIntraPredDSPContext *c);
--- a/src/itx.h
+++ b/src/itx.h
@@ -43,6 +43,8 @@
     itxfm_fn itxfm_add[N_RECT_TX_SIZES][N_TX_TYPES_PLUS_LL];
 } Dav1dInvTxfmDSPContext;
 
+#pragma incomplete Dav1dInvTxfmDSPContext
+
 bitfn_decls(void dav1d_itx_dsp_init, Dav1dInvTxfmDSPContext *c, int bpc);
 bitfn_decls(void dav1d_itx_dsp_init_arm, Dav1dInvTxfmDSPContext *c, int bpc);
 bitfn_decls(void dav1d_itx_dsp_init_x86, Dav1dInvTxfmDSPContext *c);
--- a/src/loopfilter.h
+++ b/src/loopfilter.h
@@ -52,6 +52,8 @@
     loopfilter_sb_fn loop_filter_sb[2][2];
 } Dav1dLoopFilterDSPContext;
 
+#pragma incomplete Dav1dLoopFilterDSPContext
+
 bitfn_decls(void dav1d_loop_filter_dsp_init, Dav1dLoopFilterDSPContext *c);
 bitfn_decls(void dav1d_loop_filter_dsp_init_arm, Dav1dLoopFilterDSPContext *c);
 bitfn_decls(void dav1d_loop_filter_dsp_init_x86, Dav1dLoopFilterDSPContext *c);
--- a/src/looprestoration.h
+++ b/src/looprestoration.h
@@ -72,6 +72,8 @@
     selfguided_fn selfguided;
 } Dav1dLoopRestorationDSPContext;
 
+#pragma incomplete Dav1dLoopRestorationDSPContext
+
 bitfn_decls(void dav1d_loop_restoration_dsp_init, Dav1dLoopRestorationDSPContext *c, int bpc);
 bitfn_decls(void dav1d_loop_restoration_dsp_init_arm, Dav1dLoopRestorationDSPContext *c, int bpc);
 bitfn_decls(void dav1d_loop_restoration_dsp_init_x86, Dav1dLoopRestorationDSPContext *c);
--- a/src/mc.h
+++ b/src/mc.h
@@ -131,6 +131,8 @@
     resize_fn resize;
 } Dav1dMCDSPContext;
 
+#pragma incomplete Dav1dMCDSPContext
+
 bitfn_decls(void dav1d_mc_dsp_init, Dav1dMCDSPContext *c);
 bitfn_decls(void dav1d_mc_dsp_init_arm, Dav1dMCDSPContext *c);
 bitfn_decls(void dav1d_mc_dsp_init_x86, Dav1dMCDSPContext *c);
--- a/src/mkfile
+++ b/src/mkfile
@@ -1,12 +1,16 @@
 </$objtype/mkfile
 
-CFLAGS=$CFLAGS -I../include/dav1d -I.. -I../include -Iplan9 -p -D__plan9__
+CFLAGS=$CFLAGS -I../include/dav1d -I.. -I../include -Iplan9 -p -D__plan9__ -DBITDEPTH=8
 
 HFILES=\
 
 OFILES=\
+	annexb.$O\
+	av19.$O\
 	cdef_apply_tmpl.$O\
+	cdef_apply_tmpl16.$O\
 	cdef_tmpl.$O\
+	cdef_tmpl16.$O\
 	cdf.$O\
 	cpu.$O\
 	data.$O\
@@ -13,43 +17,54 @@
 	decode.$O\
 	dequant_tables.$O\
 	fg_apply_tmpl.$O\
+	fg_apply_tmpl16.$O\
 	film_grain_tmpl.$O\
+	film_grain_tmpl16.$O\
 	getbits.$O\
+	input.$O\
 	intra_edge.$O\
 	ipred_prepare_tmpl.$O\
+	ipred_prepare_tmpl16.$O\
 	ipred_tmpl.$O\
+	ipred_tmpl16.$O\
 	itx_1d.$O\
 	itx_tmpl.$O\
+	itx_tmpl16.$O\
+	ivf.$O\
 	lf_apply_tmpl.$O\
+	lf_apply_tmpl16.$O\
 	lf_mask.$O\
 	lib.$O\
 	log.$O\
 	loopfilter_tmpl.$O\
+	loopfilter_tmpl16.$O\
 	looprestoration_tmpl.$O\
+	looprestoration_tmpl16.$O\
 	lr_apply_tmpl.$O\
+	lr_apply_tmpl16.$O\
 	mc_tmpl.$O\
+	mc_tmpl16.$O\
 	msac.$O\
 	obu.$O\
 	picture.$O\
+	plan9_builtins.$O\
+	plan9_thread.$O\
 	qm.$O\
 	recon_tmpl.$O\
+	recon_tmpl16.$O\
 	ref.$O\
 	refmvs.$O\
 	scan.$O\
+	section5.$O\
 	tables.$O\
 	thread_task.$O\
 	warpmv.$O\
 	wedge.$O\
-	plan9_builtins.$O\
-	plan9_thread.$O\
-	\
-	av19.$O\
-	ivf.$O\
-	annexb.$O\
-	input.$O\
-	section5.$O\
 
 </sys/src/cmd/mkone
+
+%16.$O: %.c
+	$CC $CFLAGS '-DBITDEPTH=16' -o $target $prereq
 
 ivf.$O: ../tools/input/ivf.c
 	$CC $CFLAGS -I../tools $prereq
--- a/src/plan9/config.h
+++ b/src/plan9/config.h
@@ -1,12 +1,21 @@
 #ifndef __plan9_config_h__
 #define __plan9_config_h__
 
-// FIXME
+#define ARCH_AARCH64 0
+#define ARCH_ARM 0
+#define ARCH_PPC64LE 0
+#define ARCH_X86 1
+#define ARCH_X86_32 0
 #define ARCH_X86_64 1
-#define BITDEPTH 8
-#define HAVE_ALIGNED_MALLOC 1
+#define CONFIG_16BPC 1
 #define CONFIG_8BPC 1
-//#define CONFIG_16BPC 1
 #define CONFIG_LOG 1
+#define ENDIANNESS_BIG 0
+#define HAVE_ASM 0
+#define HAVE_AVX512ICL 0
+#define HAVE_CLOCK_GETTIME 0
+#define HAVE_ALIGNED_MALLOC 1
+#define HAVE_UNISTD_H 1
+#define STACK_ALIGNMENT 0
 
 #endif