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
This commit is contained in:
Haihao Xiang 2020-03-12 12:58:40 +08:00
parent 3de690ceda
commit e769df9689
3 changed files with 22 additions and 1 deletions

View file

@ -152,6 +152,13 @@ ensure_data (GstMsdkSystemMemory * mem)
mem->surface->Data.U = mem->cached_data[0]; /* Data.Y410 */ mem->surface->Data.U = mem->cached_data[0]; /* Data.Y410 */
mem->surface->Data.Pitch = mem->destination_pitches[0]; mem->surface->Data.Pitch = mem->destination_pitches[0];
break; 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: default:
g_assert_not_reached (); 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 */ return mem->surface->Data.U; /* Data.Y410 */
#endif #endif
#if (MFX_VERSION >= 1031)
case MFX_FOURCC_Y416:
return mem->surface->Data.U; /* The first channel is U */
#endif
default: default:
return mem->surface->Data.Y; return mem->surface->Data.Y;
} }

View file

@ -248,7 +248,8 @@ gst_video_meta_map_msdk_memory (GstVideoMeta * meta, guint plane,
break; break;
case GST_VIDEO_FORMAT_Y410: 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; break;
default: default:
@ -325,6 +326,11 @@ gst_msdk_video_memory_map_full (GstMemory * base_mem, GstMapInfo * info,
return mem->surface->Data.U; /* Data.Y410 */ return mem->surface->Data.U; /* Data.Y410 */
#endif #endif
#if (MFX_VERSION >= 1031)
case MFX_FOURCC_Y416:
return mem->surface->Data.U;
#endif
default: default:
return mem->surface->Data.Y; return mem->surface->Data.Y;
} }

View file

@ -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), GST_VIDEO_INFO_TO_MFX_MAP (P012_LE, YUV420, P016),
/* Y216 is used for 12bit 4:2:2 format in MSDK */ /* Y216 is used for 12bit 4:2:2 format in MSDK */
GST_VIDEO_INFO_TO_MFX_MAP (Y212_LE, YUV422, Y216), 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 #endif
{0, 0, 0} {0, 0, 0}
}; };
@ -365,6 +367,7 @@ gst_msdk_set_mfx_frame_info_from_video_info (mfxFrameInfo * mfx_info,
#if (MFX_VERSION >= 1031) #if (MFX_VERSION >= 1031)
case MFX_FOURCC_P016: case MFX_FOURCC_P016:
case MFX_FOURCC_Y216: case MFX_FOURCC_Y216:
case MFX_FOURCC_Y416:
mfx_info->BitDepthLuma = 12; mfx_info->BitDepthLuma = 12;
mfx_info->BitDepthChroma = 12; mfx_info->BitDepthChroma = 12;
mfx_info->Shift = 1; mfx_info->Shift = 1;