Skip to main content

Module session

Module session 

Source
Expand description

What the full-frame software sessions share: planar input, quantizer, rate settings. What the full-frame software sessions share: the planar picture a packed host frame is converted into, at 8 or 10 bits, the constant quantizer that follows the session quality index, the rate-control settings a live change is compared against, and the frames an encoder has been handed but not yet answered.

Structs§

PeakBucket
A leaky bucket of a capped constant quality’s peak (RateSettings::capped), its buffer the session’s VBV, for an encoder whose constant quality takes no cap of its own: the session codes as an uncapped one while the bucket holds what it codes, binds to the peak through its constant rate, never finer than its quality, from the frame that overflows the bucket, and lets go once RELEASE_FRAMES frames in a row come out at that quality with the bucket back within its buffer, which says the content fits under the peak again: a rate control that takes the peak with its buffer full codes at the quality for a while whatever the content. The frame that overflows has already gone out: the cap holds the frames after it.
PeakOffset
The peak of a capped constant quality held beside an encoder that codes its constant quality per frame and has no rate control to bind to it (x264, SVT-AV1), where PeakBucket switches one that does. A leaky bucket of the peak, its buffer the session’s VBV, takes each frame: from a frame that overflows it the quality index stands offset steps above the session’s, aimed after each frame at bringing the bucket back to half full in DRAIN_FRAMES frames (a size halving every six steps) and lowered at most RELEASE_STEP a frame, so a session that never overflows it codes as an uncapped one.
Pending
The frames handed to an encoder and not yet answered, by the timestamp each was submitted with, so a packet names the frame it encodes rather than the one submitted alongside it. An encoder that pipelines answers a frame several later, and one that drops a frame never answers it at all, so taking a timestamp discards every submission it passed over.
Planes
A planar picture, 4:2:0 or 4:4:4, with tightly packed rows: 8-bit samples in y, u, and v, or 10-bit ones in y16, u16, and v16, the planes of the other depth staying empty.
Quality
The constant quantizer of a session, moved toward the one the quality index selects: a decrease sharpens the picture and applies at once, an increase waits out QP_HYSTERESIS_LIMIT consecutive requests so transient motion does not make quality blink. The domain is the codec’s own (Codec::quantizer).
RateSettings
The rate-control and frame-rate settings a session was configured with, so a live change re-programs the encoder only when a value it reads actually moved.

Functions§

check_host_frame
Whether pixels holds a width x height packed picture at stride bytes per row.
convert_into
Convert a packed host frame into planes a library owns, at strides (luma, chroma) bytes per row, as Planes::convert does into its own.
encode_threads
The encode threads a full-frame H.265, VP8, VP9, or AV1 software session spreads across (threads_up_to eight): x265’s and kvazaar’s wavefront, libvpx’s token partitions and rows, and SVT-AV1’s logical processors.
h264_fullframe_threads
The encode threads a full-frame H.264 software session spreads across (threads_up_to four): x264’s sliced threads, and OpenH264’s threads over its four slices, more than which would buy nothing.
threads_up_to 🔒
The encode threads a software session spreads across, between one and most: one less than the host’s cores, or one alone where cpu_encode_threading is off. The conversion ahead of the encoder runs on as many.