pub enum Preset {
Fast,
Balanced,
Quality,
}Expand description
Speed/quality trade-off, in the spirit of x264’s -preset. The bitstream is
valid (and decodes bit-exactly) either way; only the encoder’s effort differs.
Variants§
Fast
Fast — built to mirror x264’s fastest presets: mode decision
by cheap SAD estimation (no rate-distortion trial-encoding; SAD
auto-vectorizes to psadbw), P_16x16-only inter, I_16x16-only intra,
and integer-pel motion (no sub-pel mc_luma interpolation — profiling
showed it was ~55% of the encode). Much faster; larger files, and a little
quality lost on sub-pixel motion (none on integer/screen content).
Balanced
Balanced — Fast’s decision path plus sub-pel motion
refinement, which Fast omits.
Integer-pel motion cannot track sub-pixel displacement, so on slow pans and
dollies the residual stays large, the intra cost wins, and macroblocks fall
back to intra — which is very expensive. Measured over 4 QPs on four clips,
adding sub-pel to Fast is −42% to −50% BD-rate (PSNR and SSIM agree)
for ~2.3–3.1× the time. On fine-detail content it beats [Quality] on BOTH
size and speed (in_to_tree 26.6 vs 27.3 Mb/s at 7.2× the throughput), because
sub-pel — not the sub-partitions or the RD search — is what that content
needs.
This is the default. Sub-pel costs ~2–3× the time, but a step on
x264’s own preset ladder buys ~2–3% BD-rate for ~1.5× — so at −42..−50%
this is dramatically underpriced by comparison. Fast remains available
for throughput-critical use.
Quality
Quality — full rate-distortion mode decision (every candidate
trial-encoded for real J = SSD + λ·bits), 16x8/8x16 sub-partitions,
and the full I_4x4 intra search. Smaller files; much slower.