Commit 0618ff14 authored by Adrian Grange's avatar Adrian Grange

Fix bug in 1st pass motion compensation

In the case where the best reference mv is not (0,0) a secondary
search is carried out centered on (0,0). However, rather than
sending tmp_err into the search function, motion_error was
inadvertently passed.

As a result tmp_err remains set at INT_MAX and the (0,0)-based
search result will never be selected, even if it is better.

Change-Id: I3c82b246c8c82ba887b9d3fb4c9e0a0f2fe5a76c
parent 2e3d8d32
......@@ -639,14 +639,18 @@ void vp8_first_pass(VP8_COMP *cpi)
d->bmi.mv.as_mv.row = 0;
d->bmi.mv.as_mv.col = 0;
// Test last reference frame using the previous best mv as the starting point (best reference) for the search
vp8_first_pass_motion_search(cpi, x, &best_ref_mv, &d->bmi.mv.as_mv, &cm->last_frame, &motion_error, recon_yoffset);
// Test last reference frame using the previous best mv as the
// starting point (best reference) for the search
vp8_first_pass_motion_search(cpi, x, &best_ref_mv,
&d->bmi.mv.as_mv, &cm->last_frame,
&motion_error, recon_yoffset);
// If the current best reference mv is not centred on 0,0 then do a 0,0 based search as well
if ((best_ref_mv.col != 0) || (best_ref_mv.row != 0))
{
tmp_err = INT_MAX;
vp8_first_pass_motion_search(cpi, x, &zero_ref_mv, &tmp_mv, &cm->last_frame, &motion_error, recon_yoffset);
vp8_first_pass_motion_search(cpi, x, &zero_ref_mv, &tmp_mv,
&cm->last_frame, &tmp_err, recon_yoffset);
if ( tmp_err < motion_error )
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment