From f45d5dc8bc08cfc0d0b53d85d2416636d2e2815e Mon Sep 17 00:00:00 2001 From: "Xiang, Haihao" Date: Tue, 27 Nov 2018 16:08:42 +0800 Subject: [PATCH] msdkenc: handle P010_10LE input format Note it is up to each codec to support P010_10LE format --- sys/msdk/gstmsdkenc.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/sys/msdk/gstmsdkenc.c b/sys/msdk/gstmsdkenc.c index a992305..3a32e65 100644 --- a/sys/msdk/gstmsdkenc.c +++ b/sys/msdk/gstmsdkenc.c @@ -255,7 +255,14 @@ gst_msdkenc_init_encoder (GstMsdkEnc * thiz) if (thiz->use_video_memory) gst_msdk_set_frame_allocator (thiz->context); - if (GST_VIDEO_INFO_FORMAT (info) != GST_VIDEO_FORMAT_NV12) { + /* Check 10bit input */ + if (GST_VIDEO_INFO_COMP_DEPTH (info, 0) == 10) { + if (GST_VIDEO_INFO_FORMAT (info) != GST_VIDEO_FORMAT_P010_10LE) { + GST_WARNING_OBJECT (thiz, + "P010_10LE is the only supported 10bit format\n"); + goto failed; + } + } else if (GST_VIDEO_INFO_FORMAT (info) != GST_VIDEO_FORMAT_NV12) { if (thiz->use_video_memory) thiz->vpp_param.IOPattern = MFX_IOPATTERN_IN_VIDEO_MEMORY | MFX_IOPATTERN_OUT_VIDEO_MEMORY; @@ -298,7 +305,6 @@ gst_msdkenc_init_encoder (GstMsdkEnc * thiz) g_assert_not_reached (); break; } - thiz->vpp_param.vpp.Out = thiz->vpp_param.vpp.In; thiz->vpp_param.vpp.Out.FourCC = MFX_FOURCC_NV12; thiz->vpp_param.vpp.Out.ChromaFormat = MFX_CHROMAFORMAT_YUV420; @@ -380,9 +386,19 @@ gst_msdkenc_init_encoder (GstMsdkEnc * thiz) thiz->param.mfx.FrameInfo.AspectRatioW = info->par_n; thiz->param.mfx.FrameInfo.AspectRatioH = info->par_d; thiz->param.mfx.FrameInfo.PicStruct = MFX_PICSTRUCT_PROGRESSIVE; - thiz->param.mfx.FrameInfo.FourCC = MFX_FOURCC_NV12; thiz->param.mfx.FrameInfo.ChromaFormat = MFX_CHROMAFORMAT_YUV420; + if (GST_VIDEO_INFO_FORMAT (info) == GST_VIDEO_FORMAT_P010_10LE) { + thiz->param.mfx.FrameInfo.FourCC = MFX_FOURCC_P010; + thiz->param.mfx.FrameInfo.BitDepthLuma = 10; + thiz->param.mfx.FrameInfo.BitDepthChroma = 10; + thiz->param.mfx.FrameInfo.Shift = 1; + } else { + thiz->param.mfx.FrameInfo.FourCC = MFX_FOURCC_NV12; + thiz->param.mfx.FrameInfo.BitDepthLuma = 8; + thiz->param.mfx.FrameInfo.BitDepthChroma = 8; + } + /* ensure bitrate control parameters */ ensure_bitrate_control (thiz); -- 2.7.4