[x264-devel] commit: Take into account chroma MV offset during interlaced motion search (Jason Garrett-Glaser )

git version control git at videolan.org
Fri Oct 30 03:13:34 CET 2009


x264 | branch: master | Jason Garrett-Glaser <darkshikari at gmail.com> | Tue Oct 27 16:01:46 2009 -0700| [7016c83611ade1f0d54d62eec3a03fccdb43700d] | committer: Jason Garrett-Glaser 

Take into account chroma MV offset during interlaced motion search
Small improvement in interlaced compression.

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

 encoder/analyse.c |    6 ++++--
 encoder/me.c      |    5 +++--
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/encoder/analyse.c b/encoder/analyse.c
index dec5f93..51dd227 100644
--- a/encoder/analyse.c
+++ b/encoder/analyse.c
@@ -1481,10 +1481,12 @@ static int x264_mb_analyse_inter_p4x4_chroma( x264_t *h, x264_mb_analysis_t *a,
     const int i_stride = h->mb.pic.i_stride[1];
     const int or = 4*(i8x8&1) + 2*(i8x8&2)*i_stride;
     const int oe = 4*(i8x8&1) + 2*(i8x8&2)*FENC_STRIDE;
+    const int i_ref = a->l0.me8x8[i8x8].i_ref;
+    const int mvy_offset = h->mb.b_interlaced & i_ref ? (h->mb.i_mb_y & 1)*4 - 2 : 0;
 
 #define CHROMA4x4MC( width, height, me, x, y ) \
-    h->mc.mc_chroma( &pix1[x+y*16], 16, &p_fref[4][or+x+y*i_stride], i_stride, (me).mv[0], (me).mv[1], width, height ); \
-    h->mc.mc_chroma( &pix2[x+y*16], 16, &p_fref[5][or+x+y*i_stride], i_stride, (me).mv[0], (me).mv[1], width, height );
+    h->mc.mc_chroma( &pix1[x+y*16], 16, &p_fref[4][or+x+y*i_stride], i_stride, (me).mv[0], (me).mv[1]+mvy_offset, width, height ); \
+    h->mc.mc_chroma( &pix2[x+y*16], 16, &p_fref[5][or+x+y*i_stride], i_stride, (me).mv[0], (me).mv[1]+mvy_offset, width, height );
 
     if( pixel == PIXEL_4x4 )
     {
diff --git a/encoder/me.c b/encoder/me.c
index 8510ce2..e7dc007 100644
--- a/encoder/me.c
+++ b/encoder/me.c
@@ -747,11 +747,11 @@ if( b_refine_qpel || (dir^1) != odir ) \
              + p_cost_mvx[ mx ] + p_cost_mvy[ my ]; \
     if( b_chroma_me && cost < bcost ) \
     { \
-        h->mc.mc_chroma( pix[0], 8, m->p_fref[4], m->i_stride[1], mx, my, bw/2, bh/2 ); \
+        h->mc.mc_chroma( pix[0], 8, m->p_fref[4], m->i_stride[1], mx, my + mvy_offset, bw/2, bh/2 ); \
         cost += h->pixf.mbcmp[i_pixel+3]( m->p_fenc[1], FENC_STRIDE, pix[0], 8 ); \
         if( cost < bcost ) \
         { \
-            h->mc.mc_chroma( pix[0], 8, m->p_fref[5], m->i_stride[1], mx, my, bw/2, bh/2 ); \
+            h->mc.mc_chroma( pix[0], 8, m->p_fref[5], m->i_stride[1], mx, my + mvy_offset, bw/2, bh/2 ); \
             cost += h->pixf.mbcmp[i_pixel+3]( m->p_fenc[2], FENC_STRIDE, pix[0], 8 ); \
         } \
     } \
@@ -772,6 +772,7 @@ static void refine_subpel( x264_t *h, x264_me_t *m, int hpel_iters, int qpel_ite
     const uint16_t *p_cost_mvy = m->p_cost_mv - m->mvp[1];
     const int i_pixel = m->i_pixel;
     const int b_chroma_me = h->mb.b_chroma_me && i_pixel <= PIXEL_8x8;
+    const int mvy_offset = h->mb.b_interlaced & m->i_ref ? (h->mb.i_mb_y & 1)*4 - 2 : 0;
 
     ALIGNED_ARRAY_16( uint8_t, pix,[2],[32*18] );   // really 17x17, but round up for alignment
     int omx, omy;



More information about the x264-devel mailing list