msdkh264enc: add dblk-idc property

The SDK can support deblocking reference structure [1], so add a new
property to enable this feature.

[1] https://github.com/Intel-Media-SDK/MediaSDK/blob/master/doc/mediasdk-man.md#mfxextcodingoption2

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2122>
This commit is contained in:
Yinhang Liu 2021-03-29 15:18:13 +08:00 committed by Haihao Xiang
parent 1fc9cc06db
commit d99e97af80
2 changed files with 17 additions and 0 deletions

View file

@ -58,6 +58,7 @@ enum
PROP_MIN_QP,
PROP_MAX_QP,
PROP_INTRA_REFRESH_TYPE,
PROP_DBLK_IDC,
};
enum
@ -78,6 +79,7 @@ enum
#define PROP_MIN_QP_DEFAULT 0
#define PROP_MAX_QP_DEFAULT 0
#define PROP_INTRA_REFRESH_TYPE_DEFAULT MFX_REFRESH_NO
#define PROP_DBLK_IDC_DEFAULT 0
static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
@ -389,6 +391,7 @@ gst_msdkh264enc_configure (GstMsdkEnc * encoder)
encoder->option2.MaxQPI = encoder->option2.MaxQPP = encoder->option2.MaxQPB =
thiz->max_qp;
encoder->option2.IntRefType = thiz->intra_refresh_type;
encoder->option2.DisableDeblockingIdc = thiz->dblk_idc;
if (encoder->rate_control == MFX_RATECONTROL_LA ||
encoder->rate_control == MFX_RATECONTROL_LA_HRD ||
@ -592,6 +595,9 @@ gst_msdkh264enc_set_property (GObject * object, guint prop_id,
case PROP_INTRA_REFRESH_TYPE:
thiz->intra_refresh_type = g_value_get_enum (value);
break;
case PROP_DBLK_IDC:
thiz->dblk_idc = g_value_get_uint (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@ -649,6 +655,9 @@ gst_msdkh264enc_get_property (GObject * object, guint prop_id, GValue * value,
case PROP_INTRA_REFRESH_TYPE:
g_value_set_enum (value, thiz->intra_refresh_type);
break;
case PROP_DBLK_IDC:
g_value_set_uint (value, thiz->dblk_idc);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@ -774,6 +783,12 @@ gst_msdkh264enc_class_init (GstMsdkH264EncClass * klass)
PROP_INTRA_REFRESH_TYPE_DEFAULT,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_DBLK_IDC,
g_param_spec_uint ("dblk-idc", "Disable Deblocking Idc",
"Option of disable deblocking idc",
0, 2, PROP_DBLK_IDC_DEFAULT,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
gst_element_class_set_static_metadata (element_class,
"Intel MSDK H264 encoder", "Codec/Encoder/Video/Hardware",
"H264 video encoder based on Intel Media SDK",
@ -796,4 +811,5 @@ gst_msdkh264enc_init (GstMsdkH264Enc * thiz)
thiz->min_qp = PROP_MIN_QP_DEFAULT;
thiz->max_qp = PROP_MAX_QP_DEFAULT;
thiz->intra_refresh_type = PROP_INTRA_REFRESH_TYPE_DEFAULT;
thiz->dblk_idc = PROP_DBLK_IDC_DEFAULT;
}

View file

@ -75,6 +75,7 @@ struct _GstMsdkH264Enc
guint min_qp;
guint max_qp;
guint intra_refresh_type;
guint dblk_idc;
GstH264NalParser *parser;
GArray *cc_sei_array;