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: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2126>
This commit is contained in:
Yinhang Liu 2021-03-29 15:29:30 +08:00 committed by Haihao Xiang
parent cefdd0d0f1
commit 531ccf0594
2 changed files with 13 additions and 1 deletions

View file

@ -567,6 +567,12 @@ gst_msdkenc_init_encoder (GstMsdkEnc * thiz)
thiz->param.mfx.FrameInfo.BitDepthLuma = 8; thiz->param.mfx.FrameInfo.BitDepthLuma = 8;
thiz->param.mfx.FrameInfo.BitDepthChroma = 8; thiz->param.mfx.FrameInfo.BitDepthChroma = 8;
break; 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: case GST_VIDEO_FORMAT_YUY2:
thiz->param.mfx.FrameInfo.FourCC = MFX_FOURCC_YUY2; thiz->param.mfx.FrameInfo.FourCC = MFX_FOURCC_YUY2;
thiz->param.mfx.FrameInfo.ChromaFormat = MFX_CHROMAFORMAT_YUV422; thiz->param.mfx.FrameInfo.ChromaFormat = MFX_CHROMAFORMAT_YUV422;

View file

@ -79,7 +79,7 @@ enum
#define PROP_INTRA_REFRESH_TYPE_DEFAULT MFX_REFRESH_NO #define PROP_INTRA_REFRESH_TYPE_DEFAULT MFX_REFRESH_NO
#define PROP_DBLK_IDC_DEFAULT 0 #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 PROFILES "main, main-10, main-444"
#define COMMON_FORMAT "{ " RAW_FORMATS " }" #define COMMON_FORMAT "{ " RAW_FORMATS " }"
#define PRFOLIE_STR "{ " PROFILES " }" #define PRFOLIE_STR "{ " PROFILES " }"
@ -328,6 +328,7 @@ gst_msdkh265enc_configure (GstMsdkEnc * encoder)
break; break;
case MFX_FOURCC_AYUV: case MFX_FOURCC_AYUV:
case MFX_FOURCC_YUY2: case MFX_FOURCC_YUY2:
case MFX_FOURCC_A2RGB10:
#if (MFX_VERSION >= 1027) #if (MFX_VERSION >= 1027)
case MFX_FOURCC_Y410: case MFX_FOURCC_Y410:
case MFX_FOURCC_Y210: 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", gst_structure_set (structure, "profile", G_TYPE_STRING, "main-422-10",
NULL); NULL);
break; break;
case MFX_FOURCC_A2RGB10:
gst_structure_set (structure, "profile", G_TYPE_STRING, "main-444-10",
NULL);
break;
#if (MFX_VERSION >= 1027) #if (MFX_VERSION >= 1027)
case MFX_FOURCC_Y410: case MFX_FOURCC_Y410:
gst_structure_set (structure, "profile", G_TYPE_STRING, "main-444-10", 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)) { switch (GST_VIDEO_INFO_FORMAT (info)) {
case GST_VIDEO_FORMAT_NV12: case GST_VIDEO_FORMAT_NV12:
case GST_VIDEO_FORMAT_BGR10A2_LE:
case GST_VIDEO_FORMAT_P010_10LE: case GST_VIDEO_FORMAT_P010_10LE:
case GST_VIDEO_FORMAT_VUYA: case GST_VIDEO_FORMAT_VUYA:
#if (MFX_VERSION >= 1027) #if (MFX_VERSION >= 1027)