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

LibVideo: Add MotionVector lookup tables as constant expressions

This changes MotionVector by removing the cpp file and moving all
functions to the header, where they are now declared as constexpr
so that they can be compile-time evaluated in LookupTables.h.
This commit is contained in:
Zaggy1024 2022-10-08 22:50:35 -05:00 committed by Andrew Kaster
parent 1dc4652683
commit 6c648329c4
5 changed files with 87 additions and 44 deletions

View file

@ -1190,7 +1190,7 @@ DecoderErrorOr<void> Parser::read_ref_frames()
DecoderErrorOr<void> Parser::assign_mv(bool is_compound)
{
m_mv[1] = 0;
m_mv[1] = {};
for (auto i = 0; i < 1 + is_compound; i++) {
if (m_y_mode == NewMv) {
TRY(read_mv(i));
@ -1199,7 +1199,7 @@ DecoderErrorOr<void> Parser::assign_mv(bool is_compound)
} else if (m_y_mode == NearMv) {
m_mv[i] = m_near_mv[i];
} else {
m_mv[i] = 0;
m_mv[i] = {};
}
}
return {};
@ -1213,7 +1213,7 @@ DecoderErrorOr<void> Parser::read_mv(u8 ref)
if (mv_joint == MvJointHzvnz || mv_joint == MvJointHnzvnz)
diff_mv.set_row(TRY(read_mv_component(0)));
if (mv_joint == MvJointHnzvz || mv_joint == MvJointHnzvnz)
diff_mv.set_col(TRY(read_mv_component(1)));
diff_mv.set_column(TRY(read_mv_component(1)));
m_mv[ref] = m_best_mv[ref] + diff_mv;
return {};
}