]> granicus.if.org Git - libvpx/commitdiff
Fix bug in 1st pass motion compensation
authorAdrian Grange <agrange@google.com>
Thu, 1 Jul 2010 13:17:04 +0000 (14:17 +0100)
committerAdrian Grange <agrange@google.com>
Thu, 1 Jul 2010 13:19:43 +0000 (14:19 +0100)
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

vp8/encoder/firstpass.c

index 74feca3141661d0585a1305ff0e706ce5ca1a1f4..0a33feb1c1880f5de34c96ac4c9150b9f7094e1a 100644 (file)
@@ -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 )
                    {