Fix build with vmaf 1.3.9 (add back libvmaf support)

This commit is contained in:
Daniel Bermond
2018-08-10 21:23:49 +00:00
parent 14b1ac3b7d
commit 55c94c2e71
3 changed files with 90 additions and 9 deletions
+4 -1
View File
@@ -1,7 +1,7 @@
pkgbase = ffmpeg-full
pkgdesc = Complete solution to record, convert and stream audio and video (all possible features including nvenc, qsv and libfdk-aac)
pkgver = 4.0.2
pkgrel = 3
pkgrel = 4
url = http://www.ffmpeg.org/
arch = i686
arch = x86_64
@@ -125,8 +125,11 @@ pkgbase = ffmpeg-full
source = LICENSE
sha256sums = a95c0cc9eb990e94031d2183f2e6e444cc61c99f6f182d1575c433d62afb2f97
sha256sums = 04a7176400907fd7db0d69116b99de49e582a6e176b3bfb36a03e50a4cb26a36
source_x86_64 = vmaf-1.3.9-fix.patch
depends_x86_64 = cuda
depends_x86_64 = intel-media-sdk
makedepends_x86_64 = vmaf
sha256sums_x86_64 = 4eab61257adfdae2233cf8e5a12bd4d1e551b69711c8b4d14cffdd0f2c85812b
pkgname = ffmpeg-full
+13 -8
View File
@@ -4,7 +4,7 @@
pkgname=ffmpeg-full
_srcname=ffmpeg
pkgver=4.0.2
pkgrel=3
pkgrel=4
pkgdesc='Complete solution to record, convert and stream audio and video (all possible features including nvenc, qsv and libfdk-aac)'
arch=('i686' 'x86_64')
url='http://www.ffmpeg.org/'
@@ -39,10 +39,10 @@ makedepends=(
# AUR:
'blackmagic-decklink-sdk'
)
#makedepends_x86_64=(
# # AUR:
# 'vmaf'
#)
makedepends_x86_64=(
# AUR:
'vmaf'
)
provides=(
'ffmpeg' 'ffmpeg-full-nvenc' 'ffmpeg-nvenc' 'ffmpeg-libfdk_aac' 'ffmpeg-decklink'
'qt-faststart' 'libavutil.so' 'libavcodec.so' 'libavformat.so' 'libavdevice.so'
@@ -55,12 +55,17 @@ conflicts=(
)
source=("https://ffmpeg.org/releases/ffmpeg-${pkgver}.tar.xz"
'LICENSE')
source_x86_64=('vmaf-1.3.9-fix.patch')
sha256sums=('a95c0cc9eb990e94031d2183f2e6e444cc61c99f6f182d1575c433d62afb2f97'
'04a7176400907fd7db0d69116b99de49e582a6e176b3bfb36a03e50a4cb26a36')
sha256sums_x86_64=('4eab61257adfdae2233cf8e5a12bd4d1e551b69711c8b4d14cffdd0f2c85812b')
prepare() {
cd "${_srcname}-${pkgver}"
# fix build with vmaf 1.3.9 (x86_64 only)
[ "$CARCH" = 'x86_64' ] && patch -Np1 -i "${srcdir}/vmaf-1.3.9-fix.patch"
# strictly specifying nvcc path is needed if package is installing
# cuda for the first time (nvcc path will be in $PATH only after relogin)
sed -i "s|^nvcc_default=.*|nvcc_default='/opt/cuda/bin/nvcc'|" configure
@@ -72,7 +77,7 @@ build() {
# set x86_64 specific options
if [ "$CARCH" = 'x86_64' ]
then
local _libvmaf='--disable-libvmaf'
local _libvmaf='--enable-libvmaf'
local _cudasdk='--enable-cuda-sdk'
local _libmfx='--enable-libmfx'
local _libnpp='--enable-libnpp'
@@ -218,6 +223,6 @@ package() {
make DESTDIR="$pkgdir" install
install -D -m755 tools/qt-faststart "${pkgdir}/usr/bin/qt-faststart"
install -D -m644 "${srcdir}/LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
install -D -m755 tools/qt-faststart -t "${pkgdir}/usr/bin"
install -D -m644 "${srcdir}/LICENSE" -t "${pkgdir}/usr/share/licenses/${pkgname}"
}
+73
View File
@@ -0,0 +1,73 @@
diff -Naurp a/configure b/configure
--- a/configure 2018-07-18 13:51:59.000000000 +0000
+++ b/configure 2018-08-10 21:09:52.000000000 +0000
@@ -6043,7 +6043,7 @@ enabled libtwolame && require lib
die "ERROR: libtwolame must be installed and version must be >= 0.3.10"; }
enabled libv4l2 && require_pkg_config libv4l2 libv4l2 libv4l2.h v4l2_ioctl
enabled libvidstab && require_pkg_config libvidstab "vidstab >= 0.98" vid.stab/libvidstab.h vsMotionDetectInit
-enabled libvmaf && require_pkg_config libvmaf "libvmaf >= 0.6.2" libvmaf.h compute_vmaf
+enabled libvmaf && require_pkg_config libvmaf "libvmaf >= 1.3.9" libvmaf.h compute_vmaf
enabled libvo_amrwbenc && require libvo_amrwbenc vo-amrwbenc/enc_if.h E_IF_init -lvo-amrwbenc
enabled libvorbis && require_pkg_config libvorbis vorbis vorbis/codec.h vorbis_info_init &&
require_pkg_config libvorbisenc vorbisenc vorbis/vorbisenc.h vorbis_encode_init
diff -Naurp a/doc/filters.texi b/doc/filters.texi
--- a/doc/filters.texi 2018-07-18 13:51:59.000000000 +0000
+++ b/doc/filters.texi 2018-08-10 21:09:52.000000000 +0000
@@ -10425,7 +10425,7 @@ The obtained VMAF score is printed throu
It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
After installing the library it can be enabled using:
-@code{./configure --enable-libvmaf}.
+@code{./configure --enable-libvmaf --enable-version3}.
If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
The filter has following options:
@@ -10459,6 +10459,15 @@ Enables computing ms_ssim along with vma
@item pool
Set the pool method (mean, min or harmonic mean) to be used for computing vmaf.
+
+@item n_threads
+Set number of threads to be used when computing vmaf.
+
+@item n_subsample
+Set interval for frame subsampling used when computing vmaf.
+
+@item enable_conf_interval
+Enables confidence interval.
@end table
This filter also supports the @ref{framesync} options.
diff -Naurp a/libavfilter/vf_libvmaf.c b/libavfilter/vf_libvmaf.c
--- a/libavfilter/vf_libvmaf.c 2018-07-18 13:52:01.000000000 +0000
+++ b/libavfilter/vf_libvmaf.c 2018-08-10 21:09:52.000000000 +0000
@@ -61,6 +61,9 @@ typedef struct LIBVMAFContext {
int ssim;
int ms_ssim;
char *pool;
+ int n_threads;
+ int n_subsample;
+ int enable_conf_interval;
int error;
} LIBVMAFContext;
@@ -77,6 +80,9 @@ static const AVOption libvmaf_options[]
{"ssim", "Enables computing ssim along with vmaf.", OFFSET(ssim), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS},
{"ms_ssim", "Enables computing ms-ssim along with vmaf.", OFFSET(ms_ssim), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS},
{"pool", "Set the pool method to be used for computing vmaf.", OFFSET(pool), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 1, FLAGS},
+ {"n_threads", "Set number of threads to be used when computing vmaf.", OFFSET(n_threads), AV_OPT_TYPE_INT, {.i64=0}, 0, UINT_MAX, FLAGS},
+ {"n_subsample", "Set interval for frame subsampling used when computing vmaf.", OFFSET(n_subsample), AV_OPT_TYPE_INT, {.i64=1}, 1, UINT_MAX, FLAGS},
+ {"enable_conf_interval", "Enables confidence interval.", OFFSET(enable_conf_interval), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS},
{ NULL }
};
@@ -165,7 +171,8 @@ static void compute_vmaf_score(LIBVMAFCo
read_frame, s, s->model_path, s->log_path,
s->log_fmt, 0, 0, s->enable_transform,
s->phone_model, s->psnr, s->ssim,
- s->ms_ssim, s->pool);
+ s->ms_ssim, s->pool,
+ s->n_threads, s->n_subsample, s->enable_conf_interval);
}
static void *call_vmaf(void *ctx)