[x264-devel] commit: Add fast skip in lookahead motion search (Jason Garrett-Glaser )

git at videolan.org git at videolan.org
Wed Jun 2 07:38:27 CEST 2010


x264 | branch: master | Jason Garrett-Glaser <darkshikari at gmail.com> | Thu May 27 10:42:15 2010 -0700| [794713a35eadcd999d5aab4a50274ca43f29be93] | committer: Jason Garrett-Glaser 

Add fast skip in lookahead motion search
Helps speed very significantly on motionless blocks.

> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=794713a35eadcd999d5aab4a50274ca43f29be93
---

 encoder/slicetype.c |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/encoder/slicetype.c b/encoder/slicetype.c
index e454e12..d7cfe5c 100644
--- a/encoder/slicetype.c
+++ b/encoder/slicetype.c
@@ -379,11 +379,25 @@ static void x264_slicetype_mb_cost( x264_t *h, x264_mb_analysis_t *a,
                 CP32( m[l].mvp, mvc[0] );
             else
                 x264_median_mv( m[l].mvp, mvc[0], mvc[1], mvc[2] );
-            x264_me_search( h, &m[l], mvc, i_mvc );
 
+            /* Fast skip for cases of near-zero residual.  Shortcut: don't bother except in the mv0 case,
+             * since anything else is likely to have enough residual to not trigger the skip. */
+            if( !M32( m[l].mvp ) )
+            {
+                m[l].cost = h->pixf.mbcmp[PIXEL_8x8]( m[l].p_fenc[0], FENC_STRIDE, m[l].p_fref[0], m[l].i_stride[0] );
+                if( m[l].cost < 64 )
+                {
+                    M32( m[l].mv ) = 0;
+                    goto skip_motionest;
+                }
+            }
+
+            x264_me_search( h, &m[l], mvc, i_mvc );
             m[l].cost -= 2; // remove mvcost from skip mbs
             if( M32( m[l].mv ) )
                 m[l].cost += 5;
+
+skip_motionest:
             CP32( fenc_mvs[l], m[l].mv );
             *fenc_costs[l] = m[l].cost;
         }



More information about the x264-devel mailing list