2021-06-28 00:03:53 +03:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2021, Hunter Salyer <thefalsehonesty@gmail.com>
|
2022-10-09 06:50:35 +03:00
|
|
|
* Copyright (c) 2022, Gregory Bertilson <zaggy1024@gmail.com>
|
2021-06-28 00:03:53 +03:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <AK/Types.h>
|
|
|
|
|
|
|
|
namespace Video::VP9 {
|
|
|
|
|
2022-10-09 06:50:35 +03:00
|
|
|
struct MotionVector {
|
2021-06-28 00:03:53 +03:00
|
|
|
public:
|
2022-10-09 06:50:35 +03:00
|
|
|
constexpr MotionVector() = default;
|
|
|
|
constexpr MotionVector(MotionVector const& other) = default;
|
|
|
|
constexpr MotionVector(i32 row, i32 col)
|
|
|
|
: m_row(row)
|
|
|
|
, m_column(col)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
constexpr MotionVector& operator=(MotionVector const& other) = default;
|
|
|
|
constexpr MotionVector& operator=(MotionVector&& other) = default;
|
|
|
|
|
|
|
|
constexpr i32 row() const { return m_row; }
|
|
|
|
constexpr void set_row(i32 row) { m_row = row; }
|
|
|
|
constexpr i32 column() const { return m_column; }
|
|
|
|
constexpr void set_column(i32 col) { m_column = col; }
|
|
|
|
|
|
|
|
constexpr MotionVector operator+(MotionVector const& other) const
|
|
|
|
{
|
|
|
|
return MotionVector(this->row() + other.row(), this->column() + other.column());
|
|
|
|
}
|
|
|
|
constexpr MotionVector& operator+=(MotionVector const& other)
|
|
|
|
{
|
|
|
|
*this = *this + other;
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
constexpr MotionVector operator*(i32 scalar) const
|
|
|
|
{
|
|
|
|
return MotionVector(this->row() * scalar, this->column() * scalar);
|
|
|
|
}
|
|
|
|
constexpr MotionVector& operator*=(i32 scalar)
|
|
|
|
{
|
|
|
|
*this = *this * scalar;
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
constexpr bool operator==(MotionVector const& other) const
|
|
|
|
{
|
|
|
|
return this->row() == other.row() && this->column() == other.column();
|
|
|
|
}
|
2021-06-28 00:03:53 +03:00
|
|
|
|
|
|
|
private:
|
2022-10-09 06:50:35 +03:00
|
|
|
i32 m_row { 0 };
|
|
|
|
i32 m_column { 0 };
|
2021-06-28 00:03:53 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|