diff options
author | Mengkejiergeli Ba <mengkejiergeli.ba@intel.com> | 2021-09-15 13:59:17 +0800 |
---|---|---|
committer | Haihao Xiang <haihao.xiang@intel.com> | 2021-09-18 14:40:24 +0000 |
commit | 5628955624ad682b7eace79729c5bb80b2ae6e77 (patch) | |
tree | 8caa4548e4557dd1923526492be7f0c6d720fc92 /sys | |
parent | 788826b2056c92180da1f93565d67498227ca9a0 (diff) |
msdkenc: Pass color properties to MediaSDK for encoding
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2523>
Diffstat (limited to 'sys')
-rw-r--r-- | sys/msdk/gstmsdkenc.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/sys/msdk/gstmsdkenc.c b/sys/msdk/gstmsdkenc.c index db48f49ea..dd1ea3b4e 100644 --- a/sys/msdk/gstmsdkenc.c +++ b/sys/msdk/gstmsdkenc.c @@ -49,6 +49,7 @@ #include "gstmsdkvideomemory.h" #include "gstmsdksystemmemory.h" #include "gstmsdkcontextutil.h" +#include "mfxjpeg.h" #ifndef _WIN32 #include "gstmsdkallocator_libva.h" @@ -483,6 +484,7 @@ gst_msdkenc_init_encoder (GstMsdkEnc * thiz) guint i; gboolean need_vpp = TRUE; GstVideoFormat encoder_input_fmt; + mfxExtVideoSignalInfo ext_vsi; if (thiz->initialized) { GST_DEBUG_OBJECT (thiz, "Already initialized"); @@ -733,6 +735,25 @@ gst_msdkenc_init_encoder (GstMsdkEnc * thiz) goto failed; } + /* If color properties are available from upstream, set it and pass to MediaSDK here. + * MJPEG is excluded from color config below as it is different from other codecs in + * mfxInfoMFX struct. + */ + if (thiz->param.mfx.CodecId != MFX_CODEC_JPEG && (info->colorimetry.primaries + || info->colorimetry.transfer || info->colorimetry.matrix)) { + memset (&ext_vsi, 0, sizeof (ext_vsi)); + ext_vsi.Header.BufferId = MFX_EXTBUFF_VIDEO_SIGNAL_INFO; + ext_vsi.Header.BufferSz = sizeof (ext_vsi); + ext_vsi.ColourDescriptionPresent = 1; + ext_vsi.ColourPrimaries = + gst_video_color_primaries_to_iso (info->colorimetry.primaries); + ext_vsi.TransferCharacteristics = + gst_video_transfer_function_to_iso (info->colorimetry.transfer); + ext_vsi.MatrixCoefficients = + gst_video_color_matrix_to_iso (info->colorimetry.matrix); + gst_msdkenc_add_extra_param (thiz, (mfxExtBuffer *) & ext_vsi); + } + if (thiz->num_extra_params) { thiz->param.NumExtParam = thiz->num_extra_params; thiz->param.ExtParam = thiz->extra_params; |