* Automatically add cq-level arg if it is not present
Currently, target quality requires a cq-level (or equivalent for the
encoder) arg to be present in order to work, so that it can replace the
existing cq-level with the new one. This commit makes it so that if the
arg is not present, av1an will insert it with the proper quality level.
* Use format! for insert_q
Co-authored-by: Redzic <yusufredzic@gmail.com>
* Add mergify config
This config includes the following rules:
- Automatically merge once a PR passes all tests and is approved.
- Automatically backport each PR from our main branch into our stable branch
* Merge all tests into one run
* Cleanup and speed up test suite
* Migrate to a docker image with dav1d
* Create CI profile with debug assertions enabled
* Use faster params for all encoders
Co-authored-by: Redzic <yusufredzic@gmail.com>
aomenc has had a history of crashes related to TPL on certain
chunks, particularly in videos with less motion, such as animated
content. This commit enables a workaround to retry a chunk with TPL
disabled if such a crash is detected. Although there is some amount of
psychovisual quality loss with TPL disabled, this is preferable to being
unable to complete the encode.
* Avoid multiple deserialization of same VMAF json score file
This avoids multiple deserialization of the same VMAF json file
when plotting the VMAF file by deserializing once and sorting,
but still using select_nth_unstable_by in the case of
read_weighted_vmaf which is now only called if we want a single
percentile out of the VMAF file.
* Fix small spelling errors
* Replace panic with error return
* Replace last regex with hand written parser
* Update dependencies
* Fix clippy warnings
* Adjust idx check
* More idiomatic rust
This is not in `master` as indicatif at 15 fps is already too slow
in some situations, so we don't want to slow it down further until
further investigation has been done.
* Add kbps and final file size estimates to progress bar
This looks at the size of each chunk when it completes and saves that
size in kilobytes into the done.json file. For backwards compatibility
for encodes resumed from an earlier version of av1an, if the done.json
does not contain the chunk size, then on resume, av1an will lookup the
size of that chunk. The estimates on the progress bar also handle
resumes and chunk crashes gracefully.
* Include audio size in estimates
This argument optionally allows the scene detection to run on a
different pixel format, which allows you to for example run 8-bit scene
detection on a 10-bit source, which can be much faster.
This option is unstable because ideally we would instead have this
take the bit depth as an integer instead, as we do not want to allow any arbitrary
pixel format for scene detection. Also, it would waste some CPU time
converting from 4:4:4 to 4:2:0 for example considering that we only
consider the luma plane for scene detection, so ideally we'd have some
code to automatically pick a format that would avoid useless conversions
based on the desired bit depth.
- The compiler currently generates a lot of extra code when mixing
owned and borrowed strings with `into_vec!`, so this commit
introduces an `inplace_vec!` macro to avoid this issue.
Overall, `inplace_vec!` reduces the overall size of
construct_target_quality_command by ~20% as compared to using
`into_vec!`. Compared to the original code, which used `to_string`
on integers instead of `format!`, it is ~40% smaller.
- Replace a small heap allocation in `vmaf.rs` with `SmallVec`.
- `x.to_string()` generates much more code than `format!("{}", x)`,
so we should prefer `format!`. There are other ways to further
reduce the codesize of construct_target_quality_command, but
they are much more complicated, so they are reserved for a
future PR.
- Update dependencies.
ffmpeg takes a long time to get the frame count for some sources,
and it can be much faster to get it from done.json when resuming
instead of recalculating it every time encoding is resumed.
I kind of wish that we wouldn't use clippy::pedantic and
clippy::nursery, as the number of `allow` lints at the top of src/lib.rs
is becoming quite absurd. However, I at least wanted to clear out the
large set of warnings being issued, regardless of that discussion.
We should ideally still display both the stderr of the source pipe and
the ffmpeg filter pipe, but this should be good enough for the vast
majority of cases as displaying the stderr of both pipes requires a
slightly larger change.
Previously, the pixel format of the input file was checked every time
a chunk was started. Now, we just get the pixel format once at the
beginning and reuse it for all chunks.
The SSE4.1/SSSE3 implementation of the parsing routines for
aomenc/vpxenc outperform the old regex by a factor of about 5000x
(3.5 μs vs. 0.7 ns to parse a single line on a Zen 1 1950x).
The idea is to eventually remove regex as a dependency entirely,
especially since there is an open PR to indicatif that speeds up the
template expansion (which replaces regexes with hand-written parsing).
Although the majority of av1an's time is spent
in third-party binaries, compiling with thin-LTO
does show up to a 10% improvement on scene detection
time. This will cause compilation to be slower.
However, thin-LTO has far less of a compilation time
impact than full LTO, while providing almost the same
speedups.