From e769df9689f566907b7b8168bad0abc9724bf7d2 Mon Sep 17 00:00:00 2001 From: Haihao Xiang Date: Thu, 12 Mar 2020 12:58:40 +0800 Subject: [PATCH] msdk: map Y412_LE to MFX_FOURCC_Y416 MFX_FOURCC_Y416 is used for packed 12 bits 4:4:4:4 YUV format in MediaSDK --- sys/msdk/gstmsdksystemmemory.c | 12 ++++++++++++ sys/msdk/gstmsdkvideomemory.c | 8 +++++++- sys/msdk/msdk.c | 3 +++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/sys/msdk/gstmsdksystemmemory.c b/sys/msdk/gstmsdksystemmemory.c index 21e0f09064..4c3937b01c 100644 --- a/sys/msdk/gstmsdksystemmemory.c +++ b/sys/msdk/gstmsdksystemmemory.c @@ -152,6 +152,13 @@ ensure_data (GstMsdkSystemMemory * mem) mem->surface->Data.U = mem->cached_data[0]; /* Data.Y410 */ mem->surface->Data.Pitch = mem->destination_pitches[0]; break; + case GST_VIDEO_FORMAT_Y412_LE: + mem->surface->Data.U = mem->cached_data[0]; + mem->surface->Data.Y = mem->surface->Data.U + 2; + mem->surface->Data.V = mem->surface->Data.U + 4; + mem->surface->Data.A = mem->surface->Data.U + 6; + mem->surface->Data.Pitch = mem->destination_pitches[0]; + break; default: g_assert_not_reached (); @@ -253,6 +260,11 @@ gst_msdk_system_memory_map_full (GstMemory * base_mem, GstMapInfo * info, return mem->surface->Data.U; /* Data.Y410 */ #endif +#if (MFX_VERSION >= 1031) + case MFX_FOURCC_Y416: + return mem->surface->Data.U; /* The first channel is U */ +#endif + default: return mem->surface->Data.Y; } diff --git a/sys/msdk/gstmsdkvideomemory.c b/sys/msdk/gstmsdkvideomemory.c index 8db07652a6..642d6b9ed7 100644 --- a/sys/msdk/gstmsdkvideomemory.c +++ b/sys/msdk/gstmsdkvideomemory.c @@ -248,7 +248,8 @@ gst_video_meta_map_msdk_memory (GstVideoMeta * meta, guint plane, break; case GST_VIDEO_FORMAT_Y410: - *data = mem->surface->Data.U + offset; /* Data.Y410 */ + case GST_VIDEO_FORMAT_Y412_LE: + *data = mem->surface->Data.U + offset; break; default: @@ -325,6 +326,11 @@ gst_msdk_video_memory_map_full (GstMemory * base_mem, GstMapInfo * info, return mem->surface->Data.U; /* Data.Y410 */ #endif +#if (MFX_VERSION >= 1031) + case MFX_FOURCC_Y416: + return mem->surface->Data.U; +#endif + default: return mem->surface->Data.Y; } diff --git a/sys/msdk/msdk.c b/sys/msdk/msdk.c index 2e50db4a0c..6e610301b8 100644 --- a/sys/msdk/msdk.c +++ b/sys/msdk/msdk.c @@ -72,6 +72,8 @@ static const struct map gst_msdk_video_format_to_mfx_map[] = { GST_VIDEO_INFO_TO_MFX_MAP (P012_LE, YUV420, P016), /* Y216 is used for 12bit 4:2:2 format in MSDK */ GST_VIDEO_INFO_TO_MFX_MAP (Y212_LE, YUV422, Y216), + /* Y416 is used for 12bit 4:4:4:4 format in MSDK */ + GST_VIDEO_INFO_TO_MFX_MAP (Y412_LE, YUV444, Y416), #endif {0, 0, 0} }; @@ -365,6 +367,7 @@ gst_msdk_set_mfx_frame_info_from_video_info (mfxFrameInfo * mfx_info, #if (MFX_VERSION >= 1031) case MFX_FOURCC_P016: case MFX_FOURCC_Y216: + case MFX_FOURCC_Y416: mfx_info->BitDepthLuma = 12; mfx_info->BitDepthChroma = 12; mfx_info->Shift = 1;