diff --git a/sys/msdk/gstmsdkh265enc.c b/sys/msdk/gstmsdkh265enc.c index 0528157dbc..f164137798 100644 --- a/sys/msdk/gstmsdkh265enc.c +++ b/sys/msdk/gstmsdkh265enc.c @@ -51,6 +51,7 @@ enum PROP_TILE_COL, PROP_MAX_SLICE_SIZE, PROP_TUNE_MODE, + PROP_TRANSFORM_SKIP, }; enum @@ -64,6 +65,7 @@ enum #define PROP_TILE_COL_DEFAULT 1 #define PROP_MAX_SLICE_SIZE_DEFAULT 0 #define PROP_TUNE_MODE_DEFAULT MFX_CODINGOPTION_UNKNOWN +#define PROP_TRANSFORM_SKIP_DEFAULT MFX_CODINGOPTION_UNKNOWN #define RAW_FORMATS "NV12, I420, YV12, YUY2, UYVY, BGRA, P010_10LE, VUYA" #define PROFILES "main, main-10, main-444" @@ -337,6 +339,14 @@ gst_msdkh265enc_configure (GstMsdkEnc * encoder) /* Enable Extended coding options */ encoder->option2.MaxSliceSize = h265enc->max_slice_size; + +#if (MFX_VERSION >= 1026) + if (h265enc->transform_skip != MFX_CODINGOPTION_UNKNOWN) { + encoder->option3.TransformSkip = h265enc->transform_skip; + encoder->enable_extopt3 = TRUE; + } +#endif + gst_msdkenc_ensure_extended_coding_options (encoder); if (h265enc->num_tile_rows > 1 || h265enc->num_tile_cols > 1) { @@ -516,6 +526,10 @@ gst_msdkh265enc_set_property (GObject * object, guint prop_id, thiz->prop_flag |= GST_MSDK_FLAG_TUNE_MODE; break; + case PROP_TRANSFORM_SKIP: + thiz->transform_skip = g_value_get_enum (value); + break; + default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -556,6 +570,10 @@ gst_msdkh265enc_get_property (GObject * object, guint prop_id, GValue * value, g_value_set_enum (value, thiz->tune_mode); break; + case PROP_TRANSFORM_SKIP: + g_value_set_enum (value, thiz->transform_skip); + break; + default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -675,6 +693,12 @@ gst_msdkh265enc_class_init (GstMsdkH265EncClass * klass) gst_msdkenc_tune_mode_get_type (), PROP_TUNE_MODE_DEFAULT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + g_object_class_install_property (gobject_class, PROP_TRANSFORM_SKIP, + g_param_spec_enum ("transform-skip", "Transform Skip", + "Transform Skip option", + gst_msdkenc_transform_skip_get_type (), PROP_TRANSFORM_SKIP_DEFAULT, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + gst_element_class_set_static_metadata (element_class, "Intel MSDK H265 encoder", "Codec/Encoder/Video/Hardware", @@ -694,5 +718,6 @@ gst_msdkh265enc_init (GstMsdkH265Enc * thiz) thiz->num_tile_cols = PROP_TILE_COL_DEFAULT; thiz->max_slice_size = PROP_MAX_SLICE_SIZE_DEFAULT; thiz->tune_mode = PROP_TUNE_MODE_DEFAULT; + thiz->transform_skip = PROP_TRANSFORM_SKIP_DEFAULT; msdk_enc->num_extra_frames = 1; } diff --git a/sys/msdk/gstmsdkh265enc.h b/sys/msdk/gstmsdkh265enc.h index b1ce7b6620..d3730980fa 100644 --- a/sys/msdk/gstmsdkh265enc.h +++ b/sys/msdk/gstmsdkh265enc.h @@ -62,6 +62,7 @@ struct _GstMsdkH265Enc guint max_slice_size; gint tune_mode; guint prop_flag; + gushort transform_skip; mfxExtHEVCTiles ext_tiles; /* roi[0] for current ROI and roi[1] for previous ROI */ diff --git a/sys/msdk/msdk-enums.c b/sys/msdk/msdk-enums.c index 9a2ac2c684..73064228da 100644 --- a/sys/msdk/msdk-enums.c +++ b/sys/msdk/msdk-enums.c @@ -195,6 +195,26 @@ gst_msdkenc_tune_mode_get_type (void) return type; } +GType +gst_msdkenc_transform_skip_get_type (void) +{ + static GType type = 0; + + static const GEnumValue values[] = { + {MFX_CODINGOPTION_UNKNOWN, "SDK desides what to do", "auto"}, + {MFX_CODINGOPTION_OFF, + "transform_skip_enabled_flag will be set to 0 in PPS ", "off"}, + {MFX_CODINGOPTION_ON, + "transform_skip_enabled_flag will be set to 1 in PPS ", "on"}, + {0, NULL, NULL} + }; + + if (!type) { + type = g_enum_register_static ("GstMsdkEncTransformSkip", values); + } + return type; +} + /*========= MSDK VPP Enums =========================*/ #ifndef GST_REMOVE_DEPRECATED diff --git a/sys/msdk/msdk-enums.h b/sys/msdk/msdk-enums.h index 3c0028a412..26c990315c 100644 --- a/sys/msdk/msdk-enums.h +++ b/sys/msdk/msdk-enums.h @@ -101,5 +101,8 @@ gst_msdkvpp_scaling_mode_get_type (void); GType gst_msdkvpp_frc_algorithm_get_type (void); +GType +gst_msdkenc_transform_skip_get_type (void); + G_END_DECLS #endif