mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-18 05:16:05 +00:00
msdkenc: Fix handling of YUY2, UYVY, BGRA surfaces
https://bugzilla.gnome.org/show_bug.cgi?id=789847
This commit is contained in:
parent
d3eeb98f0c
commit
3c611da315
2 changed files with 24 additions and 1 deletions
|
@ -196,6 +196,19 @@ gst_msdkenc_alloc_surfaces (GstMsdkEnc * thiz, GstVideoFormat format,
|
|||
} else if (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)
|
|||
break;
|
||||
|
||||
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:
|
||||
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;
|
||||
surface->Data.Y = surface->Data.U + 1;
|
||||
surface->Data.V = surface->Data.U + 2;
|
||||
break;
|
||||
|
||||
case GST_VIDEO_FORMAT_BGRA:
|
||||
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);
|
||||
break;
|
||||
|
||||
|
@ -190,7 +200,7 @@ msdk_frame_to_surface (GstVideoFrame * frame, mfxFrameSurface1 * surface)
|
|||
height = GST_VIDEO_FRAME_COMP_HEIGHT (frame, 0);
|
||||
src = GST_VIDEO_FRAME_COMP_DATA (frame, 0);
|
||||
sstride = GST_VIDEO_FRAME_COMP_STRIDE (frame, 0);
|
||||
dst = surface->Data.R;
|
||||
dst = surface->Data.B;
|
||||
dstride = surface->Data.Pitch;
|
||||
|
||||
width *= 4;
|
||||
|
|
Loading…
Reference in a new issue