From 543654f2e7522bf1343e03490ed9e4586ff15e76 Mon Sep 17 00:00:00 2001 From: Vibhoothi Date: Mon, 13 Jan 2020 02:15:10 +0530 Subject: [PATCH 1/6] setup: Modernize libvpx This commit makes - Checkout to latest master - Remove broken feature flag --- setup.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.sh b/setup.sh index 5658386..c234d1f 100755 --- a/setup.sh +++ b/setup.sh @@ -23,8 +23,8 @@ fi # Check out the pinned libvpx version. pushd libvpx git fetch -git checkout --detach e758f9d45704ea0247c1b654f8602c967fa44199 +git checkout --detach master # Build libvpx -./configure --enable-pic --enable-experimental --enable-spatial-svc --enable-multi-res-encoding +./configure --enable-pic --enable-experimental --enable-multi-res-encoding make -j32 From fffba6911e738fc8424fda89d4f425a8a4131593 Mon Sep 17 00:00:00 2001 From: Vibhoothi Date: Mon, 13 Jan 2020 02:19:46 +0530 Subject: [PATCH 2/6] aom: Modernize aom_av1 This commit makes - Build av1 of master - Building cleaner --- setup_aom.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/setup_aom.sh b/setup_aom.sh index ab03f59..8533a15 100755 --- a/setup_aom.sh +++ b/setup_aom.sh @@ -23,8 +23,12 @@ fi # Check out the pinned aom version. pushd aom git fetch -git checkout --detach 09c0a5bcf57c58963516289ff2173576e3fa8378 +git checkout --detach master # Build aom -./configure --enable-pic +makdir build +cd build +cmake .. make -j32 +cp -rf aomenc ../aomenc +cp -rf aomdec ../aomdec From 7d69c2a944f311c94a755f0952d626af793596ac Mon Sep 17 00:00:00 2001 From: Vibhoothi Date: Mon, 13 Jan 2020 02:25:27 +0530 Subject: [PATCH 3/6] Use shasum instead of sha1sum This is in favour of making the builds more generic which unbreaks for macOS --- generate_data.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/generate_data.py b/generate_data.py index bf0dcd5..c578239 100755 --- a/generate_data.py +++ b/generate_data.py @@ -343,7 +343,7 @@ def prepare_clips(args, temp_dir): subprocess.check_call(['ffmpeg', '-y', '-i', clip['input_file'], yuv_file], stdout=devnull, stderr=devnull) clip['yuv_file'] = yuv_file for clip in clips: - clip['sha1sum'] = subprocess.check_output(['sha1sum', clip['input_file']]).split(' ', 1)[0] + clip['shasum'] = subprocess.check_output(['shasum', clip['input_file']]).split(' ', 1)[0] if 'yuv_file' not in clip: clip['yuv_file'] = clip['input_file'] frame_size = 6 * clip['width'] * clip['height'] / 4 @@ -470,7 +470,7 @@ def run_command(job, (command, encoded_files), job_temp_dir, encoded_file_dir): for i in range(len(results)): results_dict = results[i] results_dict['input-file'] = os.path.basename(clip['input_file']) - results_dict['input-file-sha1sum'] = clip['sha1sum'] + results_dict['input-file-shasum'] = clip['shasum'] results_dict['input-total-frames'] = clip['input_total_frames'] results_dict['frame-offset'] = args.frame_offset results_dict['bitrate-config-kbps'] = job['target_bitrates_kbps'] From 9df0036932d0a301d42c2169d56c681d2a48390d Mon Sep 17 00:00:00 2001 From: Vibhoothi Date: Mon, 13 Jan 2020 02:27:14 +0530 Subject: [PATCH 4/6] Introduce dav1d, the AV1 Decoder This Commit introduces dav1d, smallest and fastest AV1 Decoder --- setup_dav1d.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100755 setup_dav1d.sh diff --git a/setup_dav1d.sh b/setup_dav1d.sh new file mode 100755 index 0000000..d1d21b1 --- /dev/null +++ b/setup_dav1d.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +set -e +set -x + +if [ ! -d dav1d ]; then + git clone https://code.videolan.org/videolan/dav1d +fi + +# Check out to dav1d +pushd dav1d +git fetch + +# Build dav1d +mkdir build +cd build +meson .. --default-library=static +ninja \ No newline at end of file From 99ed801089dae0046c7905fd01f4a4466760475c Mon Sep 17 00:00:00 2001 From: Vibhoothi Date: Mon, 13 Jan 2020 02:32:39 +0530 Subject: [PATCH 5/6] Introduce rav1e, the AV1 Encoder This commit introduces rav1e, the AV1 Encoder - Encoding is happening at default speed level(6) - Decoding is done with the help of dav1d --- generate_data.py | 35 ++++++++++++++++++++++++++++++++++- setup_rav1e.sh | 16 ++++++++++++++++ 2 files changed, 50 insertions(+), 1 deletion(-) create mode 100755 setup_rav1e.sh diff --git a/generate_data.py b/generate_data.py index c578239..f0af793 100755 --- a/generate_data.py +++ b/generate_data.py @@ -231,6 +231,26 @@ def openh264_command(job, temp_dir): encoded_files = [{'spatial-layer': 0, 'temporal-layer': 0, 'filename': encoded_filename}] return ([str(i) for i in command], encoded_files) +def rav1e_command(job, temp_dir): + assert job['num_spatial_layers'] == 1 + assert job['num_temporal_layers'] == 1 + assert job['codec'] == 'rav1e' + assert job['encoder'] == 'rav1e-default' + + (fd, encoded_filename) = tempfile.mkstemp(dir=temp_dir, suffix=".ivf") + os.close(fd) + + clip = job['clip'] + + command = [ + 'rav1e/target/release/rav1e', + clip['input_file'], + '--tile-rows=2', + '--output=%s' % encoded_filename, + ] + + encoded_files = [{'spatial-layer': 0, 'temporal-layer': 0, 'filename': encoded_filename}] + return ([str(i) for i in command], encoded_files) def yami_command(job, temp_dir): assert job['num_spatial_layers'] == 1 @@ -263,6 +283,7 @@ def yami_command(job, temp_dir): encoder_commands = { 'aom-good' : aom_command, + 'rav1e-default' : rav1e_command, 'openh264' : openh264_command, 'libvpx-rt' : libvpx_command, 'yami' : yami_command, @@ -367,6 +388,8 @@ def prepare_clips(args, temp_dir): def decode_file(job, temp_dir, encoded_file): (fd, decoded_file) = tempfile.mkstemp(dir=temp_dir, suffix=".yuv") os.close(fd) + (fd, decoded_file_rav1e) = tempfile.mkstemp(dir=temp_dir, suffix=".y4m") + os.close(fd) (fd, framestats_file) = tempfile.mkstemp(dir=temp_dir, suffix=".csv") os.close(fd) with open(os.devnull, 'w') as devnull: @@ -377,7 +400,15 @@ def decode_file(job, temp_dir, encoded_file): subprocess.check_call(['openh264/h264dec', encoded_file, decoded_file], stdout=devnull, stderr=devnull) # TODO(pbos): Generate H264 framestats. framestats_file = None - return (decoded_file, framestats_file) + elif job['codec'] == 'rav1e': + decoder = 'dav1d/build/tools/dav1d' + subprocess.check_call([decoder,'-i', encoded_file,'-o', decoded_file_rav1e], stdout=devnull, stderr=devnull) + framestats_file = None + + if job['codec']=='rav1e': + return (decoded_file_rav1e, framestats_file) + else: + return (decoded_file, framestats_file) def add_framestats(results_dict, framestats_file, statstype): @@ -625,6 +656,8 @@ def main(): find_absolute_path(False, 'libvpx/vpxdec') elif codec == 'av1': find_absolute_path(False, 'aom/aomdec') + elif codec == 'rav1e': + find_absolute_path(False, 'dav1d/build/tools/dav1d') elif codec == 'h264': find_absolute_path(False, 'openh264/h264dec') if args.enable_vmaf: diff --git a/setup_rav1e.sh b/setup_rav1e.sh new file mode 100755 index 0000000..ecfe7d4 --- /dev/null +++ b/setup_rav1e.sh @@ -0,0 +1,16 @@ +#!/bin/bash +set -e +set -x + +# Download rav1e if not available +if [ ! -d rav1e ]; then + git clone http://github.com/xiph/rav1e +fi + +# Check out to rav1e +pushd rav1e +git fetch + +# Build rav1e +cargo build --release + From bac934a1f77ba558788d1dfc6884f1b722894ba3 Mon Sep 17 00:00:00 2001 From: Vibhoothi Date: Mon, 13 Jan 2020 02:40:00 +0530 Subject: [PATCH 6/6] Add Documentation for rav1e and dav1d --- README.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/README.md b/README.md index 4f33a89..bb638c0 100644 --- a/README.md +++ b/README.md @@ -84,6 +84,25 @@ OpenH264 is a single-pass encoder used in WebRTC both in Chrome and Firefox. This adds the `openh264:h264` which runs `h264enc` with settings that are intended to be close to WebRTC's implementation. +### dav1d + +To build dav1d, run: + + $ ./setup_dav1d.sh + +dav1d is a very fast av1 decoder developed by VideoLAN. + +### rav1e + +To build rav1e, run: + + $ ./setup_rav1e.sh + +rav1e is a AV1 Encoder which is intended to cover all use-cases where libaom +is very slow, it is written in rust. Gives near real-time encoding in higher +speed-levels. +To use rav1e use `rav1e-default:rav1e` + ## Generating Data To generate graph data (after building and installing dependencies), see: