Skip to main content

Module ledger

Module ledger 

Source
Expand description

Per-block stillness and cleanliness of a region, for refining blocks while others move. Where a region’s picture stands, block by block: the per-block counterpart of the cleanup policy’s per-region bookkeeping (pipeline::cleanup_due).

The cleanup policy reads a region as still or moving whole, so a region that never holds still (a video playing in one window) keeps everything else in it at the quality motion is coded at: 1080p text beside a 640x360 video at 8 Mbit/s stayed at 32 dB, where the same text alone was cleaned up to 55. The ledger keeps, for each BLOCK x BLOCK block, how many frames it has held still and whether its last coding was at the paint-over quality (clean). The capture’s damage marks the blocks it covers changed and unclean each frame; a frame that codes blocks finer through the encoder’s per-block quantizer (FrameEncoder::refine_blocks, x264’s quantizer offsets) asks the ledger which (BlockLedger::plan): blocks that held still for the cleanup’s trigger and are not clean, at most so many a frame, taken in turn from where the last plan stopped so a large set is refined across frames rather than in one, and marks them clean once coded. A whole frame coded at the paint-over quality cleans every block it did not see change; a key frame at the rate control’s quality leaves every block unclean. A block that held still and is clean is constant (BlockLedger::constant): a frame of the rate control’s may code it as a skip without analysis (FrameEncoder::constant_blocks), since its reference already holds it at the cleanup’s quality. A block coded while a capped constant quality’s peak bound it is coarse (BlockLedger::coded), never clean; once the peak lets go, the coarse blocks that held still are coded again at the session’s own quality, so many a frame (BlockLedger::refresh, RefreshPace), the rest of them waiting as skips. Nothing reads pixels: the damage source did the detection, and a source that over-reports (a client damaging its whole surface) only refines less, never wrongly.

Structs§

BlockLedger
Per-block stillness and cleanliness of one region (module docblock).
BlockPlan
The blocks of a picture to code at the paint-over quality this frame (BlockLedger::plan).
RefinePace
How many blocks a region refines a frame (REFINE_FRAMES, REFINE_RISE, REFINE_OVER, REFINE_PAUSE, REFINE_RATE_HELD).
Refinement
A frame’s refinement: the blocks (plan), the quality index they are coded at (target), the rate control’s index the offset to it was taken from (from), and the most steps the offset may take (reach, Refiner::reach).
Refiner
How an encoder refines blocks (FrameEncoder::refines): the quality index steps finer than the paint-over one it codes them at, so a refined block comes to what the region’s own cleanup reaches (finer); the most steps off the frame’s own quality one frame may code a block at (reach), past which its rate control loses the rate; and the most runs of blocks along a row one frame may refine (runs), where the encoder takes regions rather than a map.
RefreshPace
How many coarse blocks a region refreshes a frame (REFRESH_FRAMES, REFRESH_PAUSE).

Constants§

BLOCK
The side of a block in pixels: an H.264 or VP8 macroblock. An encoder whose quantizer map is coarser (a 32x32 HEVC tree block, a 64x64 AV1 superblock) reads its unit from the blocks it covers (BlockPlan::refines_area).
REFINE_FINER
Quality index steps finer than the paint-over one x264 codes a refined block at, so the block comes to what the region’s own cleanup reaches: one predicted frame at the paint-over quantizer left 1080p text at 44.6 dB, where the cleanup’s key frame, at x264’s intra offset, reached 49.1; six steps finer reached 49.4. Each encoder that refines says its own (FrameEncoder::refines).
REFINE_FRAMES 🔒
The most blocks a region refines a frame, as a share of it: a large set is refined over REFINE_FRAMES frames at least rather than in one frame the size of a cleanup. A constant quality refines that many; a constant rate starts at a share of REFINE_START_FRAMES and follows its rate control (RefinePace).
REFINE_OVER 🔒
Frame budgets, or as much as the frames before refining came to where that is more, a refining frame may come out at before its refined blocks a frame halve, as they do past REFINE_RISE: a rate control pinned at its coarsest quantizer says nothing through it, and at 2 Mbit/s at 1080p x264 sent the refinement at twice the rate.
REFINE_PAUSE 🔒
Frames a region refines nothing for once a frame refining one block came out past REFINE_OVER or REFINE_RISE: a rate that cannot afford a block a frame is one where the encoder’s own refinement of the region does better than a block a frame. VP8 at 2 Mbit/s beside a video came to 24.2 dB refining a block a frame, against 29.6 with none, its cyclic refresh, which the region map displaces, refining the still screen itself.
REFINE_RATE_HELD 🔒
The frame budgets the frames of a region refining nothing may average before it refines nothing for REFINE_PAUSE frames: a rate control that already runs over its rate has none to spare. Beside a video, VP8’s frames averaged 1.38 budgets at 2 Mbit/s, where refining took the text to 25.5 dB against 29.6 by its cyclic refresh and 12% more bytes, and 0.76 at 8 Mbit/s, where it took the text from 33.5 to 42.6.
REFINE_RISE 🔒
Quality index steps the rate control’s frames may come out coarser than before the region started refining before its refined blocks a frame halve (or past REFINE_OVER); where they come out no coarser, a quarter more. Dense 1080p text refined at 128 blocks a frame beside a video at 8 Mbit/s ran x264’s row-level control past quantizer 51, where it scales every macroblock offset toward nothing, and left the text at 42 dB; at 16 a frame it reached 48.
REFINE_START_FRAMES 🔒
REFRESH_FINER
Quality index steps finer than the session’s own a capped constant quality’s refresh codes its coarse blocks at (BlockLedger::refresh, Codec::refresh_index), so a predicted frame refreshing them comes to what the uncapped session’s picture stands at: refreshing a 720p page of text a scroll left coarse, libvpx’s VP8 and VP9 came to 44.8 and 41.7 dB against the uncapped sessions’ 44.5 and 40.5, and NVENC’s H.264 to 41.1 against 38.8. x264 takes a step more (X264_REFRESH_FINER in the software encoder).
REFRESH_FRAMES 🔒
Frames a capped constant quality’s refresh of its coarse blocks (BlockLedger::refresh) would take at its first share of the region’s blocks a frame, which halves while a refreshing frame comes out past the peak’s frame budget and doubles while one comes out under half of it (RefreshPace): on a fast path the share doubles to the whole region in eight frames, and on a slow one the first frame is a small one.
REFRESH_KEY_FINER
Quality index steps further finer a refresh codes a block a capped key frame left coarse at (BlockLedger::refresh), where the uncapped session’s key frame stood at its rate factor’s intra offset finer than its predicted frames: x264’s coarse start on a 1080p desktop left the screen’s still parts 0.6 dB under the uncapped session’s refreshed REFRESH_FINER steps finer.
REFRESH_PAUSE 🔒
Frames a refresh waits, refreshing nothing and holding nothing back, once a frame refreshing one block comes out past the peak’s frame budget: the content alone fills the peak, as where NVENC runs past a peak it leaves its level for, and a refresh crawling a block a frame would hold the rest of the coarse blocks back for seconds, which NVENC holds at its coarsest quantizer through its QP map and deblocks frame after frame (the static parts of a 1080p scene 0.4 dB under the uncapped session’s after two seconds).