From b5cce5a448cf6adcb6afb5f3bf940a8d181f6f34 Mon Sep 17 00:00:00 2001 From: Zaggy1024 Date: Sun, 27 Nov 2022 01:02:08 -0600 Subject: [PATCH] LibVideo/VP9: Move the m_use_prev_frame_mvs field to FrameContext --- Userland/Libraries/LibVideo/VP9/Context.h | 2 ++ Userland/Libraries/LibVideo/VP9/Parser.cpp | 6 +++--- Userland/Libraries/LibVideo/VP9/Parser.h | 1 - 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Userland/Libraries/LibVideo/VP9/Context.h b/Userland/Libraries/LibVideo/VP9/Context.h index 12619a1b85..29344d2366 100644 --- a/Userland/Libraries/LibVideo/VP9/Context.h +++ b/Userland/Libraries/LibVideo/VP9/Context.h @@ -53,6 +53,8 @@ public: } u8 existing_frame_index() const { return m_existing_frame_index; } + bool use_previous_frame_motion_vectors { false }; + ColorConfig color_config {}; u8 reference_frames_to_update_flags { 0 }; diff --git a/Userland/Libraries/LibVideo/VP9/Parser.cpp b/Userland/Libraries/LibVideo/VP9/Parser.cpp index b18b832b0e..b6a07e4354 100644 --- a/Userland/Libraries/LibVideo/VP9/Parser.cpp +++ b/Userland/Libraries/LibVideo/VP9/Parser.cpp @@ -391,7 +391,7 @@ DecoderErrorOr Parser::compute_image_size(FrameContext& frame_context) // d. error_resilient_mode is equal to 0. // e. FrameIsIntra is equal to 0. // Otherwise, UsePrevFrameMvs is set equal to 0. - m_use_prev_frame_mvs = !first_invoke && same_size && m_previous_show_frame && !frame_context.error_resilient_mode && frame_context.is_inter_predicted(); + frame_context.use_previous_frame_motion_vectors = !first_invoke && same_size && m_previous_show_frame && !frame_context.error_resilient_mode && frame_context.is_inter_predicted(); return {}; } @@ -1634,7 +1634,7 @@ MotionVectorPair Parser::find_reference_motion_vectors(BlockContext const& block add_motion_vector_if_reference_frame_type_is_same(block_context, candidate, reference_frame, list, false); } } - if (m_use_prev_frame_mvs) + if (block_context.frame_context.use_previous_frame_motion_vectors) add_motion_vector_if_reference_frame_type_is_same(block_context, base_coordinates, reference_frame, list, true); if (different_ref_found) { @@ -1644,7 +1644,7 @@ MotionVectorPair Parser::find_reference_motion_vectors(BlockContext const& block add_motion_vector_if_reference_frame_type_is_different(block_context, candidate, reference_frame, list, false); } } - if (m_use_prev_frame_mvs) + if (block_context.frame_context.use_previous_frame_motion_vectors) add_motion_vector_if_reference_frame_type_is_different(block_context, base_coordinates, reference_frame, list, true); m_mode_context[reference_frame] = counter_to_context[context_counter]; diff --git a/Userland/Libraries/LibVideo/VP9/Parser.h b/Userland/Libraries/LibVideo/VP9/Parser.h index 0d28bb8a3b..bd2da7c899 100644 --- a/Userland/Libraries/LibVideo/VP9/Parser.h +++ b/Userland/Libraries/LibVideo/VP9/Parser.h @@ -162,7 +162,6 @@ private: Vector m_frame_store[NUM_REF_FRAMES][3]; - bool m_use_prev_frame_mvs; Vector2D m_reusable_frame_block_contexts; Vector2D m_previous_block_contexts; // Indexed by ReferenceFrame enum.