Skip to main content

BlockLedger

Struct BlockLedger 

Source
pub struct BlockLedger {
Show 17 fields width: i32, height: i32, cols: usize, rows: usize, still: Vec<u16>, clean: Vec<bool>, refined: Vec<bool>, coarse: Vec<bool>, coarse_key: Vec<bool>, coarse_count: usize, owed: Vec<bool>, owed_count: usize, fresh: Vec<bool>, fresh_count: usize, next_refresh: usize, next: usize, unreported: bool,
}
Expand description

Per-block stillness and cleanliness of one region (module docblock).

Fields§

§width: i32§height: i32§cols: usize§rows: usize§still: Vec<u16>

Frames each block has held still, saturating.

§clean: Vec<bool>

Whether each block’s last coding was at the paint-over quality or finer.

§refined: Vec<bool>

Whether each block was refined (refined) since it last changed: coded at the target a key-frame cleanup reaches, which a refresh at the paint-over quality does not.

§coarse: Vec<bool>

Whether each block was last coded under a capped constant quality’s binding peak, coarser than the rate factor would have chosen (coded), and not refreshed since, and whether that was in a key frame.

§coarse_key: Vec<bool>§coarse_count: usize

How many blocks are coarse, so a session no peak ever bound reads none at no cost.

§owed: Vec<bool>

Whether each block is owed its paint-over: a cleanup that fell due on it was left to the refresh, or coded short of its target under a binding peak (spent), and the block not coded at it since. An owed block is coarse too, and the refresh codes it at the paint-over quality (refresh_owed).

§owed_count: usize§fresh: Vec<bool>

Whether each block was refreshed at the session’s own quality since it changed: a cleanup coded over it as over the picture an uncapped session holds leaves it coarser than that session’s paint-over, the quality it starts from being finer (fresh).

§fresh_count: usize§next_refresh: usize

The block the next refresh starts its turn from.

§next: usize

The block the next plan starts its turn from.

§unreported: bool

Whether the region’s source was last seen to leave a change unreported (frame_reported).

Implementations§

Source§

impl BlockLedger

Source

pub fn new(width: i32, height: i32) -> Self

A ledger of a width x height region, every block changed and unclean.

Source

pub fn fit(&mut self, width: i32, height: i32)

Follow the region to width x height, starting over where that changed it: a resize, a scale change, or a rebuilt encoder leaves nothing of the old picture’s quality.

Source

pub fn frame<'a>( &mut self, rects: impl IntoIterator<Item = &'a Rectangle<i32, Physical>>, )

One frame of the region: the blocks rects cover changed and are unclean, and every other block held still one more frame. Damage across frames the capture skipped is the caller’s to union into rects.

Source

pub fn frame_reported( &mut self, rects: &[Rectangle<i32, Physical>], dirty: bool, observed: bool, )

One frame of a region whose source reports where it changed (rects) and whose content hash says whether it did (dirty): the blocks rects cover changed, and where none does the whole region did, while the source was last seen to leave a change unreported. A frame the hash checked and found changed (observed) says which: without a rectangle the source missed it, as the X server’s DAMAGE misses directly rendered GL. A hash that keeps a region dirty for a run of frames after it moved checks only the run’s last, so read as a change, the frames after a video stopped beside clean text dropped every block the ledger had refined.

Source

pub fn frame_all(&mut self)

The whole region changed this frame (a source that cannot say where).

Source

pub fn coarsened(&mut self)

The frame just coded the whole region at the rate control’s quality where it was clean (a key frame a consumer asked for): every block is unclean again.

Source

pub fn cleaned(&mut self)

The frame just coded the whole region at the paint-over quality or finer: every block that did not change in it is clean, and no longer coarse nor owed its paint-over.

Source

fn unfresh(&mut self, i: usize)

Block i holds no refresh at the session’s own quality.

Source

pub fn spent(&mut self) -> bool

A cleanup that fell due on the region is left to the refresh, or was coded short of its target under a binding peak: every block that did not change this frame is owed its paint-over, for the refresh once the peak lets go (refresh_owed). Whether that owed any block it did not owe.

Source

pub fn settled(&self) -> bool

Whether every block that held still is clean: nothing for a cleanup to do.

Source

pub fn plan( &mut self, trigger: u32, max: usize, runs: usize, ) -> Option<BlockPlan>

The blocks to refine this frame: those still for trigger frames or more and not clean, at most max in at most runs runs along a row, in turn from where the last plan stopped; None where there are none.

Source

pub fn refinement_coded(&mut self, refinement: &Refinement, coded: i32)

A frame that carried refinement came out with the rate control at quality index coded: its blocks are clean where that put them at the target or finer. A rate control codes the rows a refinement overspends coarser, and a block it left short is refined again on its next turn, from the index it now codes at.

Source

pub fn refined(&mut self, plan: &BlockPlan)

The blocks plan refined were coded at the paint-over quality: they are clean.

Source

pub fn unrefined_share(&self) -> f32

The share of the region’s blocks not refined since they last changed: what a key-frame cleanup has left to do (pipeline::cleanup_due), the whole region on a session that does not refine.

Source

pub fn unchanged(&self) -> impl Iterator<Item = bool> + '_

Whether each block, in raster order, held still this frame: what the source reported unchanged since the frame before.

Source

pub fn constant(&self) -> impl Iterator<Item = bool> + '_

Whether each block, in raster order, held still this frame and is clean: coded at the cleanup’s quality since it last changed, so a frame of the rate control’s may code it as a skip without analysis (FrameEncoder::constant_blocks). A still block not yet clean is left to the encoder, whose rate control refines it as it codes the frame; a skip there would hold it at the quality it was coded at while moving.

Source

pub fn blocks(&self) -> usize

The number of blocks in the region.

Source

pub fn coded(&mut self, capped: bool, whole: bool)

The frame just coded the blocks that changed in it, or the whole region where it was a key frame (whole), under a capped constant quality’s binding peak (capped): coarser than the rate factor would have chosen, so coarse and unclean, or at the session’s own quality, so no longer coarse. Either way they are owed no paint-over: one falls due on them again once they hold still.

Source

pub fn refresh(&mut self, max: usize) -> Option<(BlockPlan, BlockPlan)>

The coarse blocks (coded) that held still this frame, split into the ones it codes again at the session’s own quality, at most max in turn from where the last refresh stopped, and the rest, which wait as skips; None where none is coarse.

Source

pub fn refresh_keyed( &mut self, max: usize, ) -> Option<(BlockPlan, BlockPlan, BlockPlan)>

refresh, with the blocks it codes now that a capped key frame left coarse apart (REFRESH_KEY_FINER), among them. A block owed its paint-over waits for refresh_owed.

Source

pub fn refresh_owed(&mut self, max: usize) -> Option<(BlockPlan, BlockPlan)>

The coarse blocks owed their paint-over (spent) that held still this frame, split into the ones it codes again at the paint-over quality, at most max in turn from where the last refresh stopped, and every other coarse block that held still, which waits as a skip; None where none is owed. A refresh takes these before the rest (refresh).

Source

pub fn refreshed(&mut self, plan: &BlockPlan)

The blocks plan refreshed were coded at the session’s own quality, or at the paint-over quality where they were owed it (refresh_owed), which leaves them clean: no longer coarse.

Source

pub fn owed(&self) -> bool

Whether any block is owed its paint-over (spent).

Source

pub fn fresh(&self) -> bool

Whether any block was refreshed at the session’s own quality since it changed.

Source

pub fn coarse(&self) -> bool

Whether any block is coarse (coded).

Trait Implementations§

Source§

impl Clone for BlockLedger

Source§

fn clone(&self) -> BlockLedger

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for BlockLedger

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for BlockLedger

Source§

fn default() -> BlockLedger

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync> ⓘ

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> NoneValue for T
where T: Default,

§

type NoneType = T

The type of the none-equivalent value that [NoneValue::null_value] produces.
§

fn null_value() -> T

The none-equivalent value.
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<R, P> ReadPrimitive<R> for P
where R: Read + ReadEndian<P>, P: Default,

Source§

fn read_from_little_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian().
Source§

fn read_from_big_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian().
Source§

fn read_from_native_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian().
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more