pub struct SvtAv1Encoder {Show 25 fields
handle: *mut EbComponentType,
config: Box<EbSvtAv1EncConfiguration>,
input: Box<(EbBufferHeaderType, EbSvtIOFormat)>,
planes: Planes,
threads: i32,
quality: Quality,
rate: RateSettings,
omit_headers: bool,
fresh: bool,
events: Events,
preset: i8,
references: Option<ReferenceSlots>,
anchors: Vec<u32>,
last_reference: Reference,
next_pts: u64,
pending: Pending,
held: Option<u32>,
restate_target: bool,
constant: Vec<u8>,
last_quality: Option<u32>,
peak: Option<PeakOffset>,
bound_since_open: bool,
last_capped: bool,
last_crf: u32,
quality_index: u32,
}Expand description
One SVT-AV1 session for one capture.
Fields§
§handle: *mut EbComponentType§config: Box<EbSvtAv1EncConfiguration>§input: Box<(EbBufferHeaderType, EbSvtIOFormat)>The input picture the library reads: the header and the plane pointers it carries.
planes: Planes§threads: i32§quality: Quality§rate: RateSettings§omit_headers: bool§fresh: bool§events: EventsThe change the next picture carries to the running encoder.
preset: i8The preset the running encoder codes the next picture at unless told otherwise.
references: Option<ReferenceSlots>The buffers of a session that names its references, LAST the library’s own.
anchors: Vec<u32>The anchors the library holds, by the id each was stored under.
last_reference: Reference§next_pts: u64§pending: Pending§held: Option<u32>The quantizer the next frame is held at whatever the rate control (hold_quantizer).
restate_target: boolWhether the frame after a held key frame of a constant-rate session restates its target.
constant: Vec<u8>The 16x16 blocks of the next picture 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 quality index the rate control last coded a frame at, held frames aside.
peak: Option<PeakOffset>A capped constant quantizer’s peak (PeakOffset), where the release forces a picture’s
quantizer and keeps the sequence’s for one that names none (svtav1_sequence_qp).
bound_since_open: boolWhether the peak has bound a frame since the encoder last opened, from which a change of quality is forced on the pictures it applies to rather than re-opening.
last_capped: boolWhether the last frame was coded coarser than the session’s quality for its peak.
last_crf: u32The quality index the last frame was asked for, which bounds the peak’s offset.
quality_index: u32The quality index the session codes at (quality), from which a forced finer quality
is measured (forced_level).
Implementations§
Source§impl SvtAv1Encoder
impl SvtAv1Encoder
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.
Sourcefn level(q: u32) -> u32
fn level(q: u32) -> u32
The quantizer level the library takes for a quantizer index of AV1’s domain.
fn set(&mut self, name: &str, value: &str) -> Result<(), String>
Sourcefn open(&mut self) -> Result<(), String>
fn open(&mut self) -> Result<(), String>
Stand the encoder up with the live settings. The first frame it codes is a key frame.
Sourcefn close(&mut self)
fn close(&mut self)
Tell the library the stream ended, drain what it still holds, and free the encoder.
pub fn codec(&self) -> Codec
pub fn is_fullcolor(&self) -> bool
pub fn is_full_range(&self) -> bool
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: at a constant rate where the
release takes a new target with a picture. A constant-quantizer session is cleaned up
through its own quality instead (pipeline::decide_constant_quality): a per-picture
quantizer (use_qp_file) drops the library’s key-frame and layer offsets from every
picture it names, and a cleanup key frame held that way came out at 49.6 dB where the
session’s own key frame at the paint-over quality reached 61.0.
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, held frames aside.
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 where the session
names its references; refused otherwise, so the caller codes a key frame.
Sourcepub fn acknowledge_reference(&mut self, frame_id: u16, held: bool)
pub fn acknowledge_reference(&mut self, frame_id: u16, held: bool)
Every consumer holds frame frame_id, or where not held was sent it
(ReferenceSlots::acknowledge), where the session names its references.
Sourcepub fn constant_blocks(&mut self, constant: &[bool])
pub fn constant_blocks(&mut self, constant: &[bool])
Encode the next frame at the quantizer the quality index crf selects, leaving the
session’s own quantizer for the frame after: the cleanup of a still screen, at a constant
rate, where a held key picture is planned with a raised target (holds_quantizer). A
constant-quantizer session codes the frame at its own quantizer.
Mark the blocks of the next picture, in raster order, that held still and are clean
(BlockLedger::constant): the library copies only the other blocks, and those changed
since its buffer last held the picture, into the buffers it codes from
(EbBufferHeaderType.constant_blocks), and at a constant quantizer codes a superblock
of them as a zero-motion skip without analysis (constant_blocks_skip), which only a
session that names no references takes, since only there does every frame predict from
the one before (a loss is answered with a key frame). A constant rate
leaves its mode decision to find the skips: its refresh of a still picture at a finer
quantizer runs through the blocks a map would hold. An empty slice marks none.
pub fn hold_quantizer(&mut self, crf: u32)
Sourcefn forced_level(&self, crf: u32) -> u32
fn forced_level(&self, crf: u32) -> u32
The quantizer level a capped constant quantizer forces the next picture at, or 0 for the
sequence’s own (svtav1_sequence_qp): the quality index crf asks for raised by the
peak’s offset while it binds, and from the first binding since the encoder opened, any
quality other than the one it opened at, which it would otherwise re-open for. A session
that never binds forces none and codes as an uncapped one.
A forced picture takes none of the library’s key-frame or layer offsets, which code its own
pictures finer than their quality says, and the shortfall grows with how far finer than the
session’s the quality asked for stands: a refresh of a 320x240 page of text the peak left at
the coarsest quantizer came to 39.3 dB forced at its quality three steps finer, where the
uncapped session stood at 42.9, and to 43.7 four steps further; the paint-over seven steps
finer reached 46.4 forced four steps further and 51.8 eight steps further, against the
uncapped session’s 51.6 from a key frame. So a quality finer than the session’s is forced
one step past twice its distance below it, and at the library’s own floor rather than
RTC_MIN_LEVEL, whose failure is a scroll’s and such a picture codes a still page. A forced
picture asks for no constant-block skip (constant_blocks_skip): the refresh after a bound
scroll, its still superblocks coded as skips, decoded at 13.7 dB where it decoded at 39.3
without them.
Sourcepub fn capped(&self) -> bool
pub fn capped(&self) -> bool
Whether the constant quantizer runs under a peak (RateSettings::capped).
Sourcepub fn peak_bound(&self) -> bool
pub fn peak_bound(&self) -> bool
Whether that peak binds the session: its quality stands above the session’s.
Sourcepub fn coded_capped(&self) -> bool
pub fn coded_capped(&self) -> bool
Whether the last frame was coded coarser than the session’s quality for its peak.
Sourcepub fn idle(&mut self)
pub fn idle(&mut self)
A tick that codes no frame (FrameEncoder::idle): the peak’s bucket drains as for an
empty frame.
Sourcepub fn reopens_on_quality(&self) -> bool
pub fn reopens_on_quality(&self) -> bool
Whether a change of the session’s quality re-opens it: until its peak binds, as an
uncapped session does; from then until it next opens, the quality is forced on the
pictures it applies to (forced_level).
Sourcepub fn reconfigure_rate(
&mut self,
settings: &CaptureSettings,
) -> Result<(), String>
pub fn reconfigure_rate( &mut self, settings: &CaptureSettings, ) -> Result<(), String>
Apply a rate or frame-rate change: a new bitrate with the next picture where the library takes one live, since the VBV it holds spans the same time at any bitrate, and a capped constant quantizer’s new peak beside the library; anything else re-opens the encoder.
Trait Implementations§
Source§impl Drop for SvtAv1Encoder
impl Drop for SvtAv1Encoder
impl Send for SvtAv1Encoder
Auto Trait Implementations§
impl !Sync for SvtAv1Encoder
impl Freeze for SvtAv1Encoder
impl RefUnwindSafe for SvtAv1Encoder
impl Unpin for SvtAv1Encoder
impl UnsafeUnpin for SvtAv1Encoder
impl UnwindSafe for SvtAv1Encoder
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