Commit bc0ae2ef authored by Fiona Glaser's avatar Fiona Glaser

More correct padding constants for lowres planes

Since lowres analysis isn't interlace-aware, we don't need to double the vertical padding for interlaced video.
parent 5d40e878
......@@ -124,11 +124,11 @@ x264_frame_t *x264_frame_new( x264_t *h, int b_fdec )
frame->i_stride_lowres = ALIGN( frame->i_width_lowres + 2*PADH, align );
frame->i_lines_lowres = frame->i_lines[0]/2;
luma_plane_size = frame->i_stride_lowres * (frame->i_lines[0]/2 + 2*i_padv);
luma_plane_size = frame->i_stride_lowres * (frame->i_lines[0]/2 + 2*PADV);
CHECKED_MALLOC( frame->buffer_lowres[0], 4 * luma_plane_size );
for( i = 0; i < 4; i++ )
frame->lowres[i] = frame->buffer_lowres[0] + (frame->i_stride_lowres * i_padv + PADH) + i * luma_plane_size;
frame->lowres[i] = frame->buffer_lowres[0] + (frame->i_stride_lowres * PADV + PADH) + i * luma_plane_size;
for( j = 0; j <= !!h->param.i_bframe; j++ )
for( i = 0; i <= h->param.i_bframe; i++ )
......
......@@ -231,14 +231,13 @@ void x264_weights_analyse( x264_t *h, x264_frame_t *fenc, x264_frame_t *ref, int
if( weights[0].weightfn && b_lookahead )
{
//scale lowres in lookahead for slicetype_frame_cost
int i_padv = PADV<<h->param.b_interlaced;
uint8_t *src = ref->buffer_lowres[0];
uint8_t *dst = h->mb.p_weight_buf[0];
int width = ref->i_width_lowres + PADH*2;
int height = ref->i_lines_lowres + i_padv*2;
int height = ref->i_lines_lowres + PADV*2;
x264_weight_scale_plane( h, dst, ref->i_stride_lowres, src, ref->i_stride_lowres,
width, height, &weights[0] );
fenc->weighted[0] = h->mb.p_weight_buf[0] + PADH + ref->i_stride_lowres * i_padv;
fenc->weighted[0] = h->mb.p_weight_buf[0] + PADH + ref->i_stride_lowres * PADV;
}
}
......
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