Skip to main content

cleanup_due

Function cleanup_due 

Source
pub fn cleanup_due(
    st: &mut StripeState,
    trigger: u32,
    improves: bool,
    now: bool,
    keys: bool,
    damage: Damage,
) -> Cleanup
Expand description

The still-screen cleanup of one region (a whole frame, or a stripe): track how long and how much it has been changing, and say when it is due a cleanup and of which kind. keys false (JPEG, whose every stripe is a picture of its own, and a constant-rate session cleaned up through its rate control) never answers Cleanup::Key.

Static is read from the content (damage), never from what was sent, so a stream that encodes every frame (Turbo) sees the screen go still exactly like one that sends only changes. The cleanup comes in two steps. A region that changed is refreshed once it has held still for trigger frames: a frame predicted from the picture the client holds, which re-codes only what changed. Once the change since the last key-frame cleanup adds up to KEY_CLEANUP_MASS of a screen and the region has held still for KEY_STILL_TRIGGERS trigger periods, it is cleaned up by a key frame, which leaves nothing of the motion behind and resynchronizes every viewer, but costs a whole picture: so it waits for a screen still long enough that the user is reading it, and a caret or a clock, which change little, never pays for one. A region that keeps changing never holds still, so once LOW_MOTION_TRIGGERS trigger periods have passed since it first changed and at most a quarter of its recent frames carried more than a small change (a blinking caret, a ticking clock) it is cleaned up then, by a key frame when the change adds up to one.

improves false (the paint-over is off, or a constant rate already codes the region finer) keeps the bookkeeping and answers Cleanup::None, and a cleanup that falls due then restarts the count of frames since the region first changed: the region is clean, so those frames are no low motion, and counted, they would have the first frame of the next large change keyed, the whole picture at the paint-over quantizer the moment a window opens. now false (a stripe whose cleanup is staggered to a later frame) answers Cleanup::None and leaves the cleanup pending.