diff options
author | Zaggy1024 <zaggy1024@gmail.com> | 2022-11-27 00:58:18 -0600 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-11-30 08:28:30 +0100 |
commit | 6ffb0844a15c160bff64e26e485e7a9dd504fdc5 (patch) | |
tree | da3a8fa5d03844f6c6ec68d696fb5e8e3c039666 /Userland/Libraries/LibVideo/VP9 | |
parent | 316dad7bf79a32ab94f6f8e236c03e2693e2ee4e (diff) | |
download | serenity-6ffb0844a15c160bff64e26e485e7a9dd504fdc5.zip |
LibVideo/VP9: Remove the m_use_hp field from Parser
This one is entirely scoped to the motion vector parsing function and
its individual component read function.
Diffstat (limited to 'Userland/Libraries/LibVideo/VP9')
-rw-r--r-- | Userland/Libraries/LibVideo/VP9/Parser.cpp | 12 | ||||
-rw-r--r-- | Userland/Libraries/LibVideo/VP9/Parser.h | 4 |
2 files changed, 7 insertions, 9 deletions
diff --git a/Userland/Libraries/LibVideo/VP9/Parser.cpp b/Userland/Libraries/LibVideo/VP9/Parser.cpp index b14231934f..b18b832b0e 100644 --- a/Userland/Libraries/LibVideo/VP9/Parser.cpp +++ b/Userland/Libraries/LibVideo/VP9/Parser.cpp @@ -1281,19 +1281,19 @@ static bool should_use_high_precision_motion_vector(MotionVector const& delta_ve // read_mv( ref ) in the spec. DecoderErrorOr<MotionVector> Parser::read_motion_vector(BlockContext const& block_context, BlockMotionVectorCandidates const& candidates, ReferenceIndex reference_index) { - m_use_hp = block_context.frame_context.high_precision_motion_vectors_allowed && should_use_high_precision_motion_vector(candidates[reference_index].best_vector); + auto use_high_precision = block_context.frame_context.high_precision_motion_vectors_allowed && should_use_high_precision_motion_vector(candidates[reference_index].best_vector); MotionVector delta_vector; auto joint = TRY_READ(TreeParser::parse_motion_vector_joint(*m_bit_stream, *m_probability_tables, *m_syntax_element_counter)); if ((joint & MotionVectorNonZeroRow) != 0) - delta_vector.set_row(TRY(read_single_motion_vector_component(0))); + delta_vector.set_row(TRY(read_single_motion_vector_component(0, use_high_precision))); if ((joint & MotionVectorNonZeroColumn) != 0) - delta_vector.set_column(TRY(read_single_motion_vector_component(1))); + delta_vector.set_column(TRY(read_single_motion_vector_component(1, use_high_precision))); return candidates[reference_index].best_vector + delta_vector; } // read_mv_component( comp ) in the spec. -DecoderErrorOr<i32> Parser::read_single_motion_vector_component(u8 component) +DecoderErrorOr<i32> Parser::read_single_motion_vector_component(u8 component, bool use_high_precision) { auto mv_sign = TRY_READ(TreeParser::parse_motion_vector_sign(*m_bit_stream, *m_probability_tables, *m_syntax_element_counter, component)); auto mv_class = TRY_READ(TreeParser::parse_motion_vector_class(*m_bit_stream, *m_probability_tables, *m_syntax_element_counter, component)); @@ -1301,7 +1301,7 @@ DecoderErrorOr<i32> Parser::read_single_motion_vector_component(u8 component) if (mv_class == MvClass0) { auto mv_class0_bit = TRY_READ(TreeParser::parse_motion_vector_class0_bit(*m_bit_stream, *m_probability_tables, *m_syntax_element_counter, component)); auto mv_class0_fr = TRY_READ(TreeParser::parse_motion_vector_class0_fr(*m_bit_stream, *m_probability_tables, *m_syntax_element_counter, component, mv_class0_bit)); - auto mv_class0_hp = TRY_READ(TreeParser::parse_motion_vector_class0_hp(*m_bit_stream, *m_probability_tables, *m_syntax_element_counter, component, m_use_hp)); + auto mv_class0_hp = TRY_READ(TreeParser::parse_motion_vector_class0_hp(*m_bit_stream, *m_probability_tables, *m_syntax_element_counter, component, use_high_precision)); magnitude = ((mv_class0_bit << 3) | (mv_class0_fr << 1) | mv_class0_hp) + 1; } else { u32 bits = 0; @@ -1311,7 +1311,7 @@ DecoderErrorOr<i32> Parser::read_single_motion_vector_component(u8 component) } magnitude = CLASS0_SIZE << (mv_class + 2); auto mv_fr = TRY_READ(TreeParser::parse_motion_vector_fr(*m_bit_stream, *m_probability_tables, *m_syntax_element_counter, component)); - auto mv_hp = TRY_READ(TreeParser::parse_motion_vector_hp(*m_bit_stream, *m_probability_tables, *m_syntax_element_counter, component, m_use_hp)); + auto mv_hp = TRY_READ(TreeParser::parse_motion_vector_hp(*m_bit_stream, *m_probability_tables, *m_syntax_element_counter, component, use_high_precision)); magnitude += ((bits << 3) | (mv_fr << 1) | mv_hp) + 1; } return (mv_sign ? -1 : 1) * static_cast<i32>(magnitude); diff --git a/Userland/Libraries/LibVideo/VP9/Parser.h b/Userland/Libraries/LibVideo/VP9/Parser.h index e48407b34c..0d28bb8a3b 100644 --- a/Userland/Libraries/LibVideo/VP9/Parser.h +++ b/Userland/Libraries/LibVideo/VP9/Parser.h @@ -120,7 +120,7 @@ private: DecoderErrorOr<void> read_ref_frames(BlockContext&, FrameBlockContext above_context, FrameBlockContext left_context); DecoderErrorOr<MotionVectorPair> get_motion_vector(BlockContext const&, BlockMotionVectorCandidates const&); DecoderErrorOr<MotionVector> read_motion_vector(BlockContext const&, BlockMotionVectorCandidates const&, ReferenceIndex); - DecoderErrorOr<i32> read_single_motion_vector_component(u8 component); + DecoderErrorOr<i32> read_single_motion_vector_component(u8 component, bool use_high_precision); DecoderErrorOr<bool> residual(BlockContext&, bool has_block_above, bool has_block_left); DecoderErrorOr<bool> tokens(BlockContext&, size_t plane, u32 x, u32 y, TransformSize, TransformSet, Array<u8, 1024> token_cache); DecoderErrorOr<i32> read_coef(u8 bit_depth, Token token); @@ -162,8 +162,6 @@ private: Vector<u16> m_frame_store[NUM_REF_FRAMES][3]; - bool m_use_hp { false }; - bool m_use_prev_frame_mvs; Vector2D<FrameBlockContext> m_reusable_frame_block_contexts; Vector2D<PersistentBlockContext> m_previous_block_contexts; |