forge
Explore
Log in

Don't you dare go Hollow

edith_codecs

Clone
★ 0

0 watching0 forksRust370.3 MiB9b67700Tahinli3 days ago4021 commits

hevc-intra-bd.sh36 lines, 1.8 KiBHistoryRawDownload
1#!/usr/bin/env bash
2# hevc-intra-bd.sh: intra-only (keyint=1) BD-rate of ec-h265 against x265 intra on the three
3# clips the ec-h265 encode gate names. Thin wrapper over scripts/hevc-bdrate.sh with GOP 1.
4# Clips are generated with ffmpeg lavfi (no copyrighted media) into $DATA.
5#
6# The x265 anchor uses -tune psnr by default (see hevc-bdrate.sh). Set X265_TUNE= for x265's
7# default tuning. Each tuning writes its own point files under $DATA/tune-<name>/.
8#
9# Usage: scripts/hevc-intra-bd.sh <clip-name|all> [QPS]
10# clip-name: testsrc2-352x288 | testsrc2-1280x720 | natural-1280x720 | all
11# Environment: DATA (default $HOME/.cache/hevcintra-data).
12set -euo pipefail
13here=$(cd "$(dirname "$0")/.." && pwd)
14which=${1:-all}
15qps=${2:-"22 27 32 37"}
16data=${DATA:-$HOME/.cache/hevcintra-data}
17mkdir -p "$data"
18frames=30
19gen() { # gen <out.yuv> <lavfi graph>
20 [ -f "$1" ] || ffmpeg -v error -y -f lavfi -i "$2" -frames:v $frames -pix_fmt yuv420p -f rawvideo "$1"
21}
22gen "$data/testsrc2-352x288.yuv" "testsrc2=size=352x288:rate=30"
23gen "$data/testsrc2-1280x720.yuv" "testsrc2=size=1280x720:rate=30"
24# "natural": a moving mandelbrot zoom blended with testsrc2 and film-like noise (the
25# gen-hevcperf-fixtures.sh moving clip), so it has texture rather than flat synthetic edges.
26[ -f "$data/natural-1280x720.yuv" ] || ffmpeg -v error -y \
27 -f lavfi -i "mandelbrot=size=1280x720:rate=30" \
28 -f lavfi -i "testsrc2=size=1280x720:rate=30" \
29 -filter_complex "[0:v][1:v]blend=all_mode=average,noise=alls=8:allf=t,format=yuv420p[v]" \
30 -map "[v]" -frames:v $frames -f rawvideo "$data/natural-1280x720.yuv"
31for spec in "testsrc2-352x288 352 288" "testsrc2-1280x720 1280 720" "natural-1280x720 1280 720"; do
32 set -- $spec
33 [ "$which" = all ] || [ "$which" = "$1" ] || continue
34 DATA="$data/tune-${X265_TUNE-psnr}" "$here/scripts/hevc-bdrate.sh" "$data/$1.yuv" "$2" "$3" 1 "$qps"
35 echo "----"
36done