Index: head/multimedia/ffmpeg/Makefile =================================================================== --- head/multimedia/ffmpeg/Makefile (revision 506251) +++ head/multimedia/ffmpeg/Makefile (revision 506252) @@ -1,606 +1,605 @@ # Created by: Martin Matuska # $FreeBSD$ PORTNAME= ffmpeg -PORTVERSION= 4.1.3 -PORTREVISION= 14 +PORTVERSION= 4.1.4 PORTEPOCH= 1 CATEGORIES= multimedia audio ipv6 net MASTER_SITES= https://ffmpeg.org/releases/ MAINTAINER= multimedia@FreeBSD.org COMMENT= Realtime audio/video encoder/converter and streaming server LICENSE= GPLv2+ LGPL21+ LICENSE_COMB= multi BUILD_DEPENDS= nasm:devel/nasm \ ${LOCALBASE}/bin/as:devel/binutils HAS_CONFIGURE= yes CONFIGURE_LOG= ffbuild/config.log USES= compiler:c11 cpe gmake localbase:ldflags perl5 \ pkgconfig shebangfix tar:xz USE_LDCONFIG= yes USE_PERL5= build SHEBANG_FILES= doc/texi2pod.pl NOPRECIOUSMAKEVARS= yes # ARCH PORTSCOUT= limit:^4\. # Option CHROMAPRINT disabled, it cannot work and people are baffled. OPTIONS_DEFINE= ALSA AMR_NB AMR_WB AOM ASS BEIGNET BS2B CACA CDIO CELT CODEC2 DAV1D DAVS2 DC1394 \ DEBUG DOCS DRM FDK_AAC FLITE FONTCONFIG \ FREETYPE FREI0R FRIBIDI GME GSM ICONV ILBC JACK KLVANC KVAZAAR LADSPA \ LAME LENSFUN LIBBLURAY LIBRSVG2 LIBXML2 LV2 MODPLUG MYSOFA OPENAL OPENCL OPENCV OPENGL \ OPENH264 OPENJPEG OPENMPT OPTIMIZED_CFLAGS OPUS PULSEAUDIO \ RUBBERBAND RTCPU SDL SMB SNAPPY SNDIO SOXR SPEEX SRT SSH TENSORFLOW \ TESSERACT THEORA TWOLAME V4L VAAPI VAPOURSYNTH VDPAU VIDSTAB VORBIS \ VO_AMRWBENC VPX WAVPACK WEBP X264 X265 XAVS2 XCB XVID \ XVIDEO ZIMG ZMQ ZVBI OPTIONS_DEFAULT= DAV1D FONTCONFIG FREETYPE FREI0R GMP GNUTLS ICONV \ OPENCV OPTIMIZED_CFLAGS OPUS RTCPU THEORA V4L VAAPI VDPAU \ VORBIS VPX X264 X265 XCB XVID .if !exists(${.CURDIR:H:H}/multimedia/davs2) # https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/5985a1bf7233 OPTIONS_EXCLUDE+= DAVS2 .endif .if !exists(${.CURDIR:H:H}/multimedia/xavs2) # https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/85a921f4618 OPTIONS_EXCLUDE+= XAVS2 .endif .if !exists(${.CURDIR:H:H}/multimedia/klvanc) # https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/8732dfa9954 OPTIONS_EXCLUDE+= KLVANC .endif .if !exists(${.CURDIR:H:H}/net/srt) # https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/a2fc8dbae853 OPTIONS_EXCLUDE+= SRT .endif .if !exists(${.CURDIR:H:H}/science/tensorflow) # https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/d8c0bbb0aa4 OPTIONS_EXCLUDE+= TENSORFLOW .endif OPTIONS_RADIO= RTMP SSL OPTIONS_RADIO_RTMP= GCRYPT GMP LIBRTMP OPTIONS_RADIO_SSL= GNUTLS MBEDTLS OPENSSL OPTIONS_GROUP= LICENSE OPTIONS_GROUP_LICENSE= GPL3 NONFREE OPTIONS_DEFINE_amd64= BEIGNET MMX SSE SVTAV1 SVTHEVC SVTVP9 OPTIONS_DEFINE_armv6= VFP NEON OPTIONS_DEFINE_i386= BEIGNET MMX SSE OPTIONS_DEFAULT_amd64= MMX SSE OPTIONS_DEFAULT_i386= MMX SSE ASS_DESC= Subtitles rendering via libass AOM_DESC= AV1 video encoding/decoding via libaom BEIGNET_DESC= DRM/VAAPI to OpenCL mapping for i965 + Beignet BS2B_DESC= Bauer Stereophonic-to-Binaural filter CHROMAPRINT_DESC= Audio fingerprinting with chromaprint CODEC2_DESC= Codec 2 audio encoding/decoding via libcodec2 DAV1D_DESC= AV1 video decoding via libdav1d DAVS2_DESC= AVS2 decoding via libdavs2 DC1394_DESC= IIDC-1394 grabbing using libdc1394 DRM_DESC= KMS grabbing using libdrm FDK_AAC_DESC= AAC audio encoding via Fraunhofer FDK FLITE_DESC= Voice synthesis support via libflite GME_DESC= Game Music Emu demuxer GPL3_DESC= Allow (L)GPL version 3 code(cs) ILBC_DESC= Internet Low Bit Rate codec KLVANC_DESC= Kernel Labs VANC processing KVAZAAR_DESC= H.265 video codec support via Kvazaar LICENSE_DESC= Licensing options LV2_DESC= LV2 audio filtering MYSOFA_DESC= SOFAlizer binaural filter NEON_DESC= Media Processing Engine instructions NONFREE_DESC= Allow use of nonfree code OPENMPT_DESC= Decoding tracked files via libopenmpt OPENH264_DESC= H.264 video codec support via OpenH264 RUBBERBAND_DESC=Time-stretching and pitch-shifting with librubberband RTCPU_DESC= Detect CPU capabilities at runtime RTMP_DESC= RTMP(T)E protocol support SRT_DESC= Haivision SRT protocol via libsrt SVTAV1_DESC= AV1 encoding via SVT-AV1 SVTHEVC_DESC= HEVC encoding via SVT-HEVC SVTVP9_DESC= VP9 encoding via SVT-VP9 LIBRTMP_DESC= ${RTMP_DESC} via librtmp TENSORFLOW_DESC=TensorFlow as a DNN module backend for DNN based filters like sr TESSERACT_DESC= Optical Character Recognition via Tesseract VAPOURSYNTH_DESC= VapourSynth demuxer VFP_DESC= Vector Floating Point instructions VIDSTAB_DESC= Video stabilization filter XAVS2_DESC= AVS2 encoding via libxavs2 XCB_DESC= X11 grabbing using XCB ZIMG_DESC= "z" library video scaling filter ZMQ_DESC= Message passing via libzmq${ZMQ_VERSION} ZVBI_DESC= Teletext support via libzvbi OPTIONS_SUB= yes # alsa ALSA_LIB_DEPENDS= libasound.so:audio/alsa-lib ALSA_CONFIGURE_ENABLE= alsa # Opencore AMR NB AMR_NB_LIB_DEPENDS= libopencore-amrnb.so:audio/opencore-amr AMR_NB_CONFIGURE_ENABLE= libopencore-amrnb AMR_NB_IMPLIES= GPL3 # Opencore AMR WB AMR_WB_LIB_DEPENDS= libopencore-amrwb.so:audio/opencore-amr AMR_WB_CONFIGURE_ENABLE= libopencore-amrwb AMR_WB_IMPLIES= GPL3 # aom AOM_LIB_DEPENDS= libaom.so:multimedia/aom AOM_CONFIGURE_ENABLE= libaom # ass ASS_LIB_DEPENDS= libass.so:multimedia/libass ASS_CONFIGURE_ENABLE= libass # beignet BEIGNET_BUILD_DEPENDS= ${LOCALBASE}/include/CL/cl_intel.h:lang/beignet BEIGNET_IMPLIES= DRM OPENCL VAAPI # bs2b BS2B_LIB_DEPENDS= libbs2b.so:audio/libbs2b BS2B_CONFIGURE_ENABLE= libbs2b # caca CACA_LIB_DEPENDS= libcaca.so:graphics/libcaca CACA_CONFIGURE_ENABLE= libcaca # cdio CDIO_LIB_DEPENDS= libcdio_paranoia.so:sysutils/libcdio-paranoia CDIO_CONFIGURE_ENABLE= libcdio # celt CELT_LIB_DEPENDS= libcelt0.so:audio/celt CELT_CONFIGURE_ENABLE= libcelt # chromaprint CHROMAPRINT_BROKEN= Dependency loop CHROMAPRINT_LIB_DEPENDS= libchromaprint.so:audio/chromaprint CHROMAPRINT_CONFIGURE_ENABLE= chromaprint # codec2 CODEC2_LIB_DEPENDS= libcodec2.so:audio/codec2 CODEC2_CONFIGURE_ENABLE= libcodec2 # dav1d DAV1D_LIB_DEPENDS= libdav1d.so:multimedia/dav1d DAV1D_CONFIGURE_ENABLE= libdav1d # davs2 DAVS2_LIB_DEPENDS= libdavs2.so:multimedia/davs2 DAVS2_CONFIGURE_ENABLE= libdavs2 # dc1394 DC1394_LIB_DEPENDS= libdc1394.so:multimedia/libdc1394 DC1394_CONFIGURE_ENABLE= libdc1394 # debugging DEBUG_CONFIGURE_ON= --disable-stripping DEBUG_CONFIGURE_OFF= --disable-debug # docs DOCS_BUILD_DEPENDS= texi2html:textproc/texi2html DOCS_CONFIGURE_ENABLE= htmlpages # drm DRM_LIB_DEPENDS= libdrm.so:graphics/libdrm DRM_CONFIGURE_ENABLE= libdrm # fdk_aac FDK_AAC_LIB_DEPENDS= libfdk-aac.so:audio/fdk-aac FDK_AAC_CONFIGURE_ENABLE= libfdk-aac FDK_AAC_IMPLIES= NONFREE # flite FLITE_LIB_DEPENDS= libflite.so:audio/flite FLITE_CONFIGURE_ENABLE= libflite # fontconfig FONTCONFIG_LIB_DEPENDS= libfontconfig.so:x11-fonts/fontconfig FONTCONFIG_CONFIGURE_ENABLE= fontconfig # freetype FREETYPE_LIB_DEPENDS= libfreetype.so:print/freetype2 FREETYPE_CONFIGURE_ENABLE= libfreetype # frei0r FREI0R_BUILD_DEPENDS= ${LOCALBASE}/include/frei0r.h:graphics/frei0r FREI0R_CONFIGURE_ENABLE= frei0r # fribidi FRIBIDI_LIB_DEPENDS= libfribidi.so:converters/fribidi FRIBIDI_CONFIGURE_ENABLE= libfribidi # gcrypt GCRYPT_LIB_DEPENDS= libgcrypt.so:security/libgcrypt GCRYPT_CONFIGURE_ENABLE= gcrypt # gnutls GNUTLS_LIB_DEPENDS= libgnutls.so:security/gnutls GNUTLS_CONFIGURE_ENABLE= gnutls # gme GME_LIB_DEPENDS= libgme.so:audio/libgme GME_CONFIGURE_ENABLE= libgme # gmp GMP_LIB_DEPENDS= libgmp.so:math/gmp GMP_CONFIGURE_ENABLE= gmp GMP_IMPLIES= GPL3 # gsm GSM_LIB_DEPENDS= libgsm.so:audio/gsm GSM_CONFIGURE_ENABLE= libgsm # iconv ICONV_USES= iconv ICONV_CONFIGURE_ENABLE= iconv # ilbc ILBC_LIB_DEPENDS= libilbc.so:net/libilbc ILBC_CONFIGURE_ENABLE= libilbc # jack JACK_LIB_DEPENDS= libjack.so:audio/jack JACK_CONFIGURE_ENABLE= libjack # klvanc KLVANC_LIB_DEPENDS= libklvanc.so:multimedia/libklvanc KLVANC_CONFIGURE_ENABLE= libklvanc # kvazaar KVAZAAR_LIB_DEPENDS= libkvazaar.so:multimedia/kvazaar KVAZAAR_CONFIGURE_ENABLE= libkvazaar # ladspa LADSPA_BUILD_DEPENDS= ${LOCALBASE}/include/ladspa.h:audio/ladspa LADSPA_RUN_DEPENDS= ${LOCALBASE}/lib/ladspa/amp.so:audio/ladspa LADSPA_CONFIGURE_ENABLE= ladspa # lame LAME_LIB_DEPENDS= libmp3lame.so:audio/lame LAME_CONFIGURE_ENABLE= libmp3lame # lensfun LENSFUN_LIB_DEPENDS= liblensfun.so:graphics/lensfun LENSFUN_CONFIGURE_ENABLE= liblensfun # libbluray LIBBLURAY_LIB_DEPENDS= libbluray.so:multimedia/libbluray LIBBLURAY_CONFIGURE_ENABLE= libbluray # librsvg LIBRSVG2_LIB_DEPENDS= librsvg-2.so:graphics/librsvg2 LIBRSVG2_CONFIGURE_ENABLE= librsvg # libxml LIBXML2_LIB_DEPENDS= libxml2.so:textproc/libxml2 LIBXML2_CONFIGURE_ENABLE= libxml2 # lv2 LV2_BUILD_DEPENDS= lv2>0:audio/lv2 LV2_LIB_DEPENDS= liblilv-0.so:audio/lilv LV2_CONFIGURE_ENABLE= lv2 # libv4l V4L_BUILD_DEPENDS= v4l_compat>0:multimedia/v4l_compat V4L_LIB_DEPENDS= libv4l2.so:multimedia/libv4l V4L_CONFIGURE_ENABLE= libv4l2 V4L_CONFIGURE_OFF= --disable-indev=v4l2 \ --disable-outdev=v4l2 # mbedtls MBEDTLS_LIB_DEPENDS= libmbedtls.so:security/mbedtls MBEDTLS_CONFIGURE_ENABLE= mbedtls # mmx support MMX_CONFIGURE_ENABLE= mmx # modplug MODPLUG_LIB_DEPENDS= libmodplug.so:audio/libmodplug MODPLUG_CONFIGURE_ENABLE= libmodplug # mysofa MYSOFA_LIB_DEPENDS= libmysofa.so:audio/libmysofa MYSOFA_CONFIGURE_ENABLE= libmysofa # OpenAL OPENAL_LIB_DEPENDS= libopenal.so:audio/openal-soft OPENAL_CONFIGURE_ENABLE= openal # opencl OPENCL_BUILD_DEPENDS= ${LOCALBASE}/include/CL/opencl.h:devel/opencl OPENCL_LIB_DEPENDS= libOpenCL.so:devel/ocl-icd OPENCL_CONFIGURE_ENABLE= opencl # opencv OPENCV_LIB_DEPENDS= libopencv_imgproc.so:graphics/opencv-core OPENCV_CONFIGURE_ENABLE= libopencv # opengl OPENGL_USES= gl OPENGL_USE= GL=gl OPENGL_CONFIGURE_ENABLE= opengl # openh264 OPENH264_LIB_DEPENDS= libopenh264.so:multimedia/openh264 OPENH264_CONFIGURE_ENABLE= libopenh264 # openjpeg OPENJPEG_LIB_DEPENDS= libopenjp2.so:graphics/openjpeg OPENJPEG_CONFIGURE_ENABLE= libopenjpeg # openmpt OPENMPT_LIB_DEPENDS= libopenmpt.so:audio/libopenmpt OPENMPT_CONFIGURE_ENABLE= libopenmpt # openssl/libtls OPENSSL_USES= ssl OPENSSL_CONFIGURE_ENABLE= ${"${SSL_DEFAULT:Mlibressl*}"!="":?libtls:openssl} OPENSSL_IMPLIES= NONFREE # optimizations OPTIMIZED_CFLAGS_CONFIGURE_ENABLE= optimizations # opus OPUS_LIB_DEPENDS= libopus.so:audio/opus OPUS_CONFIGURE_ENABLE= libopus # pulseaudio PULSEAUDIO_LIB_DEPENDS= libpulse.so:audio/pulseaudio PULSEAUDIO_CONFIGURE_ENABLE= libpulse # rubberband RUBBERBAND_LIB_DEPENDS= librubberband.so:audio/rubberband RUBBERBAND_CONFIGURE_ENABLE= librubberband # rtcpu RTCPU_CONFIGURE_ENABLE= runtime-cpudetect # rtmp LIBRTMP_LIB_DEPENDS= librtmp.so:multimedia/librtmp LIBRTMP_CONFIGURE_ENABLE= librtmp # sdl SDL_USE= SDL=sdl2 SDL_CONFIGURE_ENABLE= sdl2 # smbclient SMB_USES= samba:lib SMB_CONFIGURE_ENABLE= libsmbclient SMB_IMPLIES= GPL3 # snappy SNAPPY_LIB_DEPENDS= libsnappy.so:archivers/snappy SNAPPY_CONFIGURE_ENABLE= libsnappy # sndio SNDIO_LIB_DEPENDS= libsndio.so:audio/sndio SNDIO_CONFIGURE_ENABLE= sndio # soxr SOXR_LIB_DEPENDS= libsoxr.so:audio/libsoxr SOXR_CONFIGURE_ENABLE= libsoxr # speex SPEEX_LIB_DEPENDS= libspeex.so:audio/speex SPEEX_CONFIGURE_ENABLE= libspeex # sse support SSE_CONFIGURE_ENABLE= sse SSE_IMPLIES= MMX # ssh SSH_LIB_DEPENDS= libssh.so:security/libssh SSH_CONFIGURE_ENABLE= libssh # srt SRT_LIB_DEPENDS= libsrt.so:net/srt SRT_CONFIGURE_ENABLE= libsrt # svt-av1 SVTAV1_LIB_DEPENDS= libSvtAv1Enc.so:multimedia/svt-av1 SVTAV1_CONFIGURE_ON= --enable-libsvtav1 SVTAV1_PATCH_SITES= https://github.com/OpenVisualCloud/SVT-AV1/raw/v0.6.0/ffmpeg_plugin/:svtav1 SVTAV1_PATCHFILES= 0001-Add-ability-for-ffmpeg-to-run-svt-av1.patch:-p1:svtav1 .if make(makesum) .MAKEFLAGS: WITH+=SVTAV1 .else SVTAV1_PREVENTS= SVTHEVC SVTVP9 SVTAV1_PREVENTS_MSG= Only one SVT vendor patch can be applied at the same time .endif # svt-hevc SVTHEVC_LIB_DEPENDS= libSvtHevcEnc.so:multimedia/svt-hevc SVTHEVC_CONFIGURE_ON= --enable-libsvthevc SVTHEVC_PATCH_SITES= https://github.com/Intel/SVT-HEVC/raw/v1.3.0/ffmpeg_plugin/:svthevc SVTHEVC_PATCHFILES= 0001-lavc-svt_hevc-add-libsvt-hevc-encoder-wrapper.patch:-p1:svthevc \ 0002-doc-Add-libsvt_hevc-encoder-docs.patch:-p1:svthevc .if make(makesum) .MAKEFLAGS: WITH+=SVTHEVC .else SVTHEVC_PREVENTS= SVTAV1 SVTVP9 SVTHEVC_PREVENTS_MSG= ${SVTAV1_PREVENTS_MSG} .endif # svt-vp9 SVTVP9_LIB_DEPENDS= libSvtVp9Enc.so:multimedia/svt-vp9 SVTVP9_CONFIGURE_ON= --enable-libsvtvp9 SVTVP9_PATCH_SITES= https://github.com/OpenVisualCloud/SVT-VP9/raw/ce24589/ffmpeg_plugin/:svtvp9 SVTVP9_PATCHFILES= 0001-Add-ability-for-ffmpeg-to-run-svt-vp9.patch:-p1:svtvp9 .if make(makesum) .MAKEFLAGS: WITH+=SVTVP9 .else SVTVP9_PREVENTS= SVTAV1 SVTHEVC SVTVP9_PREVENTS_MSG= ${SVTAV1_PREVENTS_MSG} .endif # tensorflow TENSORFLOW_LIB_DEPENDS= libtensorflow.so:science/tensorflow TENSORFLOW_CONFIGURE_ENABLE= libtensorflow # tesseract TESSERACT_LIB_DEPENDS= libtesseract.so:graphics/tesseract TESSERACT_CONFIGURE_ENABLE= libtesseract # theora THEORA_LIB_DEPENDS= libtheora.so:multimedia/libtheora THEORA_CONFIGURE_ENABLE= libtheora # twolame TWOLAME_LIB_DEPENDS= libtwolame.so:audio/twolame TWOLAME_CONFIGURE_ENABLE= libtwolame # vaapi VAAPI_LIB_DEPENDS= libva.so:multimedia/libva VAAPI_CONFIGURE_ENABLE= vaapi # vapoursynth VAPOURSYNTH_LIB_DEPENDS= libvapoursynth-script.so:multimedia/vapoursynth VAPOURSYNTH_CONFIGURE_ENABLE= vapoursynth # vdpau VDPAU_USE= XORG=x11 VDPAU_LIB_DEPENDS= libvdpau.so:multimedia/libvdpau VDPAU_CONFIGURE_ENABLE= vdpau # armv6/armv7 VFP_CONFIGURE_ENABLE= vfp NEON_CONFIGURE_ENABLE= neon .if ! ${CFLAGS:M-march*} NEON_CONFIGURE_ON= --cpu=armv7-a .endif # vo-amrwbenc VO_AMRWBENC_LIB_DEPENDS= libvo-amrwbenc.so:audio/vo-amrwbenc VO_AMRWBENC_CONFIGURE_ENABLE= libvo-amrwbenc VO_AMRWBENC_IMPLIES= GPL3 # vid.stab VIDSTAB_LIB_DEPENDS= libvidstab.so:multimedia/vid.stab VIDSTAB_CONFIGURE_ENABLE= libvidstab # vorbis VORBIS_LIB_DEPENDS= libvorbisenc.so:audio/libvorbis VORBIS_CONFIGURE_ENABLE= libvorbis # vp8 VPX_LIB_DEPENDS= libvpx.so:multimedia/libvpx VPX_CONFIGURE_ENABLE= libvpx # wavpack WAVPACK_LIB_DEPENDS= libwavpack.so:audio/wavpack WAVPACK_CONFIGURE_ENABLE= libwavpack # webp WEBP_LIB_DEPENDS= libwebp.so:graphics/webp WEBP_CONFIGURE_ENABLE= libwebp # x264 X264_LIB_DEPENDS= libx264.so:multimedia/libx264 X264_CONFIGURE_ENABLE= libx264 # x265 X265_LIB_DEPENDS= libx265.so:multimedia/x265 X265_CONFIGURE_ENABLE= libx265 # xavs2 XAVS2_LIB_DEPENDS= libxavs2.so:multimedia/xavs2 XAVS2_CONFIGURE_ENABLE= libxavs2 # xcb XCB_USE= XORG=xcb XCB_CONFIGURE_ENABLE= libxcb # xvid XVID_LIB_DEPENDS= libxvidcore.so:multimedia/xvid XVID_CONFIGURE_ENABLE= libxvid # xv XVIDEO_USE= XORG=x11,xext,xv XVIDEO_CONFIGURE_OFF= --disable-outdev=xv # zimg ZIMG_LIB_DEPENDS= libzimg.so:graphics/sekrit-twc-zimg ZIMG_CONFIGURE_ENABLE= libzimg # zmq ZMQ_LIB_DEPENDS= libzmq.so:net/libzmq${ZMQ_VERSION} ZMQ_CONFIGURE_ENABLE= libzmq ZMQ_VERSION?= 4 # zvbi ZVBI_LIB_DEPENDS= libzvbi.so:devel/libzvbi ZVBI_CONFIGURE_ENABLE= libzvbi # License knobs GPL3_CONFIGURE_ENABLE= version3 GPL3_VARS= LICENSE="GPLv3+ LGPL3+" LICENSE_FILE_GPLv3= ${WRKSRC}/COPYING.GPLv3 LICENSE_FILE_LGPL3= ${WRKSRC}/COPYING.LGPLv3 NONFREE_CONFIGURE_ENABLE=nonfree NONFREE_VARS= RESTRICTED="enabling OPENSSL or FDK_AAC restricts redistribution" INSTALL_TARGET= install-progs install-doc install-data \ install-libs install-headers install-examples DATADIR= ${PREFIX}/share/${PORTNAME}${PKGNAMESUFFIX} DOCSDIR= ${PREFIX}/share/doc/${PORTNAME}${PKGNAMESUFFIX} CONFIGURE_ENV+= COMPILER_PATH=${LOCALBASE}/bin MAKE_ENV+= COMPILER_PATH=${LOCALBASE}/bin V=1 CONFIGURE_ARGS+=--prefix="${PREFIX}" \ --mandir="${PREFIX}/man" \ --datadir="${DATADIR}" \ --pkgconfigdir="${PREFIX}/libdata/pkgconfig" \ --enable-shared \ --enable-pic \ --enable-gpl \ --enable-postproc \ --enable-avfilter \ --enable-avresample \ --enable-pthreads \ --cc="${CC}" CONFIGURE_ENV_aarch64_clang= ASFLAGS=-no-integrated-as CONFIGURE_ENV_armv6_clang= ASFLAGS=-no-integrated-as CONFIGURE_ENV_armv7_clang= ASFLAGS=-no-integrated-as DOC_FILES= Changelog CREDITS INSTALL.md LICENSE.md MAINTAINERS \ README.md RELEASE_NOTES # under doc subdirectory DOC_DOCFILES= APIchanges *.txt PORTDOCS= * # Custom helpers. FOO_${ARCH} style from bsd.port.mk CONFIGURE_ENV+= ${CONFIGURE_ENV_${ARCH}_${CHOSEN_COMPILER_TYPE}} CONFIGURE_ARGS+=${CONFIGURE_ARGS_${OPSYS}_${OSREL:R}_${ARCH}} post-patch: # {C,LD}FLAGS safeness @${REINPLACE_CMD} -E \ -e 's|require_pkg_config opencv|require_pkg_config opencv-core|g' \ ${CONFIGURE_WRKSRC}/${CONFIGURE_SCRIPT} post-install: (cd ${WRKSRC} && ${COPYTREE_SHARE} \ "${DOC_FILES}" ${STAGEDIR}${DOCSDIR}) (cd ${WRKSRC}/doc && ${COPYTREE_SHARE} \ "${DOC_DOCFILES}" ${STAGEDIR}${DOCSDIR}) .include Index: head/multimedia/ffmpeg/distinfo =================================================================== --- head/multimedia/ffmpeg/distinfo (revision 506251) +++ head/multimedia/ffmpeg/distinfo (revision 506252) @@ -1,11 +1,11 @@ -TIMESTAMP = 1554117390 -SHA256 (ffmpeg-4.1.3.tar.xz) = 0c3020452880581a8face91595b239198078645e7d7184273b8bcc7758beb63d -SIZE (ffmpeg-4.1.3.tar.xz) = 8895988 +TIMESTAMP = 1562609569 +SHA256 (ffmpeg-4.1.4.tar.xz) = f1f049a82fcfbf156564e73a3935d7e750891fab2abf302e735104fd4050a7e1 +SIZE (ffmpeg-4.1.4.tar.xz) = 8896056 SHA256 (0001-Add-ability-for-ffmpeg-to-run-svt-av1.patch) = d653158c8d1c958cdebe9ee50cb95db917f5421ba79ee121202a97ce40c44ade SIZE (0001-Add-ability-for-ffmpeg-to-run-svt-av1.patch) = 20028 SHA256 (0001-lavc-svt_hevc-add-libsvt-hevc-encoder-wrapper.patch) = cc8ba4ff56cdb38a59650203999c4c8c83fc40bdb905b87b678ff68a4538444d SIZE (0001-lavc-svt_hevc-add-libsvt-hevc-encoder-wrapper.patch) = 22815 SHA256 (0002-doc-Add-libsvt_hevc-encoder-docs.patch) = 516c5a1b3ab6dc444e2270a1bae90455838fc3b7e3a18de37d7d63e25e79493d SIZE (0002-doc-Add-libsvt_hevc-encoder-docs.patch) = 5602 SHA256 (0001-Add-ability-for-ffmpeg-to-run-svt-vp9.patch) = d2abcdcbcbff21e7ad8de574230622be993da19e9bddf0a690b1118cfd11c6c1 SIZE (0001-Add-ability-for-ffmpeg-to-run-svt-vp9.patch) = 21580 Index: head/multimedia/ffmpeg/files/patch-aom =================================================================== --- head/multimedia/ffmpeg/files/patch-aom (revision 506251) +++ head/multimedia/ffmpeg/files/patch-aom (revision 506252) @@ -1,350 +1,339 @@ https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/b2ea757f68 https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/d12d4d4515 -https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/b87063c06d https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/2ddaaaf595 https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/e3991a5a45 https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/995889abbf https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/0856c5da07 https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/0e1ea034d8 https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/1e8475b507 --- doc/encoders.texi.orig 2018-11-05 23:22:25 UTC +++ doc/encoders.texi @@ -1370,6 +1370,118 @@ makes it possible to store non-rgb pix_fmts. @end table +@section libaom-av1 + +libaom AV1 encoder wrapper. + +Requires the presence of the libaom headers and library during +configuration. You need to explicitly configure the build with +@code{--enable-libaom}. + +@subsection Options + +The wrapper supports the following standard libavcodec options: + +@table @option + +@item b +Set bitrate target in bits/second. By default this will use +variable-bitrate mode. If @option{maxrate} and @option{minrate} are +also set to the same value then it will use constant-bitrate mode, +otherwise if @option{crf} is set as well then it will use +constrained-quality mode. + +@item g keyint_min +Set key frame placement. The GOP size sets the maximum distance between +key frames; if zero the output stream will be intra-only. The minimum +distance is ignored unless it is the same as the GOP size, in which case +key frames will always appear at a fixed interval. Not set by default, +so without this option the library has completely free choice about +where to place key frames. + +@item qmin qmax +Set minimum/maximum quantisation values. Valid range is from 0 to 63 +(warning: this does not match the quantiser values actually used by AV1 +- divide by four to map real quantiser values to this range). Defaults +to min/max (no constraint). + +@item minrate maxrate bufsize rc_init_occupancy +Set rate control buffering parameters. Not used if not set - defaults +to unconstrained variable bitrate. + +@item threads +Set the number of threads to use while encoding. This may require the +@option{tiles} or @option{row-mt} options to also be set to actually +use the specified number of threads fully. Defaults to the number of +hardware threads supported by the host machine. + +@item profile +Set the encoding profile. Defaults to using the profile which matches +the bit depth and chroma subsampling of the input. + +@end table + +The wrapper also has some specific options: + +@table @option + +@item cpu-used +Set the quality/encoding speed tradeoff. Valid range is from 0 to 8, +higher numbers indicating greater speed and lower quality. The default +value is 1, which will be slow and high quality. + +@item auto-alt-ref +Enable use of alternate reference frames. Defaults to the internal +default of the library. + +@item lag-in-frames +Set the maximum number of frames which the encoder may keep in flight +at any one time for lookahead purposes. Defaults to the internal +default of the library. + +@item error-resilience +Enable error resilience features: +@table @option +@item default +Improve resilience against losses of whole frames. +@end table +Not enabled by default. + +@item crf +Set the quality/size tradeoff for constant-quality (no bitrate target) +and constrained-quality (with maximum bitrate target) modes. Valid +range is 0 to 63, higher numbers indicating lower quality and smaller +output size. Only used if set; by default only the bitrate target is +used. + +@item static-thresh +Set a change threshold on blocks below which they will be skipped by +the encoder. Defined in arbitrary units as a nonnegative integer, +defaulting to zero (no blocks are skipped). + +@item drop-threshold +Set a threshold for dropping frames when close to rate control bounds. +Defined as a percentage of the target buffer - when the rate control +buffer falls below this percentage, frames will be dropped until it +has refilled above the threshold. Defaults to zero (no frames are +dropped). + +@item tiles +Set the number of tiles to encode the input video with, as colums x +rows. Larger numbers allow greater parallelism in both encoding and +decoding, but may decrease coding efficiency. Defaults to the minimum +number of tiles required by the size of the input video (this is 1x1 +(that is, a single tile) for sizes up to and including 4K). + +@item tile-columns tile-rows +Set the number of tiles as log2 of the number of tile rows and columns. +Provided for compatibility with libvpx/VP9. + +@item row-mt (Requires libaom >= 1.0.0-759-g90a15f4f2) +Enable row based multi-threading. Disabled by default. + +@end table + @section libkvazaar Kvazaar H.265/HEVC encoder. --- libavcodec/libaomenc.c.orig 2018-11-05 23:22:26 UTC +++ libavcodec/libaomenc.c @@ -66,33 +66,69 @@ typedef struct AOMEncoderContext { struct FrameListData *coded_frame_list; int cpu_used; int auto_alt_ref; + int arnr_max_frames; + int arnr_strength; + int aq_mode; int lag_in_frames; int error_resilient; int crf; int static_thresh; int drop_threshold; - int noise_sensitivity; + int denoise_noise_level; + int denoise_block_size; uint64_t sse[4]; int have_sse; /**< true if we have pending sse[] */ uint64_t frame_number; + int rc_undershoot_pct; + int rc_overshoot_pct; + int minsection_pct; + int maxsection_pct; + int frame_parallel; int tile_cols, tile_rows; int tile_cols_log2, tile_rows_log2; aom_superblock_size_t superblock_size; int uniform_tiles; + int row_mt; + int enable_cdef; + int enable_global_motion; + int enable_intrabc; } AOMContext; static const char *const ctlidstr[] = { [AOME_SET_CPUUSED] = "AOME_SET_CPUUSED", [AOME_SET_CQ_LEVEL] = "AOME_SET_CQ_LEVEL", [AOME_SET_ENABLEAUTOALTREF] = "AOME_SET_ENABLEAUTOALTREF", + [AOME_SET_ARNR_MAXFRAMES] = "AOME_SET_ARNR_MAXFRAMES", + [AOME_SET_ARNR_STRENGTH] = "AOME_SET_ARNR_STRENGTH", [AOME_SET_STATIC_THRESHOLD] = "AOME_SET_STATIC_THRESHOLD", [AV1E_SET_COLOR_RANGE] = "AV1E_SET_COLOR_RANGE", [AV1E_SET_COLOR_PRIMARIES] = "AV1E_SET_COLOR_PRIMARIES", [AV1E_SET_MATRIX_COEFFICIENTS] = "AV1E_SET_MATRIX_COEFFICIENTS", [AV1E_SET_TRANSFER_CHARACTERISTICS] = "AV1E_SET_TRANSFER_CHARACTERISTICS", + [AV1E_SET_AQ_MODE] = "AV1E_SET_AQ_MODE", + [AV1E_SET_FRAME_PARALLEL_DECODING] = "AV1E_SET_FRAME_PARALLEL_DECODING", [AV1E_SET_SUPERBLOCK_SIZE] = "AV1E_SET_SUPERBLOCK_SIZE", [AV1E_SET_TILE_COLUMNS] = "AV1E_SET_TILE_COLUMNS", [AV1E_SET_TILE_ROWS] = "AV1E_SET_TILE_ROWS", +#ifdef AOM_CTRL_AV1E_SET_ROW_MT + [AV1E_SET_ROW_MT] = "AV1E_SET_ROW_MT", +#endif +#ifdef AOM_CTRL_AV1E_SET_DENOISE_NOISE_LEVEL + [AV1E_SET_DENOISE_NOISE_LEVEL] = "AV1E_SET_DENOISE_NOISE_LEVEL", +#endif +#ifdef AOM_CTRL_AV1E_SET_DENOISE_BLOCK_SIZE + [AV1E_SET_DENOISE_BLOCK_SIZE] = "AV1E_SET_DENOISE_BLOCK_SIZE", +#endif +#ifdef AOM_CTRL_AV1E_SET_MAX_REFERENCE_FRAMES + [AV1E_SET_MAX_REFERENCE_FRAMES] = "AV1E_SET_MAX_REFERENCE_FRAMES", +#endif +#ifdef AOM_CTRL_AV1E_SET_ENABLE_GLOBAL_MOTION + [AV1E_SET_ENABLE_GLOBAL_MOTION] = "AV1E_SET_ENABLE_GLOBAL_MOTION", +#endif +#ifdef AOM_CTRL_AV1E_SET_ENABLE_INTRABC + [AV1E_SET_ENABLE_INTRABC] = "AV1E_SET_ENABLE_INTRABC", +#endif + [AV1E_SET_ENABLE_CDEF] = "AV1E_SET_ENABLE_CDEF", }; static av_cold void log_encoder_error(AVCodecContext *avctx, const char *desc) -@@ -505,7 +541,8 @@ static av_cold int aom_init(AVCodecContext *avctx, - enccfg.g_h = avctx->height; - enccfg.g_timebase.num = avctx->time_base.num; - enccfg.g_timebase.den = avctx->time_base.den; -- enccfg.g_threads = avctx->thread_count ? avctx->thread_count : av_cpu_count(); -+ enccfg.g_threads = -+ FFMIN(avctx->thread_count ? avctx->thread_count : av_cpu_count(), 64); - - if (ctx->lag_in_frames >= 0) - enccfg.g_lag_in_frames = ctx->lag_in_frames; @@ -558,10 +595,14 @@ static av_cold int aom_init(AVCodecContext *avctx, // 0-100 (0 => CBR, 100 => VBR) enccfg.rc_2pass_vbr_bias_pct = round(avctx->qcompress * 100); - if (avctx->bit_rate) + if (ctx->minsection_pct >= 0) + enccfg.rc_2pass_vbr_minsection_pct = ctx->minsection_pct; + else if (avctx->bit_rate) enccfg.rc_2pass_vbr_minsection_pct = avctx->rc_min_rate * 100LL / avctx->bit_rate; - if (avctx->rc_max_rate) + if (ctx->maxsection_pct >= 0) + enccfg.rc_2pass_vbr_maxsection_pct = ctx->maxsection_pct; + else if (avctx->rc_max_rate) enccfg.rc_2pass_vbr_maxsection_pct = avctx->rc_max_rate * 100LL / avctx->bit_rate; @@ -573,6 +614,11 @@ static av_cold int aom_init(AVCodecContext *avctx, avctx->rc_initial_buffer_occupancy * 1000LL / avctx->bit_rate; enccfg.rc_buf_optimal_sz = enccfg.rc_buf_sz * 5 / 6; + if (ctx->rc_undershoot_pct >= 0) + enccfg.rc_undershoot_pct = ctx->rc_undershoot_pct; + if (ctx->rc_overshoot_pct >= 0) + enccfg.rc_overshoot_pct = ctx->rc_overshoot_pct; + // _enc_init() will balk if kf_min_dist differs from max w/AOM_KF_AUTO if (avctx->keyint_min >= 0 && avctx->keyint_min == avctx->gop_size) enccfg.kf_min_dist = avctx->keyint_min; @@ -634,7 +680,12 @@ static av_cold int aom_init(AVCodecContext *avctx, codecctl_int(avctx, AOME_SET_CPUUSED, ctx->cpu_used); if (ctx->auto_alt_ref >= 0) codecctl_int(avctx, AOME_SET_ENABLEAUTOALTREF, ctx->auto_alt_ref); - + if (ctx->arnr_max_frames >= 0) + codecctl_int(avctx, AOME_SET_ARNR_MAXFRAMES, ctx->arnr_max_frames); + if (ctx->arnr_strength >= 0) + codecctl_int(avctx, AOME_SET_ARNR_STRENGTH, ctx->arnr_strength); + if (ctx->enable_cdef >= 0) + codecctl_int(avctx, AV1E_SET_ENABLE_CDEF, ctx->enable_cdef); codecctl_int(avctx, AOME_SET_STATIC_THRESHOLD, ctx->static_thresh); if (ctx->crf >= 0) codecctl_int(avctx, AOME_SET_CQ_LEVEL, ctx->crf); @@ -642,6 +693,10 @@ static av_cold int aom_init(AVCodecContext *avctx, codecctl_int(avctx, AV1E_SET_COLOR_PRIMARIES, avctx->color_primaries); codecctl_int(avctx, AV1E_SET_MATRIX_COEFFICIENTS, avctx->colorspace); codecctl_int(avctx, AV1E_SET_TRANSFER_CHARACTERISTICS, avctx->color_trc); + if (ctx->aq_mode >= 0) + codecctl_int(avctx, AV1E_SET_AQ_MODE, ctx->aq_mode); + if (ctx->frame_parallel >= 0) + codecctl_int(avctx, AV1E_SET_FRAME_PARALLEL_DECODING, ctx->frame_parallel); set_color_range(avctx); codecctl_int(avctx, AV1E_SET_SUPERBLOCK_SIZE, ctx->superblock_size); @@ -650,6 +705,32 @@ static av_cold int aom_init(AVCodecContext *avctx, codecctl_int(avctx, AV1E_SET_TILE_ROWS, ctx->tile_rows_log2); } +#ifdef AOM_CTRL_AV1E_SET_DENOISE_NOISE_LEVEL + if (ctx->denoise_noise_level >= 0) + codecctl_int(avctx, AV1E_SET_DENOISE_NOISE_LEVEL, ctx->denoise_noise_level); +#endif +#ifdef AOM_CTRL_AV1E_SET_DENOISE_BLOCK_SIZE + if (ctx->denoise_block_size >= 0) + codecctl_int(avctx, AV1E_SET_DENOISE_BLOCK_SIZE, ctx->denoise_block_size); +#endif +#ifdef AOM_CTRL_AV1E_SET_ENABLE_GLOBAL_MOTION + if (ctx->enable_global_motion >= 0) + codecctl_int(avctx, AV1E_SET_ENABLE_GLOBAL_MOTION, ctx->enable_global_motion); +#endif +#ifdef AOM_CTRL_AV1E_SET_MAX_REFERENCE_FRAMES + if (avctx->refs >= 3) { + codecctl_int(avctx, AV1E_SET_MAX_REFERENCE_FRAMES, avctx->refs); + } +#endif +#ifdef AOM_CTRL_AV1E_SET_ROW_MT + if (ctx->row_mt >= 0) + codecctl_int(avctx, AV1E_SET_ROW_MT, ctx->row_mt); +#endif +#ifdef AOM_CTRL_AV1E_SET_ENABLE_INTRABC + if (ctx->enable_intrabc >= 0) + codecctl_int(avctx, AV1E_SET_ENABLE_INTRABC, ctx->enable_intrabc); +#endif + // provide dummy value to initialize wrapper, values will be updated each _encode() aom_img_wrap(&ctx->rawimg, img_fmt, avctx->width, avctx->height, 1, (unsigned char*)1); @@ -727,7 +808,7 @@ static int storeframe(AVCodecContext *avctx, struct FrameListData *cx_frame, AVPacket *pkt) { AOMContext *ctx = avctx->priv_data; - int pict_type; + int av_unused pict_type; int ret = ff_alloc_packet2(avctx, pkt, cx_frame->sz, 0); if (ret < 0) { av_log(avctx, AV_LOG_ERROR, @@ -975,19 +1056,37 @@ static const AVOption options[] = { "frames (2-pass only)", OFFSET(auto_alt_ref), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 2, VE}, { "lag-in-frames", "Number of frames to look ahead at for " "alternate reference frame selection", OFFSET(lag_in_frames), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, VE}, + { "arnr-max-frames", "altref noise reduction max frame count", OFFSET(arnr_max_frames), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, VE}, + { "arnr-strength", "altref noise reduction filter strength", OFFSET(arnr_strength), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 6, VE}, + { "aq-mode", "adaptive quantization mode", OFFSET(aq_mode), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 4, VE, "aq_mode"}, + { "none", "Aq not used", 0, AV_OPT_TYPE_CONST, {.i64 = 0}, 0, 0, VE, "aq_mode"}, + { "variance", "Variance based Aq", 0, AV_OPT_TYPE_CONST, {.i64 = 1}, 0, 0, VE, "aq_mode"}, + { "complexity", "Complexity based Aq", 0, AV_OPT_TYPE_CONST, {.i64 = 2}, 0, 0, VE, "aq_mode"}, + { "cyclic", "Cyclic Refresh Aq", 0, AV_OPT_TYPE_CONST, {.i64 = 3}, 0, 0, VE, "aq_mode"}, { "error-resilience", "Error resilience configuration", OFFSET(error_resilient), AV_OPT_TYPE_FLAGS, {.i64 = 0}, INT_MIN, INT_MAX, VE, "er"}, { "default", "Improve resiliency against losses of whole frames", 0, AV_OPT_TYPE_CONST, {.i64 = AOM_ERROR_RESILIENT_DEFAULT}, 0, 0, VE, "er"}, { "crf", "Select the quality for constant quality mode", offsetof(AOMContext, crf), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 63, VE }, { "static-thresh", "A change threshold on blocks below which they will be skipped by the encoder", OFFSET(static_thresh), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE }, { "drop-threshold", "Frame drop threshold", offsetof(AOMContext, drop_threshold), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX, VE }, - { "noise-sensitivity", "Noise sensitivity", OFFSET(noise_sensitivity), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 4, VE}, + { "denoise-noise-level", "Amount of noise to be removed", OFFSET(denoise_noise_level), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, VE}, + { "denoise-block-size", "Denoise block size ", OFFSET(denoise_block_size), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, VE}, + { "undershoot-pct", "Datarate undershoot (min) target (%)", OFFSET(rc_undershoot_pct), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 100, VE}, + { "overshoot-pct", "Datarate overshoot (max) target (%)", OFFSET(rc_overshoot_pct), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 1000, VE}, + { "minsection-pct", "GOP min bitrate (% of target)", OFFSET(minsection_pct), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 100, VE}, + { "maxsection-pct", "GOP max bitrate (% of target)", OFFSET(maxsection_pct), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 5000, VE}, + { "frame-parallel", "Enable frame parallel decodability features", OFFSET(frame_parallel), AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, VE}, { "tiles", "Tile columns x rows", OFFSET(tile_cols), AV_OPT_TYPE_IMAGE_SIZE, { .str = NULL }, 0, 0, VE }, { "tile-columns", "Log2 of number of tile columns to use", OFFSET(tile_cols_log2), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 6, VE}, { "tile-rows", "Log2 of number of tile rows to use", OFFSET(tile_rows_log2), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 6, VE}, - { NULL } + { "row-mt", "Enable row based multi-threading", OFFSET(row_mt), AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, VE}, + { "enable-cdef", "Enable CDEF filtering", OFFSET(enable_cdef), AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, VE}, + { "enable-global-motion", "Enable global motion", OFFSET(enable_global_motion), AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, VE}, + { "enable-intrabc", "Enable intra block copy prediction mode", OFFSET(enable_intrabc), AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, VE}, + { NULL }, }; static const AVCodecDefault defaults[] = { + { "b", "256*1000" }, { "qmin", "-1" }, { "qmax", "-1" }, { "g", "-1" }, Index: head/multimedia/ffmpeg/files/patch-dav1d =================================================================== --- head/multimedia/ffmpeg/files/patch-dav1d (revision 506251) +++ head/multimedia/ffmpeg/files/patch-dav1d (revision 506252) @@ -1,434 +1,461 @@ https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/beaa350e24 https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/752659327d https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/cc25529420 https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/53ca505acc https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/3cd275bcde https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/0fca2f60da https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/e695b0beba https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/0e833f615b https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/10931a0661 https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/dcf64b599d https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/2a31bf2a35 https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/28746a0e20 https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/36bb2cc200 https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/38a4132132 https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/f6803cfbd2 https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/5cd60b6f2e https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/9e62e1a110 +https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/fbc5a27694 +https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/0e07b767c8 +https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/254da41531 +https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/f78172b29a --- configure.orig 2018-11-05 23:22:33 UTC +++ 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-libdav1d enable AV1 decoding via libdav1d [no] --enable-libdavs2 enable 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 @@ -3090,6 +3092,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" @@ -6068,6 +6071,7 @@ enabled libcelt && require libcelt celt/celt 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.2.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 --- doc/general.texi.orig 2018-11-05 23:22:25 UTC +++ doc/general.texi @@ -758,8 +758,8 @@ following image formats are supported: @item Autodesk Animator Flic video @tab @tab X @item Autodesk RLE @tab @tab X @tab fourcc: AASC -@item AV1 @tab @tab E - @tab Supported through external library libaom +@item AV1 @tab E @tab E + @tab Supported through external libraries libaom and libdav1d @item Avid 1:1 10-bit RGB Packer @tab X @tab X @tab fourcc: AVrp @item AVS (Audio Video Standard) video @tab @tab X --- libavcodec/Makefile.orig 2018-11-05 23:22:25 UTC +++ libavcodec/Makefile @@ -956,6 +956,7 @@ OBJS-$(CONFIG_LIBAOM_AV1_ENCODER) += libaomenc 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 --- libavcodec/allcodecs.c.orig 2018-11-05 23:22:25 UTC +++ 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; --- libavcodec/libdav1d.c.orig 2018-12-16 07:22:28 UTC +++ libavcodec/libdav1d.c -@@ -0,0 +1,346 @@ +@@ -0,0 +1,369 @@ +/* + * 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/mastering_display_metadata.h" +#include "libavutil/imgutils.h" +#include "libavutil/opt.h" + +#include "avcodec.h" +#include "decode.h" +#include "internal.h" + +typedef struct Libdav1dContext { + AVClass *class; + Dav1dContext *c; + AVBufferPool *pool; + int pool_size; + + Dav1dData data; + int tile_threads; ++ int frame_threads; + int apply_grain; +} Libdav1dContext; + +static const enum AVPixelFormat pix_fmt[][3] = { + [DAV1D_PIXEL_LAYOUT_I400] = { AV_PIX_FMT_GRAY8, AV_PIX_FMT_GRAY10, AV_PIX_FMT_GRAY12 }, + [DAV1D_PIXEL_LAYOUT_I420] = { AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV420P10, AV_PIX_FMT_YUV420P12 }, + [DAV1D_PIXEL_LAYOUT_I422] = { AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV422P10, AV_PIX_FMT_YUV422P12 }, + [DAV1D_PIXEL_LAYOUT_I444] = { AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUV444P10, AV_PIX_FMT_YUV444P12 }, +}; + ++static const enum AVPixelFormat pix_fmt_rgb[3] = { ++ AV_PIX_FMT_GBRP, AV_PIX_FMT_GBRP10, AV_PIX_FMT_GBRP12, ++}; ++ +static void libdav1d_log_callback(void *opaque, const char *fmt, va_list vl) +{ + AVCodecContext *c = opaque; + + av_vlog(c, AV_LOG_ERROR, fmt, vl); +} + +static int libdav1d_picture_allocator(Dav1dPicture *p, void *cookie) +{ + Libdav1dContext *dav1d = cookie; + enum AVPixelFormat format = pix_fmt[p->p.layout][p->seq_hdr->hbd]; + int ret, linesize[4], h = FFALIGN(p->p.h, 128); + uint8_t *aligned_ptr, *data[4]; + AVBufferRef *buf; + + ret = av_image_fill_arrays(data, linesize, NULL, format, FFALIGN(p->p.w, 128), + h, DAV1D_PICTURE_ALIGNMENT); + if (ret < 0) + return ret; + + if (ret != dav1d->pool_size) { + av_buffer_pool_uninit(&dav1d->pool); + // Use twice the amount of required padding bytes for aligned_ptr below. + dav1d->pool = av_buffer_pool_init(ret + DAV1D_PICTURE_ALIGNMENT * 2, NULL); + if (!dav1d->pool) { + dav1d->pool_size = 0; + return AVERROR(ENOMEM); + } + dav1d->pool_size = ret; + } + buf = av_buffer_pool_get(dav1d->pool); + if (!buf) + return AVERROR(ENOMEM); + + // libdav1d requires DAV1D_PICTURE_ALIGNMENT aligned buffers, which av_malloc() + // doesn't guarantee for example when AVX is disabled at configure time. + // Use the extra DAV1D_PICTURE_ALIGNMENT padding bytes in the buffer to align it + // if required. + aligned_ptr = (uint8_t *)FFALIGN((uintptr_t)buf->data, DAV1D_PICTURE_ALIGNMENT); + ret = av_image_fill_pointers(data, format, h, aligned_ptr, linesize); + if (ret < 0) { + av_buffer_unref(&buf); + return ret; + } + + p->data[0] = data[0]; + p->data[1] = data[1]; + p->data[2] = data[2]; + p->stride[0] = linesize[0]; + p->stride[1] = linesize[1]; + p->allocator_data = buf; + + return 0; +} + +static void libdav1d_picture_release(Dav1dPicture *p, void *cookie) +{ + AVBufferRef *buf = p->allocator_data; + + av_buffer_unref(&buf); +} + +static av_cold int libdav1d_init(AVCodecContext *c) +{ + Libdav1dContext *dav1d = c->priv_data; + Dav1dSettings s; ++ int threads = (c->thread_count ? c->thread_count : av_cpu_count()) * 3 / 2; + int res; + + av_log(c, AV_LOG_INFO, "libdav1d %s\n", dav1d_version()); + + dav1d_default_settings(&s); + s.logger.cookie = c; + s.logger.callback = libdav1d_log_callback; + s.allocator.cookie = dav1d; + s.allocator.alloc_picture_callback = libdav1d_picture_allocator; + s.allocator.release_picture_callback = libdav1d_picture_release; -+ s.n_tile_threads = dav1d->tile_threads; + s.apply_grain = dav1d->apply_grain; -+ s.n_frame_threads = FFMIN(c->thread_count ? c->thread_count : av_cpu_count(), DAV1D_MAX_FRAME_THREADS); + ++ s.n_tile_threads = dav1d->tile_threads ++ ? dav1d->tile_threads ++ : FFMIN(floor(sqrt(threads)), DAV1D_MAX_TILE_THREADS); ++ s.n_frame_threads = dav1d->frame_threads ++ ? dav1d->frame_threads ++ : FFMIN(ceil(threads / s.n_tile_threads), DAV1D_MAX_FRAME_THREADS); ++ av_log(c, AV_LOG_DEBUG, "Using %d frame threads, %d tile threads\n", ++ s.n_frame_threads, s.n_tile_threads); ++ + res = dav1d_open(&dav1d->c, &s); + if (res < 0) + return AVERROR(ENOMEM); + + return 0; +} + +static void libdav1d_flush(AVCodecContext *c) +{ + Libdav1dContext *dav1d = c->priv_data; + + dav1d_data_unref(&dav1d->data); + dav1d_flush(dav1d->c); +} + +static void libdav1d_data_free(const uint8_t *data, void *opaque) { + AVBufferRef *buf = opaque; + + av_buffer_unref(&buf); +} + +static int libdav1d_receive_frame(AVCodecContext *c, AVFrame *frame) +{ + Libdav1dContext *dav1d = c->priv_data; + Dav1dData *data = &dav1d->data; + Dav1dPicture pic = { 0 }, *p = &pic; + int res; + + if (!data->sz) { + AVPacket pkt = { 0 }; + + res = ff_decode_get_packet(c, &pkt); + if (res < 0 && res != AVERROR_EOF) + return res; + + if (pkt.size) { + res = dav1d_data_wrap(data, pkt.data, pkt.size, libdav1d_data_free, pkt.buf); + if (res < 0) { + av_packet_unref(&pkt); + return res; + } + + data->m.timestamp = pkt.pts; + data->m.offset = pkt.pos; + data->m.duration = pkt.duration; + + pkt.buf = NULL; + av_packet_unref(&pkt); + } + } + + res = dav1d_send_data(dav1d->c, data); + if (res < 0) { + if (res == AVERROR(EINVAL)) + res = AVERROR_INVALIDDATA; + if (res != AVERROR(EAGAIN)) + return res; + } + + res = dav1d_get_picture(dav1d->c, p); + if (res < 0) { + if (res == AVERROR(EINVAL)) + res = AVERROR_INVALIDDATA; + else if (res == AVERROR(EAGAIN) && c->internal->draining) + res = AVERROR_EOF; + + return res; + } + -+ av_assert0(p->data[0] != NULL); ++ av_assert0(p->data[0] && p->allocator_data); + + // This requires the custom allocator above + frame->buf[0] = av_buffer_ref(p->allocator_data); + if (!frame->buf[0]) { + dav1d_picture_unref(p); + return AVERROR(ENOMEM); + } + + frame->data[0] = p->data[0]; + frame->data[1] = p->data[1]; + frame->data[2] = p->data[2]; + frame->linesize[0] = p->stride[0]; + frame->linesize[1] = p->stride[1]; + frame->linesize[2] = p->stride[1]; + + c->profile = p->seq_hdr->profile; -+ frame->format = c->pix_fmt = pix_fmt[p->p.layout][p->seq_hdr->hbd]; ++ c->level = ((p->seq_hdr->operating_points[0].major_level - 2) << 2) ++ | p->seq_hdr->operating_points[0].minor_level; + frame->width = p->p.w; + frame->height = p->p.h; + if (c->width != p->p.w || c->height != p->p.h) { + res = ff_set_dimensions(c, p->p.w, p->p.h); + if (res < 0) + goto fail; + } + + switch (p->seq_hdr->chr) { + case DAV1D_CHR_VERTICAL: + frame->chroma_location = c->chroma_sample_location = AVCHROMA_LOC_LEFT; + break; + case DAV1D_CHR_COLOCATED: + frame->chroma_location = c->chroma_sample_location = AVCHROMA_LOC_TOPLEFT; + break; + } + frame->colorspace = c->colorspace = (enum AVColorSpace) p->seq_hdr->mtrx; + frame->color_primaries = c->color_primaries = (enum AVColorPrimaries) p->seq_hdr->pri; + frame->color_trc = c->color_trc = (enum AVColorTransferCharacteristic) p->seq_hdr->trc; + frame->color_range = c->color_range = p->seq_hdr->color_range ? AVCOL_RANGE_JPEG : AVCOL_RANGE_MPEG; + ++ if (p->p.layout == DAV1D_PIXEL_LAYOUT_I444 && ++ p->seq_hdr->mtrx == DAV1D_MC_IDENTITY && ++ p->seq_hdr->pri == DAV1D_COLOR_PRI_BT709 && ++ p->seq_hdr->trc == DAV1D_TRC_SRGB) ++ frame->format = c->pix_fmt = pix_fmt_rgb[p->seq_hdr->hbd]; ++ else ++ frame->format = c->pix_fmt = pix_fmt[p->p.layout][p->seq_hdr->hbd]; ++ + // match timestamps and packet size + frame->pts = frame->best_effort_timestamp = p->m.timestamp; +#if FF_API_PKT_PTS +FF_DISABLE_DEPRECATION_WARNINGS + frame->pkt_pts = p->m.timestamp; +FF_ENABLE_DEPRECATION_WARNINGS +#endif + frame->pkt_dts = p->m.timestamp; + frame->pkt_pos = p->m.offset; + frame->pkt_size = p->m.size; + frame->pkt_duration = p->m.duration; + frame->key_frame = p->frame_hdr->frame_type == DAV1D_FRAME_TYPE_KEY; + + switch (p->frame_hdr->frame_type) { + case DAV1D_FRAME_TYPE_KEY: + case DAV1D_FRAME_TYPE_INTRA: + frame->pict_type = AV_PICTURE_TYPE_I; + break; + case DAV1D_FRAME_TYPE_INTER: + frame->pict_type = AV_PICTURE_TYPE_P; + break; + case DAV1D_FRAME_TYPE_SWITCH: + frame->pict_type = AV_PICTURE_TYPE_SP; + break; + default: + res = AVERROR_INVALIDDATA; + goto fail; + } + + if (p->mastering_display) { + AVMasteringDisplayMetadata *mastering = av_mastering_display_metadata_create_side_data(frame); + if (!mastering) { + res = AVERROR(ENOMEM); + goto fail; + } + + for (int i = 0; i < 3; i++) { + mastering->display_primaries[i][0] = av_make_q(p->mastering_display->primaries[i][0], 1 << 16); + mastering->display_primaries[i][1] = av_make_q(p->mastering_display->primaries[i][1], 1 << 16); + } + mastering->white_point[0] = av_make_q(p->mastering_display->white_point[0], 1 << 16); + mastering->white_point[1] = av_make_q(p->mastering_display->white_point[1], 1 << 16); + + mastering->max_luminance = av_make_q(p->mastering_display->max_luminance, 1 << 8); + mastering->min_luminance = av_make_q(p->mastering_display->min_luminance, 1 << 14); + + mastering->has_primaries = 1; + mastering->has_luminance = 1; + } + if (p->content_light) { + AVContentLightMetadata *light = av_content_light_metadata_create_side_data(frame); + if (!light) { + res = AVERROR(ENOMEM); + goto fail; + } + light->MaxCLL = p->content_light->max_content_light_level; + light->MaxFALL = p->content_light->max_frame_average_light_level; + } + + res = 0; +fail: + dav1d_picture_unref(p); + if (res < 0) + av_frame_unref(frame); + return res; +} + +static av_cold int libdav1d_close(AVCodecContext *c) +{ + Libdav1dContext *dav1d = c->priv_data; + + av_buffer_pool_uninit(&dav1d->pool); + dav1d_data_unref(&dav1d->data); + dav1d_close(&dav1d->c); + + return 0; +} + +#define OFFSET(x) offsetof(Libdav1dContext, x) +#define VD AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM +static const AVOption libdav1d_options[] = { -+ { "tilethreads", "Tile threads", OFFSET(tile_threads), AV_OPT_TYPE_INT, { .i64 = 1 }, 1, DAV1D_MAX_TILE_THREADS, VD }, ++ { "tilethreads", "Tile threads", OFFSET(tile_threads), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, DAV1D_MAX_TILE_THREADS, VD }, ++ { "framethreads", "Frame threads", OFFSET(frame_threads), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, DAV1D_MAX_FRAME_THREADS, VD }, + { "filmgrain", "Apply Film Grain", OFFSET(apply_grain), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, VD }, + { NULL } +}; + +static const AVClass libdav1d_class = { + .class_name = "libdav1d decoder", + .item_name = av_default_item_name, + .option = libdav1d_options, + .version = LIBAVUTIL_VERSION_INT, +}; + +AVCodec ff_libdav1d_decoder = { + .name = "libdav1d", + .long_name = NULL_IF_CONFIG_SMALL("dav1d AV1 decoder by VideoLAN"), + .type = AVMEDIA_TYPE_VIDEO, + .id = AV_CODEC_ID_AV1, + .priv_data_size = sizeof(Libdav1dContext), + .init = libdav1d_init, + .close = libdav1d_close, + .flush = libdav1d_flush, + .receive_frame = libdav1d_receive_frame, + .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AUTO_THREADS, + .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_SETS_PKT_DTS, + .priv_class = &libdav1d_class, + .wrapper_name = "libdav1d", +};