Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ffmpeg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ jobs:
- uses: actions/checkout@v6
- name: Build vmaf
run: |
meson setup libvmaf libvmaf/build --buildtype release
sudo ninja -vC libvmaf/build install
meson setup builddir --buildtype release
sudo ninja -vC builddir install
- name: Prepare FFmpeg
run: |
git clone -q --branch master --depth=1 "https://github.com/FFmpeg/FFmpeg" ffmpeg
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/libvmaf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@ jobs:
- uses: actions/checkout@v6
- name: Run meson
run: |
meson setup libvmaf libvmaf/build --buildtype release --prefix $PWD/install -Denable_float=true
meson setup builddir --buildtype release --prefix $PWD/install -Denable_float=true
- name: Run ninja
run: |
sudo ninja -vC libvmaf/build install
sudo ninja -vC builddir install
- name: Run tests
run: |
sudo ninja -vC libvmaf/build test
sudo ninja -vC builddir test
- name: Set up tox
run: |
mkdir -p ~/.ccache && sudo chown -R $(whoami) ~/.ccache
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ jobs:
run: echo "name=CCACHE_DIR::$PWD/.ccache" >> $GITHUB_ENV

- name: Configure vmaf
run: meson setup libvmaf libvmaf/build --buildtype release --default-library static --prefix "$MINGW_PREFIX"
run: meson setup builddir --buildtype release --default-library static --prefix "$MINGW_PREFIX"
- name: Build vmaf
run: meson install -C libvmaf/build
run: meson install -C builddir

- name: Test vmaf
run: meson test -C libvmaf/build --num-processes $(nproc)
run: meson test -C builddir --num-processes $(nproc)

- name: Get binary path & Current Release
id: get_info
Expand Down
11 changes: 5 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ ENABLE_NVCC := true
ENABLE_CUDA := -Denable_cuda=true -Denable_nvcc=$(ENABLE_NVCC)

# Directories
LIBVMAF_DIR := libvmaf
BUILD_DIR := $(LIBVMAF_DIR)/build
DEBUG_DIR := $(LIBVMAF_DIR)/debug
BUILD_DIR := builddir
DEBUG_DIR := builddir-debug

.PHONY: default all debug build install cythonize clean distclean cythonize-deps

Expand All @@ -32,10 +31,10 @@ default: build
all: build debug install test cythonize

$(BUILD_DIR): $(MESON) $(NINJA)
PATH="$(VENV)/bin:$$PATH" $(MESON_SETUP) $(BUILD_DIR) $(LIBVMAF_DIR) $(BUILDTYPE_RELEASE) $(ENABLE_FLOAT) $(ENABLE_CUDA)
PATH="$(VENV)/bin:$$PATH" $(MESON_SETUP) $(BUILD_DIR) $(BUILDTYPE_RELEASE) $(ENABLE_FLOAT) $(ENABLE_CUDA)

$(DEBUG_DIR): $(MESON) $(NINJA)
PATH="$(VENV)/bin:$$PATH" $(MESON_SETUP) $(DEBUG_DIR) $(LIBVMAF_DIR) $(BUILDTYPE_DEBUG) $(ENABLE_FLOAT) $(ENABLE_CUDA)
PATH="$(VENV)/bin:$$PATH" $(MESON_SETUP) $(DEBUG_DIR) $(BUILDTYPE_DEBUG) $(ENABLE_FLOAT) $(ENABLE_CUDA)

cythonize: cythonize-deps
pushd python && ../$(VENV_PYTHON) setup.py build_ext --build-lib . && popd || exit 1
Expand Down Expand Up @@ -73,4 +72,4 @@ $(NINJA): $(VENV_PIP)
$(VENV_PIP) install ninja || { echo "Failed to install ninja"; exit 1; }

cythonize-deps: $(VENV_PIP)
$(VENV_PIP) install setuptools cython numpy || { echo "Failed to install dependencies"; exit 1; }
$(VENV_PIP) install setuptools cython numpy || { echo "Failed to install dependencies"; exit 1; }
6 changes: 3 additions & 3 deletions libvmaf/include/libvmaf/libvmaf.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
#include <stdint.h>
#include <stdio.h>

#include "libvmaf/model.h"
#include "libvmaf/picture.h"
#include "libvmaf/feature.h"
#include <libvmaf/model.h>
#include <libvmaf/picture.h>
#include <libvmaf/feature.h>

#ifdef __cplusplus
extern "C" {
Expand Down
2 changes: 1 addition & 1 deletion libvmaf/include/libvmaf/libvmaf_cuda.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#ifndef __VMAF_CUDA_H__
#define __VMAF_CUDA_H__

#include "libvmaf/libvmaf.h"
#include <libvmaf/libvmaf.h>

#ifdef __cplusplus
extern "C" {
Expand Down
5 changes: 5 additions & 0 deletions libvmaf/include/libvmaf/meson.build
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
vmaf_api_version_array = meson.project_version().split('.')
vmaf_api_version_major = vmaf_api_version_array[0]
vmaf_api_version_minor = vmaf_api_version_array[1]
vmaf_api_version_revision = vmaf_api_version_array[2]

# installed version.h header generation
version_h_data = configuration_data()
version_h_data.set('VMAF_API_VERSION_MAJOR', vmaf_api_version_major)
Expand Down
2 changes: 1 addition & 1 deletion libvmaf/include/libvmaf/model.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

#include <stdint.h>

#include "feature.h"
#include <libvmaf/feature.h>

#ifdef __cplusplus
extern "C" {
Expand Down
4 changes: 3 additions & 1 deletion libvmaf/include/meson.build
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Revision file (vcs_version.h) generation
vmaf_git_dir = join_paths(libvmaf_src_root + '/../', '.git')
vmaf_git_dir = meson.project_source_root() / '.git'
rev_target = vcs_tag(command: [
'git', '--git-dir', vmaf_git_dir,
'describe', '--tags', '--long',
Expand All @@ -9,4 +9,6 @@ rev_target = vcs_tag(command: [
output: 'vcs_version.h'
)

libvmaf_inc = include_directories('.')

subdir('libvmaf')
38 changes: 1 addition & 37 deletions libvmaf/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -8,43 +8,7 @@ project('libvmaf', ['c', 'cpp'],
],
meson_version: '>= 0.56.1')

vmaf_soname_version = '3.0.0'
vmaf_api_version_array = vmaf_soname_version.split('.')
vmaf_api_version_major = vmaf_api_version_array[0]
vmaf_api_version_minor = vmaf_api_version_array[1]
vmaf_api_version_revision = vmaf_api_version_array[2]

libvmaf_src_root = meson.current_source_dir()
cc = meson.get_compiler('c')
libvmaf_inc = include_directories(['include'])

# Arguments in test_args will be used even on feature tests
test_args = []
if host_machine.system() == 'linux' or host_machine.system() == 'windows' or host_machine.system() == 'cygwin'
test_args += '-D_GNU_SOURCE'
add_project_arguments('-D_GNU_SOURCE', language: ['c', 'cpp'])
elif host_machine.system() == 'darwin'
test_args += '-D_DARWIN_C_SOURCE'
add_project_arguments('-D_DARWIN_C_SOURCE', language: ['c', 'cpp'])
endif

# Header checks
stdatomic_dependency = []
if not cc.check_header('stdatomic.h')
if cc.get_id() == 'msvc'
# we have a custom replacement for MSVC
stdatomic_dependency = declare_dependency(
include_directories : include_directories('src/compat/msvc'),
)
elif cc.compiles('''int main() { int v = 0; return __atomic_fetch_add(&v, 1, __ATOMIC_SEQ_CST); }''',
name : 'GCC-style atomics', args : test_args)
stdatomic_dependency = declare_dependency(
include_directories : include_directories('src/compat/gcc'),
)
else
error('Atomics not supported')
endif
endif
warning('Please run meson in top source directory instead of libvmaf/ subdir.')

subdir('include')
subdir('src')
Expand Down
36 changes: 34 additions & 2 deletions libvmaf/src/meson.build
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
vmaf_soname_version = vmaf_api_version_major + '.0.0'
vmaf_soversion = vmaf_api_version_major

# Build libvmaf
Expand All @@ -8,6 +9,36 @@ cuda_dir = './cuda/'

vmaf_base_include = include_directories('./', './feature/common')

cc = meson.get_compiler('c')

# Arguments in test_args will be used even on feature tests
test_args = []
if host_machine.system() == 'linux' or host_machine.system() == 'windows' or host_machine.system() == 'cygwin'
test_args += '-D_GNU_SOURCE'
add_project_arguments('-D_GNU_SOURCE', language: ['c', 'cpp'])
elif host_machine.system() == 'darwin'
test_args += '-D_DARWIN_C_SOURCE'
add_project_arguments('-D_DARWIN_C_SOURCE', language: ['c', 'cpp'])
endif

# Header checks
stdatomic_dependency = []
if not cc.check_header('stdatomic.h')
if cc.get_id() == 'msvc'
# we have a custom replacement for MSVC
stdatomic_dependency = declare_dependency(
include_directories : include_directories('src/compat/msvc'),
)
elif cc.compiles('''int main() { int v = 0; return __atomic_fetch_add(&v, 1, __ATOMIC_SEQ_CST); }''',
name : 'GCC-style atomics', args : test_args)
stdatomic_dependency = declare_dependency(
include_directories : include_directories('src/compat/gcc'),
)
else
error('Atomics not supported')
endif
endif

if cc.get_id() != 'msvc'
vmaf_cflags_common = [
'-pedantic',
Expand Down Expand Up @@ -111,7 +142,7 @@ if is_asm_enabled
depfile: '@[email protected]',
arguments: [
'-f', nasm_format,
'-I', '@0@/src/'.format(libvmaf_src_root),
'-I', '@0@/'.format(meson.current_source_dir()),
'-I', '@0@/'.format(meson.current_build_dir()),
'-MQ', '@OUTPUT@', '-MF', '@DEPFILE@',
'@EXTRA_ARGS@',
Expand Down Expand Up @@ -561,7 +592,7 @@ libvmaf = library(
libvmaf_cpu_static_lib.extract_all_objects(recursive: true),
libsvm_static_lib.extract_all_objects(recursive: true),
],
version : vmaf_soname_version,
version: vmaf_soname_version,
soversion : vmaf_soversion,
install: true,
)
Expand All @@ -572,5 +603,6 @@ pkg_mod.generate(libraries: libvmaf,
name: 'libvmaf',
filebase: 'libvmaf',
description: 'VMAF, Video Multimethod Assessment Fusion',
# FIXME: We should remove libvmaf, but FFmpeg relies on it for now.
subdirs: [ '.', 'libvmaf']
)
15 changes: 15 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
project('libvmaf', ['c', 'cpp'],
version : '3.0.0',
default_options : ['c_std=c11',
'cpp_std=c++11',
'warning_level=2',
'buildtype=release',
'default_library=both',
],
meson_version: '>= 0.56.1')

subdir('libvmaf/include')
subdir('libvmaf/src')
subdir('libvmaf/tools')
subdir('libvmaf/doc')
subdir('libvmaf/test')
44 changes: 44 additions & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
option('enable_tests',
type: 'boolean',
value: true,
description: 'Build libvmaf tests')

option('enable_docs',
type: 'boolean',
value: true,
description: 'Build libvmaf documentation')

option('enable_asm',
type: 'boolean',
value: true,
description: 'Build asm files, if available')

option('enable_avx512',
type: 'boolean',
value: true,
description: 'Build AVX-512 asm files, requires nasm 2.14')

option('built_in_models',
type: 'boolean',
value: true,
description: 'Compile default vmaf models into the library')

option('enable_float',
type: 'boolean',
value: false,
description: 'Compile floating-point feature extractors into the library')

option('enable_cuda',
type: 'boolean',
value: false,
description: 'Enable CUDA support')

option('enable_nvtx',
type: 'boolean',
value: false,
description: 'Enable NVTX range support')

option('enable_nvcc',
type: 'boolean',
value: true,
description: 'Use clang to compile CUDA code.')
4 changes: 2 additions & 2 deletions resource/doc/windows.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ We are going to build vmaf in Windows. These steps are in accordance with the co

cd <Vmaf project root directory>
mkdir C:/vmaf-install
meson setup libvmaf libvmaf/build --buildtype release --default-library static --prefix C:/vmaf-install
meson install -C libvmaf/build
meson setup builddir --buildtype release --default-library static --prefix C:/vmaf-install
meson install -C builddir