msdk: remove unused code

There's unused code remaining since MSDK bufferpool patches landed.

https://bugzilla.gnome.org/show_bug.cgi?id=793741
This commit is contained in:
Hyunjun Ko 2018-02-23 14:30:56 -09:00 committed by Sreerenj Balachandran
parent 37a9e0fff9
commit 14f0186741

View file

@ -59,188 +59,6 @@ static const struct map gst_msdk_video_format_to_mfx_map[] = {
{0, 0, 0}
};
static inline guint
msdk_get_free_surface_index (mfxFrameSurface1 * surfaces, guint size)
{
if (surfaces) {
guint i;
for (i = 0; i < size; i++) {
if (!surfaces[i].Data.Locked)
return i;
}
}
return INVALID_INDEX;
}
mfxFrameSurface1 *
msdk_get_free_surface (mfxFrameSurface1 * surfaces, guint size)
{
guint idx = INVALID_INDEX;
guint i;
/* Poll the pool for a maximum of 20 milisecnds */
for (i = 0; i < 2000; i++) {
idx = msdk_get_free_surface_index (surfaces, size);
if (idx != INVALID_INDEX)
break;
g_usleep (10);
}
return (idx == INVALID_INDEX ? NULL : &surfaces[idx]);
}
/* FIXME: Only NV12 is supported by now, add other YUV formats */
void
msdk_frame_to_surface (GstVideoFrame * frame, mfxFrameSurface1 * surface)
{
guint8 *src, *dst;
guint sstride, dstride;
guint width, height;
guint i, p;
if (!surface->Data.MemId) {
switch (frame->info.finfo->format) {
case GST_VIDEO_FORMAT_NV12:
surface->Data.Y = GST_VIDEO_FRAME_COMP_DATA (frame, 0);
surface->Data.UV = GST_VIDEO_FRAME_COMP_DATA (frame, 1);
surface->Data.Pitch = GST_VIDEO_FRAME_COMP_STRIDE (frame, 0);
break;
case GST_VIDEO_FORMAT_YV12:
case GST_VIDEO_FORMAT_I420:
surface->Data.Y = GST_VIDEO_FRAME_COMP_DATA (frame, 0);
surface->Data.U = GST_VIDEO_FRAME_COMP_DATA (frame, 1);
surface->Data.V = GST_VIDEO_FRAME_COMP_DATA (frame, 2);
surface->Data.Pitch = GST_VIDEO_FRAME_COMP_STRIDE (frame, 0);
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;
default:
g_assert_not_reached ();
break;
}
return;
}
switch (frame->info.finfo->format) {
case GST_VIDEO_FORMAT_NV12:
width = GST_VIDEO_FRAME_COMP_WIDTH (frame, 0);
for (p = 0; p < 2; p++) {
height = GST_VIDEO_FRAME_COMP_HEIGHT (frame, p);
src = GST_VIDEO_FRAME_COMP_DATA (frame, p);
sstride = GST_VIDEO_FRAME_COMP_STRIDE (frame, p);
dst = p == 0 ? surface->Data.Y : surface->Data.UV;
dstride = surface->Data.Pitch;
for (i = 0; i < height; i++) {
memcpy (dst, src, width);
src += sstride;
dst += dstride;
}
}
break;
case GST_VIDEO_FORMAT_YV12:
case GST_VIDEO_FORMAT_I420:
for (p = 0; p < 3; p++) {
width = GST_VIDEO_FRAME_COMP_WIDTH (frame, p);
height = GST_VIDEO_FRAME_COMP_HEIGHT (frame, p);
src = GST_VIDEO_FRAME_COMP_DATA (frame, p);
sstride = GST_VIDEO_FRAME_COMP_STRIDE (frame, p);
switch (p) {
case 0:
dst = surface->Data.Y;
break;
case 1:
dst = surface->Data.U;
break;
case 2:
dst = surface->Data.V;
break;
default:
g_assert_not_reached ();
break;
}
dstride = surface->Data.Pitch;
if (p > 0)
dstride = dstride / 2;
for (i = 0; i < height; i++) {
memcpy (dst, src, width);
src += sstride;
dst += dstride;
}
}
break;
case GST_VIDEO_FORMAT_YUY2:
case GST_VIDEO_FORMAT_UYVY:
width = GST_VIDEO_FRAME_COMP_WIDTH (frame, 0);
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.Y;
dstride = surface->Data.Pitch;
width *= 2;
width = MIN (sstride, width);
for (i = 0; i < height; i++) {
memcpy (dst, src, width);
src += sstride;
dst += dstride;
}
break;
case GST_VIDEO_FORMAT_BGRA:
width = GST_VIDEO_FRAME_COMP_WIDTH (frame, 0);
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.B;
dstride = surface->Data.Pitch;
width *= 4;
for (i = 0; i < height; i++) {
memcpy (dst, src, width);
src += sstride;
dst += dstride;
}
break;
default:
g_assert_not_reached ();
break;
}
}
const gchar *
msdk_status_to_string (mfxStatus status)
{