pub struct PeakBucket {
pub bps: u32,
pub vbv: u32,
fps: f64,
fill: f64,
pub binding: bool,
at_floor: u32,
}Expand description
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.
Fields§
§bps: u32§vbv: u32§fps: f64§fill: f64The bits the bucket holds.
binding: bool§at_floor: u32Frames in a row the constant rate coded at the quality while binding.
Implementations§
Source§impl PeakBucket
impl PeakBucket
pub const RELEASE_FRAMES: u32 = 30
pub fn new(bps: u32, vbv: u32, fps: f64) -> Self
Sourcepub fn follow(&mut self, bps: u32, vbv: u32, fps: f64)
pub fn follow(&mut self, bps: u32, vbv: u32, fps: f64)
Take a live peak, buffer, and frame rate.
Sourcepub fn note(&mut self, bits: f64, at_floor: Option<bool>) -> Option<bool>
pub fn note(&mut self, bits: f64, at_floor: Option<bool>) -> Option<bool>
Fold in a frame of bits, at_floor saying whether the rate control coded it at the
session’s quality (None for a held frame, whose quantizer is not the rate control’s):
Some(true) to bind the session to the peak, Some(false) to release it.
Trait Implementations§
Source§impl Clone for PeakBucket
impl Clone for PeakBucket
Source§fn clone(&self) -> PeakBucket
fn clone(&self) -> PeakBucket
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for PeakBucket
Auto Trait Implementations§
impl Freeze for PeakBucket
impl RefUnwindSafe for PeakBucket
impl Send for PeakBucket
impl Sync for PeakBucket
impl Unpin for PeakBucket
impl UnsafeUnpin for PeakBucket
impl UnwindSafe for PeakBucket
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&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
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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