From c82273d6d74271e0f743c5729e7438ff37e2df5e Mon Sep 17 00:00:00 2001 From: Jason Garrett-Glaser Date: Sat, 1 May 2010 19:34:14 -0700 Subject: [PATCH] More accurate MV prediction on edges in lookahead --- encoder/slicetype.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/encoder/slicetype.c b/encoder/slicetype.c index cf2be0e1..93523679 100644 --- a/encoder/slicetype.c +++ b/encoder/slicetype.c @@ -381,21 +381,23 @@ static void x264_slicetype_mb_cost( x264_t *h, x264_mb_analysis_t *a, /* Reverse-order MV prediction. */ M32( mvc[0] ) = 0; - M32( mvc[1] ) = 0; M32( mvc[2] ) = 0; #define MVC(mv) { CP32( mvc[i_mvc], mv ); i_mvc++; } if( i_mb_x < h->sps->i_mb_width - 1 ) - MVC(fenc_mv[1]); + MVC( fenc_mv[1] ); if( i_mb_y < h->sps->i_mb_height - 1 ) { - MVC(fenc_mv[i_mb_stride]); + MVC( fenc_mv[i_mb_stride] ); if( i_mb_x > 0 ) - MVC(fenc_mv[i_mb_stride-1]); + MVC( fenc_mv[i_mb_stride-1] ); if( i_mb_x < h->sps->i_mb_width - 1 ) - MVC(fenc_mv[i_mb_stride+1]); + MVC( fenc_mv[i_mb_stride+1] ); } #undef MVC - x264_median_mv( m[l].mvp, mvc[0], mvc[1], mvc[2] ); + if( i_mvc <= 1 ) + 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 ); m[l].cost -= 2; // remove mvcost from skip mbs -- 2.47.3