From: Henrik Gramner Date: Sun, 14 Aug 2011 11:39:29 +0000 (+0200) Subject: Fix pic_out returned by x264_encoder_encode with 4:4:4 X-Git-Url: http://www.zmx.ovh/git.videolan.org/?a=commitdiff_plain;h=86c5510ea34314274431ff107d67eefc3c3753f8;p=x264.git Fix pic_out returned by x264_encoder_encode with 4:4:4 --- diff --git a/common/frame.c b/common/frame.c index 1a799c68..21134a85 100644 --- a/common/frame.c +++ b/common/frame.c @@ -102,6 +102,7 @@ static x264_frame_t *x264_frame_new( x264_t *h, int b_fdec ) else goto fail; + frame->i_csp = i_csp; frame->i_width_lowres = frame->i_width[0]/2; frame->i_lines_lowres = frame->i_lines[0]/2; frame->i_stride_lowres = align_stride( frame->i_width_lowres + 2*PADH, align, disalign<<1 ); diff --git a/common/frame.h b/common/frame.h index c87343cb..c3365c6f 100644 --- a/common/frame.h +++ b/common/frame.h @@ -64,6 +64,7 @@ typedef struct x264_frame int i_poc_l0ref0; /* poc of first refframe in L0, used to check if direct temporal is possible */ /* YUV buffer */ + int i_csp; /* Internal csp */ int i_plane; int i_stride[3]; int i_width[3]; diff --git a/encoder/encoder.c b/encoder/encoder.c index dc552846..e6584488 100644 --- a/encoder/encoder.c +++ b/encoder/encoder.c @@ -3023,12 +3023,12 @@ static int x264_encoder_frame_end( x264_t *h, x264_t *thread_current, if( pic_out->i_pts < pic_out->i_dts ) x264_log( h, X264_LOG_WARNING, "invalid DTS: PTS is less than DTS\n" ); - pic_out->img.i_csp = X264_CSP_NV12; + pic_out->img.i_csp = h->fdec->i_csp; #if HIGH_BIT_DEPTH pic_out->img.i_csp |= X264_CSP_HIGH_DEPTH; #endif pic_out->img.i_plane = h->fdec->i_plane; - for( int i = 0; i < 2; i++ ) + for( int i = 0; i < pic_out->img.i_plane; i++ ) { pic_out->img.i_stride[i] = h->fdec->i_stride[i] * sizeof(pixel); pic_out->img.plane[i] = (uint8_t*)h->fdec->plane[i];