diff options
author | Haihao Xiang <haihao.xiang@intel.com> | 2020-04-08 14:40:56 +0800 |
---|---|---|
committer | Haihao Xiang <haihao.xiang@intel.com> | 2020-06-01 05:04:30 +0000 |
commit | f685893ed2181ea3b074950ca0ac9625cc3f7598 (patch) | |
tree | 2e31eaeddf222330a38e8e89e7a03348369c5126 /sys | |
parent | 52be289847f0ae744d70506c4883288b9a6a33c3 (diff) | |
download | gstreamer-plugins-bad-f685893ed2181ea3b074950ca0ac9625cc3f7598.tar.gz |
msdkh265enc: add support 12-bit 420 encoding
P016 is used for 12-bit encoding in MediaSDK, so the Shift flag is set
in the mfx parameters
Sample pipeline:
gst-launch-1.0 videotestsrc ! video/x-raw,format=P012_LE ! msdkh265enc ! \
fakesink
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1174>
Diffstat (limited to 'sys')
-rw-r--r-- | sys/msdk/gstmsdkenc.c | 9 | ||||
-rw-r--r-- | sys/msdk/gstmsdkh265enc.c | 21 |
2 files changed, 28 insertions, 2 deletions
diff --git a/sys/msdk/gstmsdkenc.c b/sys/msdk/gstmsdkenc.c index 0d76ebe4b..be19bda43 100644 --- a/sys/msdk/gstmsdkenc.c +++ b/sys/msdk/gstmsdkenc.c @@ -573,6 +573,15 @@ gst_msdkenc_init_encoder (GstMsdkEnc * thiz) thiz->param.mfx.FrameInfo.BitDepthLuma = 8; thiz->param.mfx.FrameInfo.BitDepthChroma = 8; break; +#if (MFX_VERSION >= 1031) + case GST_VIDEO_FORMAT_P012_LE: + thiz->param.mfx.FrameInfo.FourCC = MFX_FOURCC_P016; + thiz->param.mfx.FrameInfo.ChromaFormat = MFX_CHROMAFORMAT_YUV420; + thiz->param.mfx.FrameInfo.BitDepthLuma = 12; + thiz->param.mfx.FrameInfo.BitDepthChroma = 12; + thiz->param.mfx.FrameInfo.Shift = 1; + break; +#endif default: thiz->param.mfx.FrameInfo.FourCC = MFX_FOURCC_NV12; thiz->param.mfx.FrameInfo.BitDepthLuma = 8; diff --git a/sys/msdk/gstmsdkh265enc.c b/sys/msdk/gstmsdkh265enc.c index 0ddc0ef3a..46aa375da 100644 --- a/sys/msdk/gstmsdkh265enc.c +++ b/sys/msdk/gstmsdkh265enc.c @@ -54,11 +54,17 @@ enum #define PROP_MAX_SLICE_SIZE_DEFAULT 0 #define RAW_FORMATS "NV12, I420, YV12, YUY2, UYVY, BGRA, P010_10LE, VUYA" +#define PROFILES "main, main-10, main-444" -#if (MFX_VERSION >= 1027) +#if (MFX_VERSION >= 1031) +#define COMMON_FORMAT "{ " RAW_FORMATS ", Y410, Y210, P012_LE }" +#define PRFOLIE_STR "{ " PROFILES ", main-444-10, main-422-10, main-12 }" +#elif (MFX_VERSION >= 1027) #define COMMON_FORMAT "{ " RAW_FORMATS ", Y410, Y210 }" +#define PRFOLIE_STR "{ " PROFILES ", main-444-10, main-422-10 }" #else #define COMMON_FORMAT "{ " RAW_FORMATS " }" +#define PRFOLIE_STR "{ " PROFILES " }" #endif static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink", @@ -74,7 +80,7 @@ static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src", "framerate = (fraction) [0/1, MAX], " "width = (int) [ 1, MAX ], height = (int) [ 1, MAX ], " "stream-format = (string) byte-stream , alignment = (string) au , " - "profile = (string) { main, main-10, main-444, main-444-10, main-422-10 } ") + "profile = (string) " PRFOLIE_STR) ); #define gst_msdkh265enc_parent_class parent_class @@ -224,6 +230,9 @@ gst_msdkh265enc_configure (GstMsdkEnc * encoder) case MFX_FOURCC_Y410: case MFX_FOURCC_Y210: #endif +#if (MFX_VERSION >= 1031) + case MFX_FOURCC_P016: +#endif encoder->param.mfx.CodecProfile = MFX_PROFILE_HEVC_REXT; break; default: @@ -336,6 +345,11 @@ gst_msdkh265enc_set_src_caps (GstMsdkEnc * encoder) NULL); break; #endif +#if (MFX_VERSION >= 1031) + case MFX_FOURCC_P016: + gst_structure_set (structure, "profile", G_TYPE_STRING, "main-12", NULL); + break; +#endif default: gst_structure_set (structure, "profile", G_TYPE_STRING, "main", NULL); break; @@ -462,6 +476,9 @@ gst_msdkh265enc_need_conversion (GstMsdkEnc * encoder, GstVideoInfo * info, case GST_VIDEO_FORMAT_Y410: case GST_VIDEO_FORMAT_Y210: #endif +#if (MFX_VERSION >= 1031) + case GST_VIDEO_FORMAT_P012_LE: +#endif return FALSE; case GST_VIDEO_FORMAT_YUY2: |