Explorar el Código

LibVideo: Rename MV to MotionVector for clarity

Zaggy1024 hace 2 años
padre
commit
1dc4652683

+ 1 - 1
Userland/Libraries/LibVideo/CMakeLists.txt

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

+ 0 - 29
Userland/Libraries/LibVideo/VP9/MV.cpp

@@ -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());
-}
-
-}

+ 29 - 0
Userland/Libraries/LibVideo/VP9/MotionVector.cpp

@@ -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());
+}
+
+}

+ 5 - 5
Userland/Libraries/LibVideo/VP9/MV.h → Userland/Libraries/LibVideo/VP9/MotionVector.h

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

+ 2 - 2
Userland/Libraries/LibVideo/VP9/Parser.cpp

@@ -1208,7 +1208,7 @@ DecoderErrorOr<void> Parser::assign_mv(bool is_compound)
 DecoderErrorOr<void> Parser::read_mv(u8 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));
     if (mv_joint == MvJointHzvnz || mv_joint == MvJointHnzvnz)
         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();
 }
 
-DecoderErrorOr<bool> Parser::use_mv_hp(const MV&)
+DecoderErrorOr<bool> Parser::use_mv_hp(const MotionVector&)
 {
     // TODO: Implement
     return DecoderError::not_implemented();

+ 9 - 9
Userland/Libraries/LibVideo/VP9/Parser.h

@@ -14,7 +14,7 @@
 
 #include "BitStream.h"
 #include "LookupTables.h"
-#include "MV.h"
+#include "MotionVector.h"
 #include "ProbabilityTables.h"
 #include "SyntaxElementCounter.h"
 #include "TreeParser.h"
@@ -122,7 +122,7 @@ private:
     DecoderErrorOr<void> find_mv_refs(ReferenceFrame, int block);
     DecoderErrorOr<void> find_best_ref_mvs(int 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);
 
     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_above_single { false };
     InterpolationFilter m_interp_filter { EightTap };
-    MV m_mv[2];
-    MV m_near_mv[2];
-    MV m_nearest_mv[2];
-    MV m_best_mv[2];
+    MotionVector m_mv[2];
+    MotionVector m_near_mv[2];
+    MotionVector m_nearest_mv[2];
+    MotionVector m_best_mv[2];
     u32 m_ref_frame_width[NUM_REF_FRAMES];
     u32 m_ref_frame_height[NUM_REF_FRAMES];
     u32 m_eob_total { 0 };
@@ -242,7 +242,7 @@ private:
     ReferenceMode m_reference_mode;
     ReferenceFrame m_comp_fixed_ref;
     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<bool> m_skips;
@@ -252,8 +252,8 @@ private:
     Vector<u8> m_segment_ids;
     Vector<Array<ReferenceFrame, 2>> m_ref_frames;
     Vector<InterpolationFilter> m_interp_filters;
-    Vector<Array<MV, 2>> m_mvs;
-    Vector<Array<Array<MV, 4>, 2>> m_sub_mvs;
+    Vector<Array<MotionVector, 2>> m_mvs;
+    Vector<Array<Array<MotionVector, 4>, 2>> m_sub_mvs;
     Vector<Array<IntraMode, 4>> m_sub_modes;
 
     OwnPtr<BitStream> m_bit_stream;