Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reuse me stats for lookahead #2956

Merged
merged 1 commit into from
Jun 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions src/api/internal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -726,9 +726,6 @@ impl<T: Pixel> ContextInner<T> {

let coded_data = fi.coded_frame_data.as_mut().unwrap();

// Save the motion vectors to FrameInvariants.
coded_data.lookahead_me_stats = Some(fs.frame_me_stats.clone());

#[cfg(feature = "dump_lookahead_data")]
{
use crate::partition::RefType::*;
Expand Down Expand Up @@ -1088,6 +1085,7 @@ impl<T: Pixel> ContextInner<T> {
let output_frame_data =
self.frame_data.remove(&output_frameno).unwrap().unwrap();
let fi = &output_frame_data.fi;
let fs = &output_frame_data.fs;

let frame = self.frame_q[&fi.input_frameno].as_ref().unwrap();

Expand All @@ -1104,13 +1102,7 @@ impl<T: Pixel> ContextInner<T> {
let frame_data = &mut self.frame_data;
let len = unique_indices.len();

let lookahead_me_stats = fi
.coded_frame_data
.as_ref()
.unwrap()
.lookahead_me_stats
.as_ref()
.expect("Lookahead ME stats not populated, this is a bug");
let lookahead_me_stats = &fs.frame_me_stats;

// Compute and propagate the importance, split evenly between the
// referenced frames.
Expand Down
7 changes: 0 additions & 7 deletions src/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -647,12 +647,6 @@ pub struct FrameInvariants<T: Pixel> {
/// This may change in the future.
#[derive(Debug, Clone)]
pub struct CodedFrameData<T: Pixel> {
/// Motion vectors to the _original_ reference frames (not reconstructed).
/// Used for lookahead purposes.
///
/// These objects are very expensive to create, so their creation
/// is deferred until it is needed.
pub lookahead_me_stats: Option<Arc<[FrameMEStats; REF_FRAMES as usize]>>,
/// The lookahead version of `rec_buffer`, used for storing and propagating
/// the original reference frames (rather than reconstructed ones). The
/// lookahead uses both `rec_buffer` and `lookahead_rec_buffer`, where
Expand Down Expand Up @@ -683,7 +677,6 @@ impl<T: Pixel> CodedFrameData<T> {
let h_in_imp_b = fi.h_in_b / 2;

CodedFrameData {
lookahead_me_stats: None,
lookahead_rec_buffer: ReferenceFramesSet::new(),
w_in_imp_b,
h_in_imp_b,
Expand Down