msdk: fix qp range for vp9enc

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2349>
This commit is contained in:
Mengkejiergeli Ba 2021-06-22 16:12:57 +08:00
parent 1d4ecd0bde
commit 85c17f6c23
3 changed files with 15 additions and 3 deletions

View file

@ -2054,6 +2054,8 @@ gst_msdkenc_class_init (GstMsdkEncClass * klass)
klass->need_conversion = gst_msdkenc_need_conversion;
klass->need_reconfig = gst_msdkenc_need_reconfig;
klass->set_extra_params = gst_msdkenc_set_extra_params;
klass->qp_max = 51;
klass->qp_min = 0;
gobject_class->dispose = gst_msdkenc_dispose;
@ -2321,6 +2323,8 @@ gst_msdkenc_install_common_properties (GstMsdkEncClass * klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GParamSpec *obj_properties[GST_MSDKENC_PROP_MAX] = { NULL, };
guint qp_range_max = klass->qp_max;
guint qp_range_min = klass->qp_min;
obj_properties[GST_MSDKENC_PROP_HARDWARE] =
g_param_spec_boolean ("hardware", "Hardware", "Enable hardware encoders",
@ -2382,17 +2386,20 @@ gst_msdkenc_install_common_properties (GstMsdkEncClass * klass)
g_param_spec_uint ("qpi", "QPI",
"Constant quantizer for I frames (0 unlimited). Also used as "
"ICQQuality or QVBRQuality for different RateControl methods",
0, 51, PROP_QPI_DEFAULT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
qp_range_min, qp_range_max, PROP_QPI_DEFAULT,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
obj_properties[GST_MSDKENC_PROP_QPP] =
g_param_spec_uint ("qpp", "QPP",
"Constant quantizer for P frames (0 unlimited)",
0, 51, PROP_QPP_DEFAULT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
qp_range_min, qp_range_max, PROP_QPP_DEFAULT,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
obj_properties[GST_MSDKENC_PROP_QPB] =
g_param_spec_uint ("qpb", "QPB",
"Constant quantizer for B frames (0 unlimited)",
0, 51, PROP_QPB_DEFAULT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
qp_range_min, qp_range_max, PROP_QPB_DEFAULT,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
obj_properties[GST_MSDKENC_PROP_GOP_SIZE] =
g_param_spec_uint ("gop-size", "GOP Size", "GOP Size", 0,

View file

@ -186,6 +186,9 @@ struct _GstMsdkEncClass
/* Allow sub class set extra frame parameters */
void (*set_extra_params) (GstMsdkEnc * encoder, GstVideoCodecFrame * frame);
guint qp_max;
guint qp_min;
};
struct _MsdkEncTask

View file

@ -272,6 +272,8 @@ gst_msdkvp9enc_class_init (GstMsdkVP9EncClass * klass)
encoder_class->set_format = gst_msdkvp9enc_set_format;
encoder_class->configure = gst_msdkvp9enc_configure;
encoder_class->set_src_caps = gst_msdkvp9enc_set_src_caps;
encoder_class->qp_max = 255;
encoder_class->qp_min = 0;
gst_msdkenc_install_common_properties (encoder_class);