Fix pic_out returned by x264_encoder_encode with 4:4:4
authorHenrik Gramner <hengar-6@student.ltu.se>
Sun, 14 Aug 2011 11:39:29 +0000 (13:39 +0200)
committerFiona Glaser <fiona@x264.com>
Wed, 24 Aug 2011 17:22:54 +0000 (10:22 -0700)
common/frame.c
common/frame.h
encoder/encoder.c

index c861bbf..92ce87d 100644 (file)
@@ -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 );
index 44cd4f0..77af60d 100644 (file)
@@ -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];
index 61c4ff2..5456518 100644 (file)
@@ -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];