pub struct BitrateController { /* private fields */ }Expand description
Bit-rate controller for adaptive quantization
Dynamically adjusts quantization parameters to achieve a target bit-rate
Implementations§
Source§impl BitrateController
impl BitrateController
Sourcepub fn new(
target_bits_per_symbol: f64,
initial_step: f64,
kp: f64,
ki: f64,
) -> TokenizerResult<Self>
pub fn new( target_bits_per_symbol: f64, initial_step: f64, kp: f64, ki: f64, ) -> TokenizerResult<Self>
Create a new bitrate controller
§Arguments
target_bits_per_symbol- Desired average bits per symbolinitial_step- Initial quantization step sizekp- Proportional gain (typical: 0.1)ki- Integral gain (typical: 0.01)
Sourcepub fn current_step(&self) -> f64
pub fn current_step(&self) -> f64
Get current quantization step
Sourcepub fn target_bitrate(&self) -> f64
pub fn target_bitrate(&self) -> f64
Get target bit-rate
Sourcepub fn current_bitrate(&self) -> f64
pub fn current_bitrate(&self) -> f64
Get current average bit-rate
Sourcepub fn set_target(&mut self, target_bits_per_symbol: f64) -> TokenizerResult<()>
pub fn set_target(&mut self, target_bits_per_symbol: f64) -> TokenizerResult<()>
Set new target bit-rate
Auto Trait Implementations§
impl Freeze for BitrateController
impl RefUnwindSafe for BitrateController
impl Send for BitrateController
impl Sync for BitrateController
impl Unpin for BitrateController
impl UnwindSafe for BitrateController
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
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> 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>
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 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>
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