[x264-devel] Fix pic_out returned by x264_encoder_encode with 4:4:4

Henrik Gramner git at videolan.org
Wed Aug 24 22:40:16 CEST 2011


x264 | branch: master | Henrik Gramner <hengar-6 at student.ltu.se> | Sun Aug 14 13:39:29 2011 +0200| [86c5510ea34314274431ff107d67eefc3c3753f8] | committer: Jason Garrett-Glaser

Fix pic_out returned by x264_encoder_encode with 4:4:4

> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=86c5510ea34314274431ff107d67eefc3c3753f8
---

 common/frame.c    |    1 +
 common/frame.h    |    1 +
 encoder/encoder.c |    4 ++--
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/common/frame.c b/common/frame.c
index 1a799c6..21134a8 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 c87343c..c3365c6 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 dc55284..e658448 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];



More information about the x264-devel mailing list