Expand description
Software VP8 and VP9 through libvpx. Software VP8 and VP9 through libvpx, with every frame’s references under the session’s control.
One session type serves both codecs. libvpx runs at the lowest latency it offers in real
time – one frame in, one packet out, no lag, no alternate-reference lookahead – with screen
tuning on VP9, and its rate control is either constant-rate at the session’s bitrate and VBV
or a quantizer pinned between an equal minimum and maximum, which is how a quality change
reaches a running session without a key frame. A capped constant quality
(RateSettings::capped) runs pinned as an uncapped one does until its output overflows the
peak (PeakBucket), and from there the same rate control with the pinned quantizer as its
floor, the quantizer free above it, and the peak as its target in a buffer of the constant
rate’s kind, until the rate control codes at the floor again; a new peak reaches it live as a
new target does. Free above the floor while the peak does not bind, VP9’s rate control walks
to a new floor over frames rather than take it (a still screen’s cleanup from 25 to 18 coded
at 21 first). A VP9 session runs in libvpx’s flexible mode,
where the codec’s eight buffers are addressed by slot, so a frame a client lost leaves the
predictions the way a decoded picture buffer allows; a VP8 session steers its three buffers
with the per-frame reference and refresh flags. What a lost frame would leave behind besides
its picture is kept out too: VP8’s entropy probabilities persist across frames unless a
frame declines to update them, so no frame does, and a VP9 decoder takes the previous
frame’s motion vectors and probability contexts whatever the references say, which only the
codec’s error-resilient mode switches off. VP8 runs error-resilient too, since its
constant-rate control otherwise refreshes GOLDEN on a schedule of its own, whatever a frame’s
flags say.
The blocks the block ledger marks still and clean (constant_blocks) reach libvpx as its
active map, on a frame of the rate control’s that predicts from the frame before: VP8 takes
an inactive macroblock as a zero-motion skip from its first mode and searches nothing, VP9
codes a superblock whose every block is inactive as one skip, and both copy only the active
blocks, and those changed since, into the buffer the frame is coded from (the patches under
patches/libvpx). A still 1080p screen took VP8 0.9 ms a frame on eight threads where it
took 1.6 without the map, and VP9 0.6 where it took 1.9; a 256x256 change beside a clean
screen at 2560x1600 took VP8 3.5 ms where it took 4.5, and VP9 4.1 where it took 6.4.
Structs§
- VpxEncoder
- One libvpx session for one capture.
Constants§
- BAND_
BITS_ 🔒PER_ MB - The frame budget a macroblock, in bits, from which VP8 sweeps its refresh in bands
(
VpxEncoder::band_size): three times what a frame that skips every macroblock costs. - CYCLIC_
REFRESH_ 🔒AQ - libvpx’s
aq_modefor the cyclic refresh. - RATE_
CEILING_ 🔒KBPS - The rate target, in kbit/s, a pinned-quantizer session names and never reaches.
- REFINE_
FINER - Quality index steps finer than the paint-over one VP8 codes a refined block at
(
FrameEncoder::refines): none, since a VP8 session’s paint-over quantizer already sits at the floor its bounds keep (VP8_DEFAULT_MIN_LEVEL), and 1080p text beside a video came out the same at 0, 3, and 6 steps finer (39.7 dB at 2 Mbit/s and 42.6 at 8 against 29.6 and 33.5 unrefined, where VP8’s cleanup of the still screen reaches 42.0). VP9 refines no block: in its screen mode a block whose source has not changed reads as static and is skipped whatever its segment’s quantizer, and refined, the same text came to 25.9 and 35.4 dB against 25.6 and 34.9, where VP9’s cleanup of the still screen reaches 37.7 and 51.1. - VP8_
DEFAULT_ 🔒MIN_ LEVEL - The libvpx quantizer levels a session leaves to the library’s own bounds.
- VP8_
STATIC_ 🔒THRESHOLD - The squared error under which libvpx’s VP8 skips a macroblock as unchanged (its static threshold), so a still region is left as it is rather than coded again every frame: at 0.25 Mbit/s a 1080p texture under a moving box took 3.0 MB for its 3 s of motion against 5.8, at 42.0 dB against 41.4, and 304 kB still against 1185. Scrolling text codes the same.
- VP8_
TOKEN_ 🔒PARTITIONS - VP8’s token partitions, eight, the most it has: a client decoding in software spreads a frame across them, as across H.264’s slices, where one leaves it on one thread. They cost nothing measurable: at 1080p text, a game frame and dense text code within 0.1% of the bytes and 0.02 dB of one partition while scrolling, and within 2% still.
- VP8_
UNFILTERED_ 🔒QINDEX - The finest VP8 quantizer indices, at and under which a held band is coded with no loop filter
(
band_roi), as libvpx itself filters a frame there at level 1 at most. libvpx starts a frame’s level from the last frame’s and keeps it while a strip across the middle of the picture shows no gain, which a band elsewhere leaves as it was: the bands above the middle of a sweep after motion kept the level its coarse frames left (46), and 1080p text swept at index 2 ended at 42.7 dB at 8 fps 2 Mbit/s against 50.6 unfiltered, at 15 fps 43.6 against 50.6, at 30 and 60 fps level. At coarser indices libvpx’s level stands, unfiltered coming out 0.2 to 0.4 dB short at 24 and 73. A refresh held whole shows the strip, and libvpx’s level came out 0.3 to 0.8 dB finer than none at index 3. - VP9_
LAYERS 🔒 - The temporal layers a VP9 session declares. Every frame is coded in the base layer; the second exists because libvpx sets up and re-targets its per-layer rate control, which the flexible reference mode runs on, only for a session with more than one layer.
Functions§
- encodes_
444 - Whether the loaded libvpx codes VP9 4:4:4 in the flexible mode the sessions run: before 1.13 its layer machinery re-sizes every frame at 4:2:0, so a profile 1 session writes headers over pictures no decoder takes.
- encodes_
ten_ bit - Whether the loaded libvpx was built with VP9’s high bit depth, which its 10-bit profiles need.
- error 🔒
- peak_
bps 🔒 - The session’s last error, with libvpx’s detail where it has one. The context is handed over mutable because libvpx before 1.14 declares the parameter so, though it only reads it. The peak of a capped constant quality in bits per second, as its bucket counts it.