[x264-devel] Expand borders before chroma weightp analysis

Henrik Gramner git at videolan.org
Wed Aug 24 22:40:15 CEST 2011


x264 | branch: master | Henrik Gramner <hengar-6 at student.ltu.se> | Wed Aug 10 20:25:07 2011 +0200| [ada894da37b88f9f92b8747d91245fe88944a8fb] | committer: Jason Garrett-Glaser

Expand borders before chroma weightp analysis
Prevents mc from using uninitialized source pixels.

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

 common/frame.c      |    7 +++++++
 common/frame.h      |    1 +
 encoder/slicetype.c |    2 ++
 3 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/common/frame.c b/common/frame.c
index ffda67f..1a799c6 100644
--- a/common/frame.c
+++ b/common/frame.c
@@ -542,6 +542,13 @@ void x264_frame_expand_border_lowres( x264_frame_t *frame )
         plane_expand_border( frame->lowres[i], frame->i_stride_lowres, frame->i_width_lowres, frame->i_lines_lowres, PADH, PADV, 1, 1, 0 );
 }
 
+void x264_frame_expand_border_chroma( x264_t *h, x264_frame_t *frame, int plane )
+{
+    int shift = !CHROMA444;
+    plane_expand_border( frame->plane[plane], frame->i_stride[plane], 16*h->mb.i_mb_width, 16*h->mb.i_mb_height>>shift,
+                         PADH, PADV>>shift, 1, 1, shift );
+}
+
 void x264_frame_expand_border_mod16( x264_t *h, x264_frame_t *frame )
 {
     for( int i = 0; i < frame->i_plane; i++ )
diff --git a/common/frame.h b/common/frame.h
index 1214672..c87343c 100644
--- a/common/frame.h
+++ b/common/frame.h
@@ -198,6 +198,7 @@ int           x264_frame_copy_picture( x264_t *h, x264_frame_t *dst, x264_pictur
 void          x264_frame_expand_border( x264_t *h, x264_frame_t *frame, int mb_y, int b_end );
 void          x264_frame_expand_border_filtered( x264_t *h, x264_frame_t *frame, int mb_y, int b_end );
 void          x264_frame_expand_border_lowres( x264_frame_t *frame );
+void          x264_frame_expand_border_chroma( x264_t *h, x264_frame_t *frame, int plane );
 void          x264_frame_expand_border_mod16( x264_t *h, x264_frame_t *frame );
 void          x264_expand_border_mbpair( x264_t *h, int mb_x, int mb_y );
 
diff --git a/encoder/slicetype.c b/encoder/slicetype.c
index 417e801..f005b5f 100644
--- a/encoder/slicetype.c
+++ b/encoder/slicetype.c
@@ -115,6 +115,7 @@ static NOINLINE void x264_weight_cost_init_chroma( x264_t *h, x264_frame_t *fenc
 
     if( fenc->lowres_mvs[0][ref0_distance][0][0] != 0x7FFF )
     {
+        x264_frame_expand_border_chroma( h, ref, 1 );
         for( int y = 0, mb_xy = 0, pel_offset_y = 0; y < i_lines; y += 8, pel_offset_y = y*i_stride )
             for( int x = 0, pel_offset_x = 0; x < i_width; x += 8, mb_xy++, pel_offset_x += 8 )
             {
@@ -141,6 +142,7 @@ static NOINLINE pixel *x264_weight_cost_init_chroma444( x264_t *h, x264_frame_t
 
     if( fenc->lowres_mvs[0][ref0_distance][0][0] != 0x7FFF )
     {
+        x264_frame_expand_border_chroma( h, ref, p );
         for( int y = 0, mb_xy = 0, pel_offset_y = 0; y < i_lines; y += 16, pel_offset_y = y*i_stride )
             for( int x = 0, pel_offset_x = 0; x < i_width; x += 16, mb_xy++, pel_offset_x += 16 )
             {



More information about the x264-devel mailing list