[x264-devel] MBAFF: Add regularization to VSAD metric

Jason Garrett-Glaser git at videolan.org
Thu May 12 08:39:11 CEST 2011


x264 | branch: master | Jason Garrett-Glaser <jason at x264.com> | Sun May  8 18:46:52 2011 -0700| [949846678208f15e31d9de8446dbfe05df664a69] | committer: Jason Garrett-Glaser

MBAFF: Add regularization to VSAD metric
Bias towards the MBAFF decisions made in neighboring mb pairs.
~2% better compression on a random 1080i HDTV source.

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

 common/pixel.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/common/pixel.c b/common/pixel.c
index 0dec791..cf8be63 100644
--- a/common/pixel.c
+++ b/common/pixel.c
@@ -654,7 +654,9 @@ int x264_field_vsad( x264_t *h, int mb_x, int mb_y )
 {
     int score_field, score_frame;
     int stride = h->fenc->i_stride[0];
+    int mb_stride = h->mb.i_mb_stride;
     pixel *fenc = h->fenc->plane[0] + 16 * (mb_x + mb_y * stride);
+    int mb_xy = mb_x + mb_y*mb_stride;
 
     /* We don't want to analyze pixels outside the frame, as it gives inaccurate results. */
     int mbpair_height = X264_MIN( h->param.i_height - mb_y * 16, 32 );
@@ -662,6 +664,11 @@ int x264_field_vsad( x264_t *h, int mb_x, int mb_y )
     score_field  = h->pixf.vsad( fenc,        stride*2, mbpair_height >> 1 );
     score_field += h->pixf.vsad( fenc+stride, stride*2, mbpair_height >> 1 );
 
+    if( mb_x > 0 )
+        score_field += 512 - h->mb.field[mb_xy        -1]*1024;
+    if( mb_y > 0 )
+        score_field += 512 - h->mb.field[mb_xy-mb_stride]*1024;
+
     return (score_field < score_frame);
 }
 



More information about the x264-devel mailing list