From 7b89cdbefe8cde71244af736145beb8c62964610 Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Sat, 9 Apr 2022 00:00:59 +0900 Subject: [PATCH] qsvencoder: Update property names and default values Stop using MSDK plugins property naming, instead use unified names and default values to be consistent with newly written NVIDIA encoders. Part-of: --- .../gst-plugins-bad/sys/qsv/gstqsvh264enc.cpp | 46 +++++++++++----------- .../gst-plugins-bad/sys/qsv/gstqsvh265enc.cpp | 46 +++++++++++----------- .../gst-plugins-bad/sys/qsv/gstqsvvp9enc.cpp | 10 ++--- .../examples/qsv/qsvenc-dynamic-reconfigure.c | 16 ++++---- 4 files changed, 59 insertions(+), 59 deletions(-) diff --git a/subprojects/gst-plugins-bad/sys/qsv/gstqsvh264enc.cpp b/subprojects/gst-plugins-bad/sys/qsv/gstqsvh264enc.cpp index be948c9..ab7da4e 100644 --- a/subprojects/gst-plugins-bad/sys/qsv/gstqsvh264enc.cpp +++ b/subprojects/gst-plugins-bad/sys/qsv/gstqsvh264enc.cpp @@ -155,13 +155,13 @@ enum #define DEFAULT_CABAC MFX_CODINGOPTION_UNKNOWN #define DEFAULT_QP 0 -#define DEFAULT_GOP_SIZE 0 +#define DEFAULT_GOP_SIZE 30 #define DEFAULT_I_FRAMES 0 #define DEFAULT_B_FRAMES 0 #define DEFAULT_REF_FRAMES 2 #define DEFAULT_BITRATE 2000 #define DEFAULT_MAX_BITRATE 0 -#define DEFAULT_RATE_CONTROL MFX_RATECONTROL_CBR +#define DEFAULT_RATE_CONTROL MFX_RATECONTROL_VBR #define DEFAULT_RC_LOOKAHEAD 10 #define DEFAULT_RC_LOOKAHEAD_DS MFX_LOOKAHEAD_DS_UNKNOWN #define DEFAULT_AVBR_ACCURACY 0 @@ -301,65 +301,65 @@ gst_qsv_h264_enc_class_init (GstQsvH264EncClass * klass, gpointer data) GST_TYPE_QSV_CODING_OPTION, DEFAULT_CABAC, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS))); g_object_class_install_property (object_class, PROP_MIN_QP_I, - g_param_spec_uint ("min-qpi", "Min QP I", - "Minimum allowed QP value for I-frame types (0: no limitations)", + g_param_spec_uint ("min-qp-i", "Min QP I", + "Minimum allowed QP value for I-frame types (0: default)", 0, 51, DEFAULT_QP, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS))); g_object_class_install_property (object_class, PROP_MIN_QP_P, - g_param_spec_uint ("min-qpp", "Min QP P", - "Minimum allowed QP value for P-frame types (0: no limitations)", + g_param_spec_uint ("min-qp-p", "Min QP P", + "Minimum allowed QP value for P-frame types (0: default)", 0, 51, DEFAULT_QP, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS))); g_object_class_install_property (object_class, PROP_MIN_QP_B, - g_param_spec_uint ("min-qpb", "Min QP B", - "Minimum allowed QP value for B-frame types (0: no limitations)", + g_param_spec_uint ("min-qp-b", "Min QP B", + "Minimum allowed QP value for B-frame types (0: default)", 0, 51, DEFAULT_QP, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS))); g_object_class_install_property (object_class, PROP_MAX_QP_I, - g_param_spec_uint ("max-qpi", "Max QP I", - "Maximum allowed QP value for I-frame types (0: no limitations)", + g_param_spec_uint ("max-qp-i", "Max QP I", + "Maximum allowed QP value for I-frame types (0: default)", 0, 51, DEFAULT_QP, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS))); g_object_class_install_property (object_class, PROP_MAX_QP_P, - g_param_spec_uint ("max-qpp", "Max QP P", - "Maximum allowed QP value for P-frame types (0: no limitations)", + g_param_spec_uint ("max-qp-p", "Max QP P", + "Maximum allowed QP value for P-frame types (0: default)", 0, 51, DEFAULT_QP, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS))); g_object_class_install_property (object_class, PROP_MAX_QP_B, - g_param_spec_uint ("max-qpb", "Max QP B", - "Maximum allowed QP value for B-frame types (0: no limitations)", + g_param_spec_uint ("max-qp-b", "Max QP B", + "Maximum allowed QP value for B-frame types (0: default)", 0, 51, DEFAULT_QP, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS))); g_object_class_install_property (object_class, PROP_QP_I, - g_param_spec_uint ("qpi", "QP I", - "Constant quantizer for I frames (0: no limitations)", + g_param_spec_uint ("qp-i", "QP I", + "Constant quantizer for I frames (0: default)", 0, 51, DEFAULT_QP, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS))); g_object_class_install_property (object_class, PROP_QP_P, - g_param_spec_uint ("qpp", "QP P", - "Constant quantizer for P frames (0: no limitations)", + g_param_spec_uint ("qp-p", "QP P", + "Constant quantizer for P frames (0: default)", 0, 51, DEFAULT_QP, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS))); g_object_class_install_property (object_class, PROP_QP_B, - g_param_spec_uint ("qpb", "QP B", - "Constant quantizer for B frames (0: no limitations)", + g_param_spec_uint ("qp-b", "QP B", + "Constant quantizer for B frames (0: default)", 0, 51, DEFAULT_QP, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS))); g_object_class_install_property (object_class, PROP_GOP_SIZE, g_param_spec_uint ("gop-size", "GOP Size", "Number of pictures within a GOP (0: unspecified)", - 0, G_MAXINT, DEFAULT_GOP_SIZE, (GParamFlags) + 0, G_MAXUSHORT, DEFAULT_GOP_SIZE, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS))); g_object_class_install_property (object_class, PROP_I_FRAMES, g_param_spec_uint ("i-frames", "I Frames", "Number of I frames between IDR frames" "(0: every I frame is an IDR frame)", - 0, G_MAXINT, DEFAULT_I_FRAMES, (GParamFlags) + 0, G_MAXUSHORT, DEFAULT_I_FRAMES, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS))); g_object_class_install_property (object_class, PROP_B_FRAMES, g_param_spec_uint ("b-frames", "B Frames", "Number of B frames between I and P frames", - 0, G_MAXINT, DEFAULT_B_FRAMES, (GParamFlags) + 0, G_MAXUSHORT, DEFAULT_B_FRAMES, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS))); g_object_class_install_property (object_class, PROP_REF_FRAMES, g_param_spec_uint ("ref-frames", "Reference Frames", diff --git a/subprojects/gst-plugins-bad/sys/qsv/gstqsvh265enc.cpp b/subprojects/gst-plugins-bad/sys/qsv/gstqsvh265enc.cpp index d90c1e5..6bcf657 100644 --- a/subprojects/gst-plugins-bad/sys/qsv/gstqsvh265enc.cpp +++ b/subprojects/gst-plugins-bad/sys/qsv/gstqsvh265enc.cpp @@ -119,13 +119,13 @@ enum }; #define DEFAULT_QP 0 -#define DEFAULT_GOP_SIZE 0 +#define DEFAULT_GOP_SIZE 30 #define DEFAULT_I_FRAMES 0 #define DEFAULT_B_FRAMES 0 #define DEFAULT_REF_FRAMES 2 #define DEFAULT_BITRATE 2000 #define DEFAULT_MAX_BITRATE 0 -#define DEFAULT_RATE_CONTROL MFX_RATECONTROL_CBR +#define DEFAULT_RATE_CONTROL MFX_RATECONTROL_VBR #define DEFAULT_IQC_QUALITY 0 #define DEFAULT_QVBR_QUALITY 0 #define DEFAULT_DISABLE_HRD_CONFORMANCE FALSE @@ -249,65 +249,65 @@ gst_qsv_h265_enc_class_init (GstQsvH265EncClass * klass, gpointer data) #endif g_object_class_install_property (object_class, PROP_MIN_QP_I, - g_param_spec_uint ("min-qpi", "Min QP I", - "Minimum allowed QP value for I-frame types (0: no limitations)", + g_param_spec_uint ("min-qp-i", "Min QP I", + "Minimum allowed QP value for I-frame types (0: default)", 0, 51, DEFAULT_QP, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS))); g_object_class_install_property (object_class, PROP_MIN_QP_P, - g_param_spec_uint ("min-qpp", "Min QP P", - "Minimum allowed QP value for P-frame types (0: no limitations)", + g_param_spec_uint ("min-qp-p", "Min QP P", + "Minimum allowed QP value for P-frame types (0: default)", 0, 51, DEFAULT_QP, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS))); g_object_class_install_property (object_class, PROP_MIN_QP_B, - g_param_spec_uint ("min-qpb", "Min QP B", - "Minimum allowed QP value for B-frame types (0: no limitations)", + g_param_spec_uint ("min-qp-b", "Min QP B", + "Minimum allowed QP value for B-frame types (0: default)", 0, 51, DEFAULT_QP, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS))); g_object_class_install_property (object_class, PROP_MAX_QP_I, - g_param_spec_uint ("max-qpi", "Max QP I", - "Maximum allowed QP value for I-frame types (0: no limitations)", + g_param_spec_uint ("max-qp-i", "Max QP I", + "Maximum allowed QP value for I-frame types (0: default)", 0, 51, DEFAULT_QP, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS))); g_object_class_install_property (object_class, PROP_MAX_QP_P, - g_param_spec_uint ("max-qpp", "Max QP P", - "Maximum allowed QP value for P-frame types (0: no limitations)", + g_param_spec_uint ("max-qp-p", "Max QP P", + "Maximum allowed QP value for P-frame types (0: default)", 0, 51, DEFAULT_QP, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS))); g_object_class_install_property (object_class, PROP_MAX_QP_B, - g_param_spec_uint ("max-qpb", "Max QP B", - "Maximum allowed QP value for B-frame types (0: no limitations)", + g_param_spec_uint ("max-qp-b", "Max QP B", + "Maximum allowed QP value for B-frame types (0: default)", 0, 51, DEFAULT_QP, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS))); g_object_class_install_property (object_class, PROP_QP_I, - g_param_spec_uint ("qpi", "QP I", - "Constant quantizer for I frames (0: no limitations)", + g_param_spec_uint ("qp-i", "QP I", + "Constant quantizer for I frames (0: default)", 0, 51, DEFAULT_QP, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS))); g_object_class_install_property (object_class, PROP_QP_P, - g_param_spec_uint ("qpp", "QP P", - "Constant quantizer for P frames (0: no limitations)", + g_param_spec_uint ("qp-p", "QP P", + "Constant quantizer for P frames (0: default)", 0, 51, DEFAULT_QP, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS))); g_object_class_install_property (object_class, PROP_QP_B, - g_param_spec_uint ("qpb", "QP B", - "Constant quantizer for B frames (0: no limitations)", + g_param_spec_uint ("qp-b", "QP B", + "Constant quantizer for B frames (0: default)", 0, 51, DEFAULT_QP, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS))); g_object_class_install_property (object_class, PROP_GOP_SIZE, g_param_spec_uint ("gop-size", "GOP Size", "Number of pictures within a GOP (0: unspecified)", - 0, G_MAXINT, DEFAULT_GOP_SIZE, (GParamFlags) + 0, G_MAXUSHORT, DEFAULT_GOP_SIZE, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS))); g_object_class_install_property (object_class, PROP_I_FRAMES, g_param_spec_uint ("i-frames", "I Frames", "Number of I frames between IDR frames" "(0: every I frame is an IDR frame)", - 0, G_MAXINT, DEFAULT_I_FRAMES, (GParamFlags) + 0, G_MAXUSHORT, DEFAULT_I_FRAMES, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS))); g_object_class_install_property (object_class, PROP_B_FRAMES, g_param_spec_uint ("b-frames", "B Frames", "Number of B frames between I and P frames", - 0, G_MAXINT, DEFAULT_B_FRAMES, (GParamFlags) + 0, G_MAXUSHORT, DEFAULT_B_FRAMES, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS))); g_object_class_install_property (object_class, PROP_REF_FRAMES, g_param_spec_uint ("ref-frames", "Reference Frames", diff --git a/subprojects/gst-plugins-bad/sys/qsv/gstqsvvp9enc.cpp b/subprojects/gst-plugins-bad/sys/qsv/gstqsvvp9enc.cpp index a992450..a8a96cc 100644 --- a/subprojects/gst-plugins-bad/sys/qsv/gstqsvvp9enc.cpp +++ b/subprojects/gst-plugins-bad/sys/qsv/gstqsvvp9enc.cpp @@ -78,7 +78,7 @@ enum #define DEFAULT_REF_FRAMES 1 #define DEFAULT_BITRATE 2000 #define DEFAULT_MAX_BITRATE 0 -#define DEFAULT_RATE_CONTROL MFX_RATECONTROL_CBR +#define DEFAULT_RATE_CONTROL MFX_RATECONTROL_VBR #define DEFAULT_IQC_QUALITY 0 typedef struct _GstQsvVP9EncClassData @@ -177,13 +177,13 @@ gst_qsv_vp9_enc_class_init (GstQsvVP9EncClass * klass, gpointer data) #endif g_object_class_install_property (object_class, PROP_QP_I, - g_param_spec_uint ("qpi", "QP I", - "Constant quantizer for I frames (0: no limitations)", + g_param_spec_uint ("qp-i", "QP I", + "Constant quantizer for I frames (0: default)", 0, 255, DEFAULT_QP, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS))); g_object_class_install_property (object_class, PROP_QP_P, - g_param_spec_uint ("qpp", "QP P", - "Constant quantizer for P frames (0: no limitations)", + g_param_spec_uint ("qp-p", "QP P", + "Constant quantizer for P frames (0: default)", 0, 255, DEFAULT_QP, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS))); g_object_class_install_property (object_class, PROP_GOP_SIZE, diff --git a/subprojects/gst-plugins-bad/tests/examples/qsv/qsvenc-dynamic-reconfigure.c b/subprojects/gst-plugins-bad/tests/examples/qsv/qsvenc-dynamic-reconfigure.c index ecb1ee1..d9c6e6b 100644 --- a/subprojects/gst-plugins-bad/tests/examples/qsv/qsvenc-dynamic-reconfigure.c +++ b/subprojects/gst-plugins-bad/tests/examples/qsv/qsvenc-dynamic-reconfigure.c @@ -231,37 +231,37 @@ keyboard_cb (gchar input, gboolean is_ascii, gpointer user_data) case 'I': if (rc_mode == RC_MODE_CQP && qp_i < max_qp) { gst_println ("Increase QP-I to %d", ++qp_i); - g_object_set (data->encoder, "qpi", qp_i, NULL); + g_object_set (data->encoder, "qp-i", qp_i, NULL); } break; case 'i': if (rc_mode == RC_MODE_CQP && qp_i > 0) { gst_println ("Decrease QP-I to %d", --qp_i); - g_object_set (data->encoder, "qpi", qp_i, NULL); + g_object_set (data->encoder, "qp-i", qp_i, NULL); } break; case 'P': if (rc_mode == RC_MODE_CQP && qp_p < max_qp) { gst_println ("Increase QP-P to %d", ++qp_p); - g_object_set (data->encoder, "qpp", qp_p, NULL); + g_object_set (data->encoder, "qp-p", qp_p, NULL); } break; case 'p': if (rc_mode == RC_MODE_CQP && qp_p > 0) { gst_println ("Decrease QP-P to %d", --qp_p); - g_object_set (data->encoder, "qpp", qp_p, NULL); + g_object_set (data->encoder, "qp-p", qp_p, NULL); } break; case 'B': if (rc_mode == RC_MODE_CQP && qp_b < max_qp && codec != CODEC_VP9) { gst_println ("Increase QP-B to %d", ++qp_b); - g_object_set (data->encoder, "qpb", qp_b, NULL); + g_object_set (data->encoder, "qp-b", qp_b, NULL); } break; case 'b': if (rc_mode == RC_MODE_CQP && qp_b > 0 && codec != CODEC_VP9) { gst_println ("Decrease QP-B to %d", --qp_b); - g_object_set (data->encoder, "qpb", qp_b, NULL); + g_object_set (data->encoder, "qp-b", qp_b, NULL); } break; default: @@ -471,9 +471,9 @@ main (gint argc, gchar ** argv) MAKE_ELEMENT_AND_ADD (enc, encoder_name); g_object_set (enc, "bitrate", bitrate, "max-bitrate", max_bitrate, - "qpi", qp_i, "qpp", qp_p, "gop-size", 30, NULL); + "qp-i", qp_i, "qp-p", qp_p, "gop-size", 30, NULL); if (codec != CODEC_VP9) - g_object_set (enc, "qpb", qp_b, NULL); + g_object_set (enc, "qp-b", qp_b, NULL); gst_util_set_object_arg (G_OBJECT (enc), "rate-control", rate_control); -- 2.7.4