Commit 3c611da3 authored by Hyunjun Ko's avatar Hyunjun Ko Committed by Sebastian Dröge
Browse files

msdkenc: Fix handling of YUY2, UYVY, BGRA surfaces

https://bugzilla.gnome.org/show_bug.cgi?id=789847
parent d3eeb98f
...@@ -196,6 +196,19 @@ gst_msdkenc_alloc_surfaces (GstMsdkEnc * thiz, GstVideoFormat format, ...@@ -196,6 +196,19 @@ gst_msdkenc_alloc_surfaces (GstMsdkEnc * thiz, GstVideoFormat format,
} else if (Y_size) { } else if (Y_size) {
surface->Data.UV = data + Y_size; surface->Data.UV = data + Y_size;
} }
if (format == GST_VIDEO_FORMAT_YUY2) {
surface->Data.U = data + 1;
surface->Data.V = data + 3;
} else if (format == GST_VIDEO_FORMAT_UYVY) {
surface->Data.U = data + 1;
surface->Data.Y = data + 2;
surface->Data.V = data + 3;
} else if (format == GST_VIDEO_FORMAT_BGRA) {
surface->Data.R = data;
surface->Data.G = data + 1;
surface->Data.B = data + 2;
}
} }
} }
......
...@@ -96,13 +96,23 @@ msdk_frame_to_surface (GstVideoFrame * frame, mfxFrameSurface1 * surface) ...@@ -96,13 +96,23 @@ msdk_frame_to_surface (GstVideoFrame * frame, mfxFrameSurface1 * surface)
break; break;
case GST_VIDEO_FORMAT_YUY2: case GST_VIDEO_FORMAT_YUY2:
surface->Data.Y = GST_VIDEO_FRAME_PLANE_DATA (frame, 0);
surface->Data.Pitch = GST_VIDEO_FRAME_COMP_STRIDE (frame, 0);
surface->Data.U = surface->Data.Y + 1;
surface->Data.V = surface->Data.Y + 3;
break;
case GST_VIDEO_FORMAT_UYVY: case GST_VIDEO_FORMAT_UYVY:
surface->Data.Y = GST_VIDEO_FRAME_PLANE_DATA (frame, 0); surface->Data.Y = GST_VIDEO_FRAME_PLANE_DATA (frame, 0);
surface->Data.Pitch = GST_VIDEO_FRAME_COMP_STRIDE (frame, 0); surface->Data.Pitch = GST_VIDEO_FRAME_COMP_STRIDE (frame, 0);
surface->Data.U = surface->Data.Y;
surface->Data.Y = surface->Data.U + 1;
surface->Data.V = surface->Data.U + 2;
break; break;
case GST_VIDEO_FORMAT_BGRA: case GST_VIDEO_FORMAT_BGRA:
surface->Data.R = GST_VIDEO_FRAME_COMP_DATA (frame, 0); surface->Data.R = GST_VIDEO_FRAME_COMP_DATA (frame, 0);
surface->Data.G = surface->Data.R - 1;
surface->Data.B = surface->Data.R - 2;
surface->Data.Pitch = GST_VIDEO_FRAME_COMP_STRIDE (frame, 0); surface->Data.Pitch = GST_VIDEO_FRAME_COMP_STRIDE (frame, 0);
break; break;
...@@ -190,7 +200,7 @@ msdk_frame_to_surface (GstVideoFrame * frame, mfxFrameSurface1 * surface) ...@@ -190,7 +200,7 @@ msdk_frame_to_surface (GstVideoFrame * frame, mfxFrameSurface1 * surface)
height = GST_VIDEO_FRAME_COMP_HEIGHT (frame, 0); height = GST_VIDEO_FRAME_COMP_HEIGHT (frame, 0);
src = GST_VIDEO_FRAME_COMP_DATA (frame, 0); src = GST_VIDEO_FRAME_COMP_DATA (frame, 0);
sstride = GST_VIDEO_FRAME_COMP_STRIDE (frame, 0); sstride = GST_VIDEO_FRAME_COMP_STRIDE (frame, 0);
dst = surface->Data.R; dst = surface->Data.B;
dstride = surface->Data.Pitch; dstride = surface->Data.Pitch;
width *= 4; width *= 4;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment