From 531ccf05948541dd3519ed087e9119041e7325e4 Mon Sep 17 00:00:00 2001 From: Yinhang Liu Date: Mon, 29 Mar 2021 15:29:30 +0800 Subject: [PATCH] msdkh265enc: add support for RGB 10bit format The SDK can support A2RGB10 format [1], A2RGB10 format corresponds to BGR10A2_LE format in gstreamer. A2RGB10 format only supports low-power mode. Example: gst-launch-1.0 videotestsrc ! video/x-raw,format=BGR10A2_LE \ ! msdkh265enc low-power=1 ! fakesink [1] https://github.com/Intel-Media-SDK/MediaSDK/blob/master/doc/mediasdk-man.md#mfxframedata Part-of: --- sys/msdk/gstmsdkenc.c | 6 ++++++ sys/msdk/gstmsdkh265enc.c | 8 +++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/sys/msdk/gstmsdkenc.c b/sys/msdk/gstmsdkenc.c index 550bafe44b..238530163c 100644 --- a/sys/msdk/gstmsdkenc.c +++ b/sys/msdk/gstmsdkenc.c @@ -567,6 +567,12 @@ gst_msdkenc_init_encoder (GstMsdkEnc * thiz) thiz->param.mfx.FrameInfo.BitDepthLuma = 8; thiz->param.mfx.FrameInfo.BitDepthChroma = 8; break; + case GST_VIDEO_FORMAT_BGR10A2_LE: + thiz->param.mfx.FrameInfo.FourCC = MFX_FOURCC_A2RGB10; + thiz->param.mfx.FrameInfo.ChromaFormat = MFX_CHROMAFORMAT_YUV444; + thiz->param.mfx.FrameInfo.BitDepthLuma = 10; + thiz->param.mfx.FrameInfo.BitDepthChroma = 10; + break; case GST_VIDEO_FORMAT_YUY2: thiz->param.mfx.FrameInfo.FourCC = MFX_FOURCC_YUY2; thiz->param.mfx.FrameInfo.ChromaFormat = MFX_CHROMAFORMAT_YUV422; diff --git a/sys/msdk/gstmsdkh265enc.c b/sys/msdk/gstmsdkh265enc.c index 0bff6c306e..66e9807bd7 100644 --- a/sys/msdk/gstmsdkh265enc.c +++ b/sys/msdk/gstmsdkh265enc.c @@ -79,7 +79,7 @@ enum #define PROP_INTRA_REFRESH_TYPE_DEFAULT MFX_REFRESH_NO #define PROP_DBLK_IDC_DEFAULT 0 -#define RAW_FORMATS "NV12, I420, YV12, YUY2, UYVY, BGRA, P010_10LE, VUYA" +#define RAW_FORMATS "NV12, I420, YV12, YUY2, UYVY, BGRA, BGR10A2_LE, P010_10LE, VUYA" #define PROFILES "main, main-10, main-444" #define COMMON_FORMAT "{ " RAW_FORMATS " }" #define PRFOLIE_STR "{ " PROFILES " }" @@ -328,6 +328,7 @@ gst_msdkh265enc_configure (GstMsdkEnc * encoder) break; case MFX_FOURCC_AYUV: case MFX_FOURCC_YUY2: + case MFX_FOURCC_A2RGB10: #if (MFX_VERSION >= 1027) case MFX_FOURCC_Y410: case MFX_FOURCC_Y210: @@ -474,6 +475,10 @@ gst_msdkh265enc_set_src_caps (GstMsdkEnc * encoder) gst_structure_set (structure, "profile", G_TYPE_STRING, "main-422-10", NULL); break; + case MFX_FOURCC_A2RGB10: + gst_structure_set (structure, "profile", G_TYPE_STRING, "main-444-10", + NULL); + break; #if (MFX_VERSION >= 1027) case MFX_FOURCC_Y410: gst_structure_set (structure, "profile", G_TYPE_STRING, "main-444-10", @@ -689,6 +694,7 @@ gst_msdkh265enc_need_conversion (GstMsdkEnc * encoder, GstVideoInfo * info, switch (GST_VIDEO_INFO_FORMAT (info)) { case GST_VIDEO_FORMAT_NV12: + case GST_VIDEO_FORMAT_BGR10A2_LE: case GST_VIDEO_FORMAT_P010_10LE: case GST_VIDEO_FORMAT_VUYA: #if (MFX_VERSION >= 1027)