Struct ContextInner

Source
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>

Source

pub fn new(enc: &EncoderConfig) -> Self

Source

pub fn send_frame( &mut self, frame: Option<Arc<Frame<T>>>, params: Option<FrameParameters>, ) -> Result<(), EncoderStatus>

Source

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.

Source

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.

Source

pub fn needs_more_frames(&self, frame_count: u64) -> bool

Source

fn get_rdo_lookahead_frames( &self, ) -> impl Iterator<Item = (&u64, &FrameData<T>)>

Source

fn next_keyframe_input_frameno( &self, gop_input_frameno_start: u64, ignore_limit: bool, ) -> u64

Source

fn set_frame_properties( &mut self, output_frameno: u64, ) -> Result<(), EncoderStatus>

Source

pub fn build_dump_properties() -> PathBuf

Source

fn build_frame_properties( &mut self, output_frameno: u64, ) -> Result<Option<FrameInvariants<T>>, EncoderStatus>

Source

fn get_previous_fi(&self, output_frameno: u64) -> &FrameInvariants<T>

Source

fn get_previous_coded_fi(&self, output_frameno: u64) -> &FrameInvariants<T>

Source

pub(crate) fn done_processing(&self) -> bool

Source

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.

Source

fn compute_lookahead_intra_costs(&mut self, output_frameno: u64)

Computes lookahead intra cost approximations and fills in lookahead_intra_costs on the FrameInvariants.

Source

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>, )

Source

pub fn compute_frame_invariants(&mut self)

Source

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], )

Source

fn compute_block_importances(&mut self)

Computes the block importances for the current output frame.

Source

pub(crate) fn encode_packet( &mut self, cur_output_frameno: u64, ) -> Result<Packet<T>, EncoderStatus>

Source

pub fn encode_show_existing_packet( &mut self, cur_output_frameno: u64, ) -> Result<Packet<T>, EncoderStatus>

Source

pub fn encode_normal_packet( &mut self, cur_output_frameno: u64, ) -> Result<Packet<T>, EncoderStatus>

Source

pub fn receive_packet(&mut self) -> Result<Packet<T>, EncoderStatus>

Source

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>

Source

fn garbage_collect(&mut self, cur_input_frameno: u64)

Source

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.