pub struct HevcEncoder {Show 15 fields
backend: Backend,
planes: Planes,
threads: i32,
quality: Quality,
rate: RateSettings,
omit_headers: bool,
fresh: bool,
next_pts: u64,
pending: Pending,
held: Option<u32>,
refinement: Option<Refinement>,
offsets: Vec<f32>,
constant: Vec<u8>,
last_quality: Option<u32>,
last_bytes: Option<usize>,
}Expand description
One software HEVC session for one capture.
Fields§
§backend: Backend§planes: Planes§threads: i32§quality: Quality§rate: RateSettings§omit_headers: bool§fresh: boolWhether the next frame is the first after an open, which the encoder codes as a key frame on its own.
next_pts: u64§pending: Pending§held: Option<u32>The quantizer the next frame is held at whatever the rate control (hold_quantizer).
refinement: Option<Refinement>The blocks the next frame of the rate control’s refines (refine_blocks), and the
quantizer offset of each 16x16 block of every frame, 0 where it refines nothing.
offsets: Vec<f32>§constant: Vec<u8>The 16x16 blocks of the next frame that held still and are clean, one byte each in
raster order, nonzero where constant (constant_blocks); empty where none is.
last_quality: Option<u32>The quantizer the rate control last coded a frame at, held frames aside.
last_bytes: Option<usize>The bytes of that frame.
Implementations§
Source§impl HevcEncoder
impl HevcEncoder
Sourcepub fn new(settings: &CaptureSettings, rgba: bool) -> Result<Self, String>
pub fn new(settings: &CaptureSettings, rgba: bool) -> Result<Self, String>
Open a session on host frames; rgba names the byte order they arrive in.
pub fn codec(&self) -> Codec
pub fn is_fullcolor(&self) -> bool
Sourcepub fn is_full_range(&self) -> bool
pub fn is_full_range(&self) -> bool
The software 4:4:4 of x264’s kind signals full range.
pub fn last_reference(&self) -> Reference
Sourcepub fn holds_quantizer(&self) -> bool
pub fn holds_quantizer(&self) -> bool
Whether hold_quantizer holds a frame at its quantizer: x265 at a constant rate factor,
kvazaar never. At a constant rate x265’s rate control moves a forced quantizer back to
what its buffer affords (a key frame held at 18 came out 23.2 kB at 26.6 dB at 8 Mbit/s
1080p), and a fresh session whose buffer is the key frame’s budget plans it from a
fraction of that buffer (102.5 kB at 34 dB where the budget was 250 kB and the picture
before it 53.9 dB), so a constant-rate session holds none.
Sourcepub fn reach_finer(&self) -> u32
pub fn reach_finer(&self) -> u32
The quantizer steps finer than the paint-over one at which a constant rate’s frames come
to the paint-over quality (FrameEncoder::reach_finer): HEVC_REACH_FINER.
Sourcepub fn refines(&self) -> bool
pub fn refines(&self) -> bool
Whether the session refines blocks of a frame of its rate control’s (refine_blocks):
x265, through its per-block quantizer offsets, and kvazaar, through its map of a delta a
64x64 tree block, the finest of the blocks it holds.
Sourcepub fn refine_finer(&self) -> u32
pub fn refine_finer(&self) -> u32
Quality index steps finer than the paint-over one a refined block is coded at
(FrameEncoder::refines): the library’s (Backend::REFINE_FINER).
Sourcepub fn refine_blocks(&mut self, refinement: &Refinement)
pub fn refine_blocks(&mut self, refinement: &Refinement)
Code the blocks refinement names in the next frame of the rate control’s at its target
quality (ledger): each 16x16 block it refines at the quantizer steps from the rate
control’s last to the target, off the frame’s own.
Sourcepub fn constant_blocks(&mut self, constant: &[bool])
pub fn constant_blocks(&mut self, constant: &[bool])
Mark the blocks of the next frame, in raster order, that held still and are clean
(BlockLedger::constant), which x265 codes as skips without analysis
(x265_picture.constantBlocks) on a frame of its rate control’s; kvazaar takes no such
map. An empty slice marks none.
Sourcepub fn last_quality(&self) -> Option<u32>
pub fn last_quality(&self) -> Option<u32>
The quality index (HEVC’s quantizer) the rate control last coded a frame at, held frames aside.
Sourcepub fn last_size(&self) -> Option<usize>
pub fn last_size(&self) -> Option<usize>
The bytes the rate control spent on its last frame, held frames aside: its filler counted,
as the rate control counts it, though the frame goes without it (Coded::spent).
Sourcepub fn invalidate_reference(&mut self, _frame_id: u16) -> bool
pub fn invalidate_reference(&mut self, _frame_id: u16) -> bool
The library keeps its reference lists to itself: refused, so the caller codes a key frame.
Sourcefn reopen(&mut self) -> Result<(), String>
fn reopen(&mut self) -> Result<(), String>
Open a fresh encoder with the live settings, whose first frame is a key frame.
Sourcepub fn hold_quantizer(&mut self, crf: u32)
pub fn hold_quantizer(&mut self, crf: u32)
Encode the next frame at the quantizer the quality index crf selects, leaving the
session’s own quality for the frame after: the cleanup of a still screen, at a constant
rate factor, where x265 takes it as the frame’s forced quantizer. A constant-rate session
codes the frame under its rate control (holds_quantizer). kvazaar takes no quantizer
but the one it opens at, and a re-open for the frame would need another to come back,
each a key frame, so it codes the frame at its own.
Sourcepub fn reconfigure_rate(
&mut self,
settings: &CaptureSettings,
) -> Result<(), String>
pub fn reconfigure_rate( &mut self, settings: &CaptureSettings, ) -> Result<(), String>
Re-open the encoder when a rate or frame-rate setting changed: neither library’s rate control takes a new target while it runs.
Trait Implementations§
impl Send for HevcEncoder
Auto Trait Implementations§
impl !Sync for HevcEncoder
impl Freeze for HevcEncoder
impl RefUnwindSafe for HevcEncoder
impl Unpin for HevcEncoder
impl UnsafeUnpin for HevcEncoder
impl UnwindSafe for HevcEncoder
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
§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> 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