From: Sebastian Dröge Date: Thu, 3 Jul 2014 17:05:22 +0000 (+0200) Subject: d3dhelpers: Swap UV planes properly for YV12 as compared to I420 X-Git-Tag: 1.19.3~507^2~10635 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=73c40a3132b09adaa6abf0c0a1c10e3522983d51;p=platform%2Fupstream%2Fgstreamer.git d3dhelpers: Swap UV planes properly for YV12 as compared to I420 If we only do it in one place colors will look funny. --- diff --git a/sys/d3dvideosink/d3dhelpers.c b/sys/d3dvideosink/d3dhelpers.c index 03ed6ee..386f607 100644 --- a/sys/d3dvideosink/d3dhelpers.c +++ b/sys/d3dvideosink/d3dhelpers.c @@ -629,14 +629,25 @@ gst_d3dsurface_buffer_pool_alloc_buffer (GstBufferPool * bpool, case GST_VIDEO_FORMAT_YV12: offset[0] = 0; stride[0] = lr.Pitch; - offset[2] = - offset[0] + stride[0] * GST_VIDEO_INFO_COMP_HEIGHT (&pool->info, 0); - stride[2] = lr.Pitch / 2; - offset[1] = - offset[2] + stride[2] * GST_VIDEO_INFO_COMP_HEIGHT (&pool->info, 2); - stride[1] = lr.Pitch / 2; - size = - offset[1] + stride[1] * GST_VIDEO_INFO_COMP_HEIGHT (&pool->info, 1); + if (GST_VIDEO_INFO_FORMAT (&pool->info) == GST_VIDEO_FORMAT_YV12) { + offset[1] = + offset[0] + stride[0] * GST_VIDEO_INFO_COMP_HEIGHT (&pool->info, 0); + stride[1] = lr.Pitch / 2; + offset[2] = + offset[1] + stride[1] * GST_VIDEO_INFO_COMP_HEIGHT (&pool->info, 1); + stride[2] = lr.Pitch / 2; + size = + offset[2] + stride[2] * GST_VIDEO_INFO_COMP_HEIGHT (&pool->info, 2); + } else { + offset[2] = + offset[0] + stride[0] * GST_VIDEO_INFO_COMP_HEIGHT (&pool->info, 0); + stride[2] = lr.Pitch / 2; + offset[1] = + offset[2] + stride[2] * GST_VIDEO_INFO_COMP_HEIGHT (&pool->info, 2); + stride[1] = lr.Pitch / 2; + size = + offset[1] + stride[1] * GST_VIDEO_INFO_COMP_HEIGHT (&pool->info, 1); + } break; case GST_VIDEO_FORMAT_NV12: offset[0] = 0;