pub struct VaapiEncoder { /* private fields */ }Expand description
One VA-API encoder session, hardware, for one capture.
Implementations§
Source§impl VaapiEncoder
impl VaapiEncoder
Source§impl VaapiEncoder
impl VaapiEncoder
pub fn codec(&self) -> Codec
Sourcepub fn is_fullcolor(&self) -> bool
pub fn is_fullcolor(&self) -> bool
Whether this session negotiated 4:4:4 chroma.
Sourcepub fn surface_format_name(&self) -> String
pub fn surface_format_name(&self) -> String
The name of the surface format frames reach the codec in, for the session log.
Sourcepub fn is_full_range(&self) -> bool
pub fn is_full_range(&self) -> bool
A hardware session converts at limited range.
Sourcepub fn last_reference(&self) -> Reference
pub fn last_reference(&self) -> Reference
The frame the last encoded frame predicted from.
Sourcepub fn take_report(&mut self, report: ReferenceReport) -> bool
pub fn take_report(&mut self, report: ReferenceReport) -> bool
Apply what the consumers say of a frame: a loss as invalidate_reference, a frame every
one of them holds or was sent (ReferenceWindow::acknowledge, ReferenceSlots::acknowledge).
Sourcepub fn invalidate_reference(&mut self, frame_id: u16) -> bool
pub fn invalidate_reference(&mut self, frame_id: u16) -> bool
Leave frame frame_id and every frame after it out of the predictions. False where the
session tracks none, and the caller codes a key frame instead.
Sourcepub fn reconfigure_rate(
&mut self,
settings: &RustCaptureSettings,
) -> Result<(), String>
pub fn reconfigure_rate( &mut self, settings: &RustCaptureSettings, ) -> Result<(), String>
Take a rate or frame-rate change: the next frame opens a sequence with the new rate control, as a key frame.
Sourcepub fn last_size(&self) -> Option<usize>
pub fn last_size(&self) -> Option<usize>
The bytes of the last frame coded, the driver’s padding aside: what tells a constant-rate cleanup the rate control has nothing left to refine.
Sourcepub fn last_quality(&self) -> Option<u32>
pub fn last_quality(&self) -> Option<u32>
The quality index the rate control last coded a frame at: for H.264 and HEVC where the
driver reports a picture’s average quantizer with its coded buffer (iHD does), for AV1
and VP9 the base_q_idx it wrote into the frame header. A picture that is mostly skipped
blocks reports near the quantizer its slices open at, so the figure is trusted for
having reached a quality, never for the lack of it.
Sourcepub fn measures(&self) -> bool
pub fn measures(&self) -> bool
Whether measure yields a measurement: until a surface turns out unreadable, as the
reconstruction of iHD’s packed 4:4:4 does, kept at another geometry than its source.
Sourcepub fn measure(&mut self)
pub fn measure(&mut self)
Measure the next frame’s reconstruction against its source (last_psnr).
Sourcepub fn last_psnr(&self) -> Option<f32>
pub fn last_psnr(&self) -> Option<f32>
The luma PSNR, in dB, of the last frame measured: its reconstruction against the
converted picture it was coded from, both read back on every PSNR_ROW_STEPth row.
What tells a constant-rate cleanup whether the driver’s rate control is still refining
a still screen, whatever the driver says of its quantizer; None where a surface cannot
be read as the picture’s rows.
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, and leave the
session’s own quantizer for the frame after: the cleanup of a still screen, at a constant
quantizer. A constant-rate session codes the frame under its rate control: radeonsi drops
per-frame quantizer bounds (a key frame held by them came out starved in the session’s
small buffer, 26 dB), and a key frame given a budget of its own through a restarted rate
control came out coarser than the picture the driver’s rate control refines a still
screen to by itself (51 against 61 dB at 8 Mbit/s), so FrameEncoder::holds_quantizer
says no there.
Sourcepub fn encode_host(
&mut self,
pixels: &[u8],
stride: usize,
rgba: bool,
frame_number: u64,
crf: u32,
force_idr: bool,
) -> Result<Vec<u8>, String>
pub fn encode_host( &mut self, pixels: &[u8], stride: usize, rgba: bool, frame_number: u64, crf: u32, force_idr: bool, ) -> Result<Vec<u8>, String>
Encode one packed host frame (stride bytes per row, in the byte order the session
was built for) at the quality index crf: uploaded straight from the caller’s rows
onto the host surface and converted on the GPU.
Trait Implementations§
Source§impl Drop for VaapiEncoder
impl Drop for VaapiEncoder
impl Send for VaapiEncoder
Auto Trait Implementations§
impl Freeze for VaapiEncoder
impl RefUnwindSafe for VaapiEncoder
impl Sync for VaapiEncoder
impl Unpin for VaapiEncoder
impl UnsafeUnpin for VaapiEncoder
impl UnwindSafe for VaapiEncoder
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> 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