From: "Ronald S. Bultje"
Originally written by Ronald S. Bultje, with fixes, optimizations and
improvements by James Almer.
Signed-off-by: James Almer
---
- s.n_frame_threads is now mapped to avctx->thread_count.
- colorspace, color_primaries and color_trc are now cast to avutil enums to
silence -Wenum-conversion warnings on Clang.
- Constified the data pointer in libdav1d_data_free() callback due to recent
changes upstream.
Dav1dData was updated upstream as well, so a { 0 } initialization should not
emit any kind of warning with old GCC/Clang anymore.
configure | 4 +
libavcodec/Makefile| 1 +
libavcodec/allcodecs.c | 1 +
libavcodec/libdav1d.c | 270 +
4 files changed, 276 insertions(+)
create mode 100644 libavcodec/libdav1d.c
diff --git a/configure b/configure
index 01c3a1011d..e56b925065 100755
--- a/configure
+++ b/configure
@@ -226,6 +226,7 @@ External library support:
--enable-libcelt enable CELT decoding via libcelt [no]
--enable-libcdio enable audio CD grabbing with libcdio [no]
--enable-libcodec2 enable codec2 en/decoding using libcodec2 [no]
+ --enable-libdav1denable AV1 decoding via libdav1d [no]
--enable-libdavs2enable AVS2 decoding via libdavs2 [no]
--enable-libdc1394 enable IIDC-1394 grabbing using libdc1394
and libraw1394 [no]
@@ -1712,6 +1713,7 @@ EXTERNAL_LIBRARY_LIST="
libcaca
libcelt
libcodec2
+libdav1d
libdc1394
libdrm
libflite
@@ -3088,6 +3090,7 @@ libaom_av1_encoder_select="extract_extradata_bsf"
libcelt_decoder_deps="libcelt"
libcodec2_decoder_deps="libcodec2"
libcodec2_encoder_deps="libcodec2"
+libdav1d_decoder_deps="libdav1d"
libdavs2_decoder_deps="libdavs2"
libfdk_aac_decoder_deps="libfdk_aac"
libfdk_aac_encoder_deps="libfdk_aac"
@@ -6064,6 +6067,7 @@ enabled libcelt && require libcelt celt/celt.h
celt_decode -lcelt0 &&
die "ERROR: libcelt must be installed and
version must be >= 0.11.0."; }
enabled libcaca && require_pkg_config libcaca caca caca.h
caca_create_canvas
enabled libcodec2 && require libcodec2 codec2/codec2.h codec2_create
-lcodec2
+enabled libdav1d && require_pkg_config libdav1d "dav1d >= 0.0.1"
"dav1d/dav1d.h" dav1d_version
enabled libdavs2 && require_pkg_config libdavs2 "davs2 >= 1.5.115"
davs2.h davs2_decoder_open
enabled libdc1394 && require_pkg_config libdc1394 libdc1394-2
dc1394/dc1394.h dc1394_new
enabled libdrm&& require_pkg_config libdrm libdrm xf86drm.h
drmGetVersion
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 3e41497e34..8643da8f2b 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -956,6 +956,7 @@ OBJS-$(CONFIG_LIBAOM_AV1_ENCODER) += libaomenc.o
OBJS-$(CONFIG_LIBCELT_DECODER)+= libcelt_dec.o
OBJS-$(CONFIG_LIBCODEC2_DECODER) += libcodec2.o codec2utils.o
OBJS-$(CONFIG_LIBCODEC2_ENCODER) += libcodec2.o codec2utils.o
+OBJS-$(CONFIG_LIBDAV1D_DECODER) += libdav1d.o
OBJS-$(CONFIG_LIBDAVS2_DECODER) += libdavs2.o
OBJS-$(CONFIG_LIBFDK_AAC_DECODER) += libfdk-aacdec.o
OBJS-$(CONFIG_LIBFDK_AAC_ENCODER) += libfdk-aacenc.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 1b8144a2b7..2c17db5a70 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -676,6 +676,7 @@ extern AVCodec ff_libaom_av1_encoder;
extern AVCodec ff_libcelt_decoder;
extern AVCodec ff_libcodec2_encoder;
extern AVCodec ff_libcodec2_decoder;
+extern AVCodec ff_libdav1d_decoder;
extern AVCodec ff_libdavs2_decoder;
extern AVCodec ff_libfdk_aac_encoder;
extern AVCodec ff_libfdk_aac_decoder;
diff --git a/libavcodec/libdav1d.c b/libavcodec/libdav1d.c
new file mode 100644
index 00..873adfda40
--- /dev/null
+++ b/libavcodec/libdav1d.c
@@ -0,0 +1,270 @@
+/*
+ * Copyright (c) 2018 Ronald S. Bultje
+ * Copyright (c) 2018 James Almer
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include
+
+#include "libavutil/avassert.h"
+#include "libavutil/fifo.h"
+#include "libavutil/opt.h"
+
+#include "avcodec.h"
+#include "decode.h"
+#incl