Commit af0d8d85 authored by Henrik Gramner's avatar Henrik Gramner Committed by Fiona Glaser
Browse files

Expand borders before chroma weightp analysis

Prevents mc from using uninitialized source pixels.
parent cfcce49d
......@@ -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++ )
......
......@@ -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 );
......
......@@ -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 )
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment