pub(crate) struct ContextInner<T: Pixel> {Show 21 fields
pub(crate) frame_count: u64,
pub(crate) limit: Option<u64>,
pub(crate) output_frameno: u64,
pub(super) inter_cfg: InterConfig,
pub(super) frames_processed: u64,
pub(super) frame_q: BTreeMap<u64, Option<Arc<Frame<T>>>>,
pub(super) frame_data: BTreeMap<u64, Option<FrameData<T>>>,
keyframes: BTreeSet<u64>,
keyframes_forced: BTreeSet<u64>,
packet_data: Vec<u8>,
gop_output_frameno_start: BTreeMap<u64, u64>,
pub(crate) gop_input_frameno_start: BTreeMap<u64, u64>,
keyframe_detector: SceneChangeDetector<T>,
pub(crate) config: Arc<EncoderConfig>,
seq: Arc<Sequence>,
pub(crate) rc_state: RCState,
maybe_prev_log_base_q: Option<i64>,
next_lookahead_frame: u64,
next_lookahead_output_frameno: u64,
opaque_q: BTreeMap<u64, Opaque>,
t35_q: BTreeMap<u64, Box<[T35]>>,
}
Fields§
§frame_count: u64
§limit: Option<u64>
§output_frameno: u64
§inter_cfg: InterConfig
§frames_processed: u64
§frame_q: BTreeMap<u64, Option<Arc<Frame<T>>>>
Maps input_frameno to frames
frame_data: BTreeMap<u64, Option<FrameData<T>>>
Maps output_frameno to frame data
keyframes: BTreeSet<u64>
A list of the input_frameno for keyframes in this encode. Needed so that we don’t need to keep all of the frame_invariants in memory for the whole life of the encode.
keyframes_forced: BTreeSet<u64>
§packet_data: Vec<u8>
A storage space for reordered frames.
gop_output_frameno_start: BTreeMap<u64, u64>
Maps output_frameno
to gop_output_frameno_start
.
gop_input_frameno_start: BTreeMap<u64, u64>
Maps output_frameno
to gop_input_frameno_start
.
keyframe_detector: SceneChangeDetector<T>
§config: Arc<EncoderConfig>
§seq: Arc<Sequence>
§rc_state: RCState
§maybe_prev_log_base_q: Option<i64>
§next_lookahead_frame: u64
The next input_frameno
to be processed by lookahead.
next_lookahead_output_frameno: u64
The next output_frameno
to be computed by lookahead.
opaque_q: BTreeMap<u64, Opaque>
Optional opaque to be sent back to the user
t35_q: BTreeMap<u64, Box<[T35]>>
Optional T35 metadata per frame
Implementations§
Source§impl<T: Pixel> ContextInner<T>
impl<T: Pixel> ContextInner<T>
pub fn new(enc: &EncoderConfig) -> Self
pub fn send_frame( &mut self, frame: Option<Arc<Frame<T>>>, params: Option<FrameParameters>, ) -> Result<(), EncoderStatus>
Sourcefn needs_more_frame_q_lookahead(&self, input_frameno: u64) -> bool
fn needs_more_frame_q_lookahead(&self, input_frameno: u64) -> bool
Indicates whether more frames need to be read into the frame queue in order for frame queue lookahead to be full.
Sourcepub fn needs_more_fi_lookahead(&self) -> bool
pub fn needs_more_fi_lookahead(&self) -> bool
Indicates whether more frames need to be processed into FrameInvariants
in order for FI lookahead to be full.
pub fn needs_more_frames(&self, frame_count: u64) -> bool
fn get_rdo_lookahead_frames( &self, ) -> impl Iterator<Item = (&u64, &FrameData<T>)>
fn next_keyframe_input_frameno( &self, gop_input_frameno_start: u64, ignore_limit: bool, ) -> u64
fn set_frame_properties( &mut self, output_frameno: u64, ) -> Result<(), EncoderStatus>
pub fn build_dump_properties() -> PathBuf
fn build_frame_properties( &mut self, output_frameno: u64, ) -> Result<Option<FrameInvariants<T>>, EncoderStatus>
fn get_previous_fi(&self, output_frameno: u64) -> &FrameInvariants<T>
fn get_previous_coded_fi(&self, output_frameno: u64) -> &FrameInvariants<T>
pub(crate) fn done_processing(&self) -> bool
Sourcefn compute_lookahead_motion_vectors(&mut self, output_frameno: u64)
fn compute_lookahead_motion_vectors(&mut self, output_frameno: u64)
Computes lookahead motion vectors and fills in lookahead_mvs
,
rec_buffer
and lookahead_rec_buffer
on the FrameInvariants
. This
function must be called after every new FrameInvariants
is initially
computed.
Sourcefn compute_lookahead_intra_costs(&mut self, output_frameno: u64)
fn compute_lookahead_intra_costs(&mut self, output_frameno: u64)
Computes lookahead intra cost approximations and fills in
lookahead_intra_costs
on the FrameInvariants
.
pub fn compute_keyframe_placement( lookahead_frames: &[&Arc<Frame<T>>], keyframes_forced: &BTreeSet<u64>, keyframe_detector: &mut SceneChangeDetector<T>, next_lookahead_frame: &mut u64, keyframes: &mut BTreeSet<u64>, )
pub fn compute_frame_invariants(&mut self)
fn update_block_importances( fi: &FrameInvariants<T>, me_stats: &FrameMEStats, frame: &Frame<T>, reference_frame: &Frame<T>, bit_depth: usize, bsize: BlockSize, len: usize, reference_frame_block_importances: &mut [f32], )
Sourcefn compute_block_importances(&mut self)
fn compute_block_importances(&mut self)
Computes the block importances for the current output frame.
pub(crate) fn encode_packet( &mut self, cur_output_frameno: u64, ) -> Result<Packet<T>, EncoderStatus>
pub fn encode_show_existing_packet( &mut self, cur_output_frameno: u64, ) -> Result<Packet<T>, EncoderStatus>
pub fn encode_normal_packet( &mut self, cur_output_frameno: u64, ) -> Result<Packet<T>, EncoderStatus>
pub fn receive_packet(&mut self) -> Result<Packet<T>, EncoderStatus>
fn finalize_packet( &mut self, rec: Option<Arc<Frame<T>>>, source: Option<Arc<Frame<T>>>, input_frameno: u64, frame_type: FrameType, qp: u8, enc_stats: EncoderStats, ) -> Result<Packet<T>, EncoderStatus>
fn garbage_collect(&mut self, cur_input_frameno: u64)
Sourcepub(crate) fn guess_frame_subtypes(
&self,
nframes: &mut [i32; 5],
reservoir_frame_delay: i32,
) -> (i32, i32)
pub(crate) fn guess_frame_subtypes( &self, nframes: &mut [i32; 5], reservoir_frame_delay: i32, ) -> (i32, i32)
Counts the number of output frames of each subtype in the next
reservoir_frame_delay
temporal units (needed for rate control).
Returns the number of output frames (excluding SEF frames) and output TUs
until the last keyframe in the next reservoir_frame_delay
temporal units,
or the end of the interval, whichever comes first.
The former is needed because it indicates the number of rate estimates we
will make.
The latter is needed because it indicates the number of times new bitrate
is added to the buffer.
Auto Trait Implementations§
impl<T> Freeze for ContextInner<T>
impl<T> !RefUnwindSafe for ContextInner<T>
impl<T> Send for ContextInner<T>
impl<T> Sync for ContextInner<T>
impl<T> Unpin for ContextInner<T>where
T: Unpin,
impl<T> !UnwindSafe for ContextInner<T>
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
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