Skip to content

Commit

Permalink
contrib: Use libdav1d for AV1 decoding in FFmpeg.
Browse files Browse the repository at this point in the history
  • Loading branch information
f3ndot authored and bradleysepos committed Sep 17, 2019
1 parent d0fea86 commit 01e909b
Show file tree
Hide file tree
Showing 10 changed files with 59 additions and 5 deletions.
1 change: 1 addition & 0 deletions THANKS.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ HandBrake uses many cool libraries from the GNU/Linux world. We thank them and t
- [libass](https://github.com/libass/libass)
- [libbluray](https://www.videolan.org/developers/libbluray.html)
- [libbzip2](http://bzip.org/)
- [libdav1d](https://code.videolan.org/videolan/dav1d)
- [libdvdnav](https://dvdnav.mplayerhq.hu/)
- [libdvdread](https://dvdnav.mplayerhq.hu/)
- [libfdk-aac](https://sourceforge.net/projects/opencore-amr/)
Expand Down
4 changes: 3 additions & 1 deletion contrib/ffmpeg/module.defs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__deps__ := BZIP2 ZLIB FDKAAC LIBVPX LAME LIBOPUS LIBSPEEX XZ
__deps__ := BZIP2 ZLIB FDKAAC LIBDAV1D LIBVPX LAME LIBOPUS LIBSPEEX XZ
ifeq (1,$(FEATURE.qsv))
__deps__ += LIBMFX
endif
Expand Down Expand Up @@ -55,6 +55,8 @@ FFMPEG.CONFIGURE.extra = \
--enable-encoder=libvpx_vp8 \
--enable-encoder=libvpx_vp9 \
--disable-decoder=*_crystalhd \
--enable-libdav1d \
--enable-decoder=libdav1d \
--cc="$(FFMPEG.GCC.gcc)" \
--extra-ldflags="$(call fn.ARGS,FFMPEG.GCC,*archs *sysroot *minver ?extra) -L$(call fn.ABSOLUTE,$(CONTRIB.build/)lib)"

Expand Down
19 changes: 19 additions & 0 deletions contrib/libdav1d/A00-add-cross-file.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
diff -Naur /dev/null dav1d-f1b756ef5bdc0bb759b2b140f15362fec024c1ff/x86_64-w64-mingw32.meson
--- /dev/null 2019-02-01 11:36:25.027425148 -0500
+++ dav1d-f1b756ef5bdc0bb759b2b140f15362fec024c1ff/x86_64-w64-mingw32.meson 2019-02-01 12:10:45.582462644 -0500
@@ -0,0 +1,15 @@
+[binaries]
+c = 'x86_64-w64-mingw32-gcc'
+cpp = 'x86_64-w64-mingw32-g++'
+ar = 'x86_64-w64-mingw32-ar'
+strip = 'x86_64-w64-mingw32-strip'
+windres = 'x86_64-w64-mingw32-windres'
+
+[properties]
+c_link_args = ['-static-libgcc']
+
+[host_machine]
+system = 'windows'
+cpu_family = 'x86_64'
+cpu = 'x86_64'
+endian = 'little'
27 changes: 27 additions & 0 deletions contrib/libdav1d/module.defs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
$(eval $(call import.MODULE.defs,LIBDAV1D,libdav1d,PTHREADW32))
$(eval $(call import.CONTRIB.defs,LIBDAV1D))

LIBDAV1D.FETCH.url = https://code.videolan.org/videolan/dav1d/-/archive/0.4.0/dav1d-0.4.0.tar.bz2
LIBDAV1D.FETCH.sha256 = 18bf96c5168b8c704422387620fefaa953e8dbd4eacb0f0796c03d6e741f8924

LIBDAV1D.build_dir = build/

LIBDAV1D.CONFIGURE.exe = $(MESON.exe)
LIBDAV1D.CONFIGURE.deps =
LIBDAV1D.CONFIGURE.shared =
LIBDAV1D.CONFIGURE.host =
LIBDAV1D.CONFIGURE.build =
LIBDAV1D.CONFIGURE.static = -Ddefault_library=static
LIBDAV1D.CONFIGURE.extra = --libdir=$(call fn.ABSOLUTE,$(CONTRIB.build/))lib/ --buildtype=release
LIBDAV1D.CONFIGURE.env =

ifeq (1-mingw,$(HOST.cross)-$(HOST.system))
LIBDAV1D.CONFIGURE.extra += --cross-file=$(call fn.ABSOLUTE,$(LIBDAV1D.EXTRACT.dir/))x86_64-w64-mingw32.meson
endif

LIBDAV1D.BUILD.make = $(NINJA.exe)
LIBDAV1D.BUILD.extra = -v

LIBDAV1D.INSTALL.make = $(NINJA.exe)

LIBDAV1D.CLEAN.make = $(NINJA.exe)
2 changes: 2 additions & 0 deletions contrib/libdav1d/module.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
$(eval $(call import.MODULE.rules,LIBDAV1D))
$(eval $(call import.CONTRIB.rules,LIBDAV1D))
2 changes: 1 addition & 1 deletion gtk/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ PKG_CHECK_MODULES(GHB, [$GHB_PACKAGES])

GHB_CFLAGS="$HBINC $GHB_CFLAGS"

HB_LIBS="-lhandbrake -lavformat -lavfilter -lavcodec -lavutil -lswresample -lpostproc -ldvdnav -ldvdread -lmp3lame -lvorbis -lvorbisenc -logg -lx264 -lswscale -ltheoraenc -ltheoradec -lvpx -lz -lbz2 -lbluray -lass -lfontconfig -lfreetype -lxml2 -ljansson -lopus -lspeex -llzma"
HB_LIBS="-lhandbrake -lavformat -lavfilter -lavcodec -lavutil -ldav1d -lswresample -lpostproc -ldvdnav -ldvdread -lmp3lame -lvorbis -lvorbisenc -logg -lx264 -lswscale -ltheoraenc -ltheoradec -lvpx -lz -lbz2 -lbluray -lass -lfontconfig -lfreetype -lxml2 -ljansson -lopus -lspeex -llzma"

if test "x$use_fdk_aac" = "xyes" ; then
HB_LIBS="$HB_LIBS -lfdk-aac"
Expand Down
4 changes: 2 additions & 2 deletions libhb/module.defs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
__deps__ := A52DEC BZIP2 LIBVPX FFMPEG FREETYPE LAME LIBASS LIBDCA \
LIBDVDREAD LIBDVDNAV LIBICONV LIBSAMPLERATE LIBTHEORA LIBVORBIS LIBOGG \
LIBXML2 X264 X265 ZLIB LIBBLURAY FDKAAC LIBMFX LIBGNURX JANSSON \
HARFBUZZ LIBOPUS LIBSPEEX
HARFBUZZ LIBOPUS LIBSPEEX LIBDAV1D

ifeq (,$(filter $(HOST.system),darwin cygwin mingw))
__deps__ += FONTCONFIG
Expand Down Expand Up @@ -103,7 +103,7 @@ LIBHB.lib = $(LIBHB.build/)hb.lib
LIBHB.dll.libs = $(foreach n, \
ass avformat avfilter avcodec avutil swresample postproc dvdnav dvdread \
freetype mp3lame swscale vpx theora vorbis vorbisenc ogg \
x264 xml2 bluray jansson harfbuzz opus speex, \
x264 xml2 bluray jansson harfbuzz opus speex dav1d, \
$(CONTRIB.build/)lib/lib$(n).a )

ifeq (1,$(FEATURE.fdk_aac))
Expand Down
2 changes: 2 additions & 0 deletions make/configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -1562,7 +1562,9 @@ class Tools:
gmake = ToolProbe( 'GMAKE.exe', 'make', 'gmake', 'make', abort=True )

m4 = ToolProbe( 'M4.exe', 'm4', 'gm4', 'm4', abort=True )
meson = ToolProbe( 'MESON.exe', 'meson', 'meson', abort=True )
mkdir = ToolProbe( 'MKDIR.exe', 'mkdir', 'mkdir', abort=True )
ninja = ToolProbe( 'NINJA.exe', 'ninja', 'ninja', abort=True )
patch = ToolProbe( 'PATCH.exe', 'patch', 'gpatch', 'patch', abort=True )
rm = ToolProbe( 'RM.exe', 'rm', 'rm', abort=True )
ranlib = ToolProbe( 'RANLIB.exe', 'ranlib', 'ranlib', abort=True )
Expand Down
1 change: 1 addition & 0 deletions make/include/main.defs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ ifeq (1,$(FEATURE.x265))
MODULES += contrib/x265_12bit
endif

MODULES += contrib/libdav1d
MODULES += contrib/ffmpeg
MODULES += contrib/libdvdread
MODULES += contrib/libdvdnav
Expand Down
2 changes: 1 addition & 1 deletion test/module.defs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ TEST.GCC.l = \
ass avformat avfilter avcodec avutil swresample postproc mp3lame dvdnav \
dvdread fribidi \
swscale vpx theoraenc theoradec vorbis vorbisenc ogg x264 \
bluray freetype xml2 bz2 z jansson harfbuzz opus speex lzma
bluray freetype xml2 bz2 z jansson harfbuzz opus speex lzma dav1d

ifeq (,$(filter $(HOST.system),darwin cygwin mingw))
TEST.GCC.l += fontconfig
Expand Down

0 comments on commit 01e909b

Please sign in to comment.