From e9f998b97db6e498faa62a60c6fddf3cabfea214 Mon Sep 17 00:00:00 2001 From: Jason Garrett-Glaser Date: Thu, 31 Dec 2009 13:45:27 -0500 Subject: [PATCH] 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. --- common/frame.c | 4 ++-- encoder/slicetype.c | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/common/frame.c b/common/frame.c index 1060a21a..08ef87f9 100644 --- a/common/frame.c +++ b/common/frame.c @@ -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++ ) diff --git a/encoder/slicetype.c b/encoder/slicetype.c index 0b26f67f..4ccff110 100644 --- a/encoder/slicetype.c +++ b/encoder/slicetype.c @@ -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<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; } } -- 2.47.3