Compare commits

...

5 commits

Author SHA1 Message Date
redzic d9a7418ccd
Temporarily disable docker caching via cargo-chef (#643) 2022-06-30 19:19:26 +00:00
FreezyLemon 8f617ec68f
Create workflow for Windows builds (#638)
Co-authored-by: FreezyLemon <freezylemon@protonmail.com>
2022-06-26 09:27:13 +00:00
Zen 7af57610c8
vmaf_percentile to 1, default vmaf rate to 1 (#641)
* vmaf_percentile to 1, default vmaf rate to 1

* fix default

Co-authored-by: Redzic <yusufredzic@gmail.com>
2022-06-25 19:44:15 +00:00
redzic 1a1c679c73
Change progress bar characters (#640) 2022-06-22 21:45:10 +00:00
redzic dfdc2c6703
Fix clippy warnings (#639) 2022-06-20 19:53:07 +00:00
10 changed files with 119 additions and 25 deletions

90
.github/workflows/windows-build.yml vendored Normal file
View file

@ -0,0 +1,90 @@
name: Build Av1an (Windows x64)
on: workflow_dispatch
jobs:
build:
runs-on: windows-2022
env:
vsynth_ver: R58
vsynth_path: C:\Program Files\Vapoursynth
steps:
- name: Python 3.10 setup
uses: actions/setup-python@v4
with:
python-version: '~3.10'
architecture: x64
- name: NASM setup
uses: ilammy/setup-nasm@v1
with:
version: 2.15.05
from-source: false
- name: PowerShell module installation
uses: potatoqualitee/psmodulecache@v4.5
with:
modules-to-cache: 7Zip4Powershell
- name: FFmpeg hashsum
run: |
$hashSum = (Invoke-WebRequest 'https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-full-shared.7z.sha256').Content
echo "ff_hash=$hashSum" | Out-File $env:GITHUB_ENV -Append
Write-Output "Latest release: $hashSum"
- name: FFmpeg cache check
id: cache-ff
uses: actions/cache@v3
with:
path: C:\ffmpeg
key: ff-${{ env.ff_hash }}
- if: steps.cache-ff.outputs.cache-hit != 'true'
name: FFmpeg installation
run: |
$tempFile = New-TemporaryFile
Invoke-WebRequest 'https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-full-shared.7z' -OutFile $tempFile -TimeoutSec 10
Expand-7Zip $tempFile 'C:\ffmpeg'
- name: FFmpeg environment variable
run: |
$ffDir = Get-Item "C:\ffmpeg\ffmpeg*shared" | Select-Object -First 1 -ExpandProperty FullName
echo "FFMPEG_DIR=$ffDir" | Out-File $env:GITHUB_ENV -Append
- name: VapourSynth cache check
id: cache-vsynth
uses: actions/cache@v3
with:
path: ${{ env.vsynth_path }}
key: vsynth-${{ env.vsynth_ver }}
- if: steps.cache-vsynth.outputs.cache-hit != 'true'
name: VapourSynth installation
run: |
$tempFile = New-TemporaryFile
$uri = 'https://github.com/vapoursynth/vapoursynth/releases/download/VER/VapourSynth64-Portable-VER.7z'.Replace('VER', "${{ env.vsynth_ver }}")
Invoke-WebRequest $uri -OutFile $tempFile -TimeoutSec 10
Expand-7Zip $tempFile $env:vsynth_path
- uses: actions/checkout@v3
- name: Package cache check
uses: actions/cache@v3
with:
path: |
~\.cargo\git
~\.cargo\registry
key: cargo-${{ hashFiles('**\Cargo.toml', '**\Cargo.lock') }}
restore-keys: cargo-
- name: Av1an build
env:
CARGO_TERM_COLOR: always
run: cargo build -rv
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: av1an
path: target/release/av1an.exe

View file

@ -1,6 +1,6 @@
FROM archlinux:base-devel AS base
RUN pacman -Syy --noconfirm
RUN pacman -Syyu --noconfirm
# Install dependancies needed by all steps including runtime step
RUN pacman -S --noconfirm aom ffmpeg vapoursynth ffms2 libvpx mkvtoolnix-cli svt-av1 vapoursynth-plugin-lsmashsource vmaf
@ -11,20 +11,23 @@ FROM base AS build-base
# Install dependancies needed by build steps
RUN pacman -S --noconfirm rust clang nasm git
RUN cargo install cargo-chef
# TODO reimplement caching via cargo-chef after it properly fixes its --profile support
# RUN cargo install cargo-chef
WORKDIR /tmp/Av1an
FROM build-base AS planner
COPY . .
RUN cargo chef prepare --recipe-path recipe.json
# See previous TODO
# COPY . .
# RUN cargo chef prepare
FROM build-base AS cacher
COPY --from=planner /tmp/Av1an/recipe.json recipe.json
RUN cargo chef cook --release --recipe-path recipe.json
# See previous TODO
# COPY --from=planner /tmp/Av1an/recipe.json recipe.json
# RUN cargo chef cook --release
FROM build-base AS build
@ -40,8 +43,9 @@ RUN git clone https://github.com/xiph/rav1e && \
# Build av1an
COPY . /tmp/Av1an
# See previous TODO
# Copy over the cached dependencies
COPY --from=cacher /tmp/Av1an/target /tmp/Av1an/target
# COPY --from=cacher /tmp/Av1an/target /tmp/Av1an/target
RUN cargo build --release && \
mv ./target/release/av1an /usr/local/bin && \

View file

@ -462,7 +462,7 @@ pub struct CliOpts {
pub probes: u32,
/// Framerate for probes, 1 - original
#[clap(long, default_value_t = 4, help_heading = "TARGET QUALITY")]
#[clap(long, default_value_t = 1, help_heading = "TARGET QUALITY")]
pub probing_rate: u32,
/// Use encoding settings for probes specified by --video-params rather than faster, less accurate settings

View file

@ -20,7 +20,7 @@ const NULL: &str = if cfg!(windows) { "nul" } else { "/dev/null" };
#[allow(non_camel_case_types)]
#[derive(
Clone, Copy, PartialEq, Serialize, Deserialize, Debug, strum::EnumString, strum::IntoStaticStr,
Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Debug, strum::EnumString, strum::IntoStaticStr,
)]
pub enum Encoder {
aom,

View file

@ -16,6 +16,7 @@
#![allow(clippy::drop_ref)]
#![allow(clippy::unsafe_derive_deserialize)]
#![allow(clippy::needless_pass_by_value)]
#![allow(clippy::use_self)]
#[macro_use]
extern crate log;
@ -364,7 +365,7 @@ fn save_chunk_queue(temp: &str, chunk_queue: &[Chunk]) -> anyhow::Result<()> {
Ok(())
}
#[derive(Clone, Copy, PartialEq)]
#[derive(Clone, Copy, PartialEq, Eq)]
pub enum Verbosity {
Verbose,
Normal,

View file

@ -4,12 +4,14 @@ use once_cell::sync::OnceCell;
use crate::util::printable_base10_digits;
use crate::{get_done, Verbosity};
const PROGRESS_CHARS: &str = "█▉▊▋▌▍▎▏ ";
const INDICATIF_PROGRESS_TEMPLATE: &str = if cfg!(windows) {
// Do not use a spinner on Windows since the default console cannot display
// the characters used for the spinner
"{elapsed_precise:.bold} [{wide_bar:.blue/white.dim}] {percent:.bold} {pos} ({fps:.bold}, eta {eta}{msg})"
"{elapsed_precise:.bold} ▕{wide_bar:.blue/white.dim}▏ {percent:.bold} {pos} ({fps:.bold}, eta {eta}{msg})"
} else {
"{spinner:.green.bold} {elapsed_precise:.bold} [{wide_bar:.blue/white.dim}] {percent:.bold} {pos} ({fps:.bold}, eta {eta}{msg})"
"{spinner:.green.bold} {elapsed_precise:.bold} ▕{wide_bar:.blue/white.dim}▏ {percent:.bold} {pos} ({fps:.bold}, eta {eta}{msg})"
};
const INDICATIF_SPINNER_TEMPLATE: &str = if cfg!(windows) {
@ -38,7 +40,7 @@ fn pretty_progress_style() -> ProgressStyle {
.with_key("percent", |state| {
format!("{:>3.0}%", state.fraction() * 100_f32)
})
.progress_chars("#>-")
.progress_chars(PROGRESS_CHARS)
}
fn spinner_style() -> ProgressStyle {
@ -50,7 +52,7 @@ fn spinner_style() -> ProgressStyle {
fps => format!("{:.2} fps", fps),
})
.with_key("pos", |state| format!("{}", state.pos))
.progress_chars("#>-")
.progress_chars(PROGRESS_CHARS)
}
/// Initialize progress bar

View file

@ -1347,10 +1347,7 @@ properly into a mkv file. Specify mkvmerge as the concatenation method by settin
self.vmaf_path.as_deref(),
self.vmaf_res.as_str(),
1,
match self.vmaf_filter.as_deref() {
Some(filter) => Some(filter),
None => None,
},
self.vmaf_filter.as_deref(),
self.vmaf_threads.unwrap_or_else(|| {
available_parallelism()
.expect("Unrecoverable: Failed to get thread count")

View file

@ -15,7 +15,7 @@ use crate::settings::EncodeArgs;
use crate::vmaf::{self, read_weighted_vmaf};
use crate::Encoder;
const VMAF_PERCENTILE: f64 = 0.25;
const VMAF_PERCENTILE: f64 = 0.01;
// TODO: just make it take a reference to a `Project`
pub struct TargetQuality<'a> {
@ -382,7 +382,7 @@ pub fn log_probes(
pub const fn adapt_probing_rate(rate: usize) -> usize {
match rate {
1..=4 => rate,
_ => 4,
_ => 1,
}
}

View file

@ -6,9 +6,9 @@ use std::path::{Path, PathBuf};
#[macro_export]
macro_rules! count {
() => (0_usize);
($x:tt, $($xs:tt),*) => (1_usize + crate::count!($($xs)*));
($x:tt, $($xs:tt)*) => (1_usize + crate::count!($($xs)*));
($x:tt $($xs:tt)*) => (1_usize + crate::count!($($xs)*));
($x:tt, $($xs:tt),*) => (1_usize + $crate::count!($($xs)*));
($x:tt, $($xs:tt)*) => (1_usize + $crate::count!($($xs)*));
($x:tt $($xs:tt)*) => (1_usize + $crate::count!($($xs)*));
}
/// Equivalent to `into_vec!` when the inferred type is `Cow<'_, str>`.
@ -26,7 +26,7 @@ macro_rules! inplace_vec {
use std::mem::{self, MaybeUninit};
use std::borrow::Cow;
const SIZE: usize = crate::count!($($x)*);
const SIZE: usize = $crate::count!($($x)*);
#[allow(unused_assignments)]
#[allow(clippy::transmute_undefined_repr)]
unsafe {

View file

@ -203,7 +203,7 @@ pub fn run_vmaf(
)
};
let mut source_pipe = if let [cmd, args @ ..] = &*reference_pipe_cmd {
let mut source_pipe = if let [cmd, args @ ..] = reference_pipe_cmd {
let mut source_pipe = Command::new(cmd);
source_pipe.args(args);
source_pipe.stdout(Stdio::piped());