1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 05:07:45 +00:00

LibVideo: Rename MV to MotionVector for clarity

This commit is contained in:
Zaggy1024 2022-10-08 22:39:20 -05:00 committed by Andrew Kaster
parent 85fd56cf48
commit 1dc4652683
6 changed files with 46 additions and 46 deletions

View file

@ -2,7 +2,7 @@ set(SOURCES
MatroskaReader.cpp MatroskaReader.cpp
VP9/BitStream.cpp VP9/BitStream.cpp
VP9/Decoder.cpp VP9/Decoder.cpp
VP9/MV.cpp VP9/MotionVector.cpp
VP9/Parser.cpp VP9/Parser.cpp
VP9/ProbabilityTables.cpp VP9/ProbabilityTables.cpp
VP9/SyntaxElementCounter.cpp VP9/SyntaxElementCounter.cpp

View file

@ -1,29 +0,0 @@
/*
* Copyright (c) 2021, Hunter Salyer <thefalsehonesty@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include "MV.h"
namespace Video::VP9 {
MV::MV(u32 row, u32 col)
: m_row(row)
, m_col(col)
{
}
MV& MV::operator=(i32 value)
{
m_row = value;
m_col = value;
return *this;
}
MV MV::operator+(MV const& other) const
{
return MV(this->row() + other.row(), this->col() + other.col());
}
}

View file

@ -0,0 +1,29 @@
/*
* Copyright (c) 2021, Hunter Salyer <thefalsehonesty@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include "MotionVector.h"
namespace Video::VP9 {
MotionVector::MotionVector(u32 row, u32 col)
: m_row(row)
, m_col(col)
{
}
MotionVector& MotionVector::operator=(i32 value)
{
m_row = value;
m_col = value;
return *this;
}
MotionVector MotionVector::operator+(MotionVector const& other) const
{
return MotionVector(this->row() + other.row(), this->col() + other.col());
}
}

View file

@ -10,18 +10,18 @@
namespace Video::VP9 { namespace Video::VP9 {
class MV { class MotionVector {
public: public:
MV() = default; MotionVector() = default;
MV(u32 row, u32 col); MotionVector(u32 row, u32 col);
u32 row() const { return m_row; } u32 row() const { return m_row; }
void set_row(u32 row) { m_row = row; } void set_row(u32 row) { m_row = row; }
u32 col() const { return m_col; } u32 col() const { return m_col; }
void set_col(u32 col) { m_col = col; } void set_col(u32 col) { m_col = col; }
MV& operator=(i32 value); MotionVector& operator=(i32 value);
MV operator+(MV const& other) const; MotionVector operator+(MotionVector const& other) const;
private: private:
u32 m_row { 0 }; u32 m_row { 0 };

View file

@ -1208,7 +1208,7 @@ DecoderErrorOr<void> Parser::assign_mv(bool is_compound)
DecoderErrorOr<void> Parser::read_mv(u8 ref) DecoderErrorOr<void> Parser::read_mv(u8 ref)
{ {
m_use_hp = m_allow_high_precision_mv && TRY(use_mv_hp(m_best_mv[ref])); m_use_hp = m_allow_high_precision_mv && TRY(use_mv_hp(m_best_mv[ref]));
MV diff_mv; MotionVector diff_mv;
auto mv_joint = TRY_READ(m_tree_parser->parse_tree<MvJoint>(SyntaxElementType::MVJoint)); auto mv_joint = TRY_READ(m_tree_parser->parse_tree<MvJoint>(SyntaxElementType::MVJoint));
if (mv_joint == MvJointHzvnz || mv_joint == MvJointHnzvnz) if (mv_joint == MvJointHzvnz || mv_joint == MvJointHnzvnz)
diff_mv.set_row(TRY(read_mv_component(0))); diff_mv.set_row(TRY(read_mv_component(0)));
@ -1429,7 +1429,7 @@ DecoderErrorOr<void> Parser::append_sub8x8_mvs(u8, u8)
return DecoderError::not_implemented(); return DecoderError::not_implemented();
} }
DecoderErrorOr<bool> Parser::use_mv_hp(const MV&) DecoderErrorOr<bool> Parser::use_mv_hp(const MotionVector&)
{ {
// TODO: Implement // TODO: Implement
return DecoderError::not_implemented(); return DecoderError::not_implemented();

View file

@ -14,7 +14,7 @@
#include "BitStream.h" #include "BitStream.h"
#include "LookupTables.h" #include "LookupTables.h"
#include "MV.h" #include "MotionVector.h"
#include "ProbabilityTables.h" #include "ProbabilityTables.h"
#include "SyntaxElementCounter.h" #include "SyntaxElementCounter.h"
#include "TreeParser.h" #include "TreeParser.h"
@ -122,7 +122,7 @@ private:
DecoderErrorOr<void> find_mv_refs(ReferenceFrame, int block); DecoderErrorOr<void> find_mv_refs(ReferenceFrame, int block);
DecoderErrorOr<void> find_best_ref_mvs(int ref_list); DecoderErrorOr<void> find_best_ref_mvs(int ref_list);
DecoderErrorOr<void> append_sub8x8_mvs(u8 block, u8 ref_list); DecoderErrorOr<void> append_sub8x8_mvs(u8 block, u8 ref_list);
DecoderErrorOr<bool> use_mv_hp(MV const& delta_mv); DecoderErrorOr<bool> use_mv_hp(MotionVector const& delta_mv);
size_t get_image_index(u32 row, u32 column); size_t get_image_index(u32 row, u32 column);
Gfx::Point<size_t> get_decoded_point_for_plane(u8 row, u8 column, u8 plane); Gfx::Point<size_t> get_decoded_point_for_plane(u8 row, u8 column, u8 plane);
@ -227,10 +227,10 @@ private:
bool m_left_single { false }; bool m_left_single { false };
bool m_above_single { false }; bool m_above_single { false };
InterpolationFilter m_interp_filter { EightTap }; InterpolationFilter m_interp_filter { EightTap };
MV m_mv[2]; MotionVector m_mv[2];
MV m_near_mv[2]; MotionVector m_near_mv[2];
MV m_nearest_mv[2]; MotionVector m_nearest_mv[2];
MV m_best_mv[2]; MotionVector m_best_mv[2];
u32 m_ref_frame_width[NUM_REF_FRAMES]; u32 m_ref_frame_width[NUM_REF_FRAMES];
u32 m_ref_frame_height[NUM_REF_FRAMES]; u32 m_ref_frame_height[NUM_REF_FRAMES];
u32 m_eob_total { 0 }; u32 m_eob_total { 0 };
@ -242,7 +242,7 @@ private:
ReferenceMode m_reference_mode; ReferenceMode m_reference_mode;
ReferenceFrame m_comp_fixed_ref; ReferenceFrame m_comp_fixed_ref;
ReferenceFrame m_comp_var_ref[2]; ReferenceFrame m_comp_var_ref[2];
MV m_block_mvs[2][4]; MotionVector m_block_mvs[2][4];
Vector<u8> m_prev_segment_ids; Vector<u8> m_prev_segment_ids;
Vector<bool> m_skips; Vector<bool> m_skips;
@ -252,8 +252,8 @@ private:
Vector<u8> m_segment_ids; Vector<u8> m_segment_ids;
Vector<Array<ReferenceFrame, 2>> m_ref_frames; Vector<Array<ReferenceFrame, 2>> m_ref_frames;
Vector<InterpolationFilter> m_interp_filters; Vector<InterpolationFilter> m_interp_filters;
Vector<Array<MV, 2>> m_mvs; Vector<Array<MotionVector, 2>> m_mvs;
Vector<Array<Array<MV, 4>, 2>> m_sub_mvs; Vector<Array<Array<MotionVector, 4>, 2>> m_sub_mvs;
Vector<Array<IntraMode, 4>> m_sub_modes; Vector<Array<IntraMode, 4>> m_sub_modes;
OwnPtr<BitStream> m_bit_stream; OwnPtr<BitStream> m_bit_stream;