summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibVideo
diff options
context:
space:
mode:
authorZaggy1024 <zaggy1024@gmail.com>2023-01-30 16:58:27 -0600
committerLinus Groh <mail@linusgroh.de>2023-02-08 18:56:42 +0000
commitdf313c3dc5fcc2cf165c476abf2c04dd220d4471 (patch)
treebdb95a5173df14a7d2c3e5823da11ab1d5d9d73e /Userland/Libraries/LibVideo
parentc18728989e79260278567c9bfd3c5f47ba9b8636 (diff)
downloadserenity-df313c3dc5fcc2cf165c476abf2c04dd220d4471.zip
LibVideo/VP9: Clamp motion vectors again in find_mv_refs function
The clamping was previously removed apparently, which was unintended and caused some files to fail to decode properly.
Diffstat (limited to 'Userland/Libraries/LibVideo')
-rw-r--r--Userland/Libraries/LibVideo/VP9/Parser.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/Userland/Libraries/LibVideo/VP9/Parser.cpp b/Userland/Libraries/LibVideo/VP9/Parser.cpp
index 02d6880356..d8ba61be79 100644
--- a/Userland/Libraries/LibVideo/VP9/Parser.cpp
+++ b/Userland/Libraries/LibVideo/VP9/Parser.cpp
@@ -1582,6 +1582,10 @@ static MotionVector clamp_motion_vector(BlockContext const& block_context, Motio
// find_mv_refs( refFrame, block ) in the spec.
MotionVectorPair Parser::find_reference_motion_vectors(BlockContext& block_context, ReferenceFrameType reference_frame, i32 block)
{
+ // FIXME: We should be able to change behavior based on the reference motion vector that will be selected.
+ // If block_context.y_prediction_mode() != NearMv, then we only need the first motion vector that is added to our result.
+ // This behavior should combine this function with select_best_reference_motion_vectors(). When that is done, check whether
+ // the motion vector clamping in that function is always a larger area than in this function. If so, we can drop that call.
bool different_ref_found = false;
u8 context_counter = 0;
@@ -1646,6 +1650,8 @@ MotionVectorPair Parser::find_reference_motion_vectors(BlockContext& block_conte
MotionVectorPair result;
for (auto i = 0u; i < list.size(); i++)
result[static_cast<ReferenceIndex>(i)] = list[i];
+ result.primary = clamp_motion_vector(block_context, result.primary, MV_BORDER);
+ result.secondary = clamp_motion_vector(block_context, result.secondary, MV_BORDER);
return result;
}