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
diff --git a/vp8/encoder/firstpass.c b/vp8/encoder/firstpass.c
index 74feca3..0a33feb 100644
--- a/vp8/encoder/firstpass.c
+++ b/vp8/encoder/firstpass.c
@@ -639,14 +639,18 @@
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 )
{