mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-19 13:55:41 +00:00
nvencoder: Update property names and default value
... to be the same as old NVENC elements Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6754>
This commit is contained in:
parent
aab2f59d02
commit
cfd92819d9
4 changed files with 350 additions and 233 deletions
|
@ -2203,9 +2203,13 @@ gst_nv_encoder_rc_mode_get_type (void)
|
|||
{
|
||||
static GType rc_mode_type = 0;
|
||||
static const GEnumValue rc_modes[] = {
|
||||
{GST_NV_ENCODER_RC_MODE_CONSTQP, "Constant Quantization", "cqp"},
|
||||
{GST_NV_ENCODER_RC_MODE_VBR, "Variable Bit Rate", "vbr"},
|
||||
{GST_NV_ENCODER_RC_MODE_DEFAULT, "Default", "default"},
|
||||
{GST_NV_ENCODER_RC_MODE_CONSTQP, "Constant Quantization", "constqp"},
|
||||
{GST_NV_ENCODER_RC_MODE_CBR, "Constant Bit Rate", "cbr"},
|
||||
{GST_NV_ENCODER_RC_MODE_VBR, "Variable Bit Rate", "vbr"},
|
||||
{GST_NV_ENCODER_RC_MODE_VBR_MINQP,
|
||||
"Variable Bit Rate "
|
||||
"(deprecated, use vbr and qp options)", "vbr-minqp"},
|
||||
{GST_NV_ENCODER_RC_MODE_CBR_LOWDELAY_HQ,
|
||||
"Low-Delay CBR, High Quality "
|
||||
"(deprecated, use cbr with tune and multipass)", "cbr-ld-hq"},
|
||||
|
@ -2325,6 +2329,7 @@ gst_nv_encoder_rc_mode_to_native (GstNvEncoderRCMode rc_mode,
|
|||
*rc_mode_native = NV_ENC_PARAMS_RC_CONSTQP;
|
||||
break;
|
||||
case GST_NV_ENCODER_RC_MODE_VBR:
|
||||
case GST_NV_ENCODER_RC_MODE_VBR_MINQP:
|
||||
*rc_mode_native = NV_ENC_PARAMS_RC_VBR;
|
||||
break;
|
||||
case GST_NV_ENCODER_RC_MODE_CBR:
|
||||
|
|
|
@ -83,9 +83,11 @@ GType gst_nv_encoder_rc_mode_get_type (void);
|
|||
|
||||
typedef enum
|
||||
{
|
||||
GST_NV_ENCODER_RC_MODE_DEFAULT,
|
||||
GST_NV_ENCODER_RC_MODE_CONSTQP,
|
||||
GST_NV_ENCODER_RC_MODE_VBR,
|
||||
GST_NV_ENCODER_RC_MODE_CBR,
|
||||
GST_NV_ENCODER_RC_MODE_VBR,
|
||||
GST_NV_ENCODER_RC_MODE_VBR_MINQP,
|
||||
GST_NV_ENCODER_RC_MODE_CBR_LOWDELAY_HQ,
|
||||
GST_NV_ENCODER_RC_MODE_CBR_HQ,
|
||||
GST_NV_ENCODER_RC_MODE_VBR_HQ,
|
||||
|
|
|
@ -77,9 +77,10 @@ enum
|
|||
/* rate-control params */
|
||||
PROP_RATE_CONTROL,
|
||||
|
||||
PROP_QP_I,
|
||||
PROP_QP_P,
|
||||
PROP_QP_B,
|
||||
PROP_QP_CONST,
|
||||
PROP_QP_CONST_I,
|
||||
PROP_QP_CONST_P,
|
||||
PROP_QP_CONST_B,
|
||||
|
||||
PROP_BITRATE,
|
||||
PROP_MAX_BITRATE,
|
||||
|
@ -90,18 +91,20 @@ enum
|
|||
PROP_B_ADAPT,
|
||||
PROP_SPATIAL_AQ,
|
||||
PROP_TEMPORAL_AQ,
|
||||
PROP_ZERO_REORDER_DELAY,
|
||||
PROP_ZEROLATENCY,
|
||||
PROP_NON_REF_P,
|
||||
PROP_STRICT_GOP,
|
||||
PROP_AQ_STRENGTH,
|
||||
|
||||
PROP_MIN_QP_I,
|
||||
PROP_MIN_QP_P,
|
||||
PROP_MIN_QP_B,
|
||||
PROP_QP_MIN,
|
||||
PROP_QP_MIN_I,
|
||||
PROP_QP_MIN_P,
|
||||
PROP_QP_MIN_B,
|
||||
|
||||
PROP_MAX_QP_I,
|
||||
PROP_MAX_QP_P,
|
||||
PROP_MAX_QP_B,
|
||||
PROP_QP_MAX,
|
||||
PROP_QP_MAX_I,
|
||||
PROP_QP_MAX_P,
|
||||
PROP_QP_MAX_B,
|
||||
|
||||
PROP_CONST_QUALITY,
|
||||
|
||||
|
@ -111,13 +114,13 @@ enum
|
|||
PROP_REPEAT_SEQUENCE_HEADER,
|
||||
};
|
||||
|
||||
#define DEFAULT_PRESET GST_NV_ENCODER_PRESET_P4
|
||||
#define DEFAULT_PRESET GST_NV_ENCODER_PRESET_DEFAULT
|
||||
#define DEFAULT_TUNE GST_NV_ENCODER_TUNE_DEFAULT
|
||||
#define DEFAULT_MULTI_PASS GST_NV_ENCODER_MULTI_PASS_DEFAULT
|
||||
#define DEFAULT_WEIGHTED_PRED FALSE
|
||||
#define DEFAULT_GOP_SIZE 30
|
||||
#define DEFAULT_GOP_SIZE 75
|
||||
#define DEFAULT_B_FRAMES 0
|
||||
#define DEFAULT_RATE_CONTROL GST_NV_ENCODER_RC_MODE_VBR
|
||||
#define DEFAULT_RATE_CONTROL GST_NV_ENCODER_RC_MODE_DEFAULT
|
||||
#define DEFAULT_QP -1
|
||||
#define DEFAULT_BITRATE 0
|
||||
#define DEFAULT_MAX_BITRATE 0
|
||||
|
@ -127,7 +130,7 @@ enum
|
|||
#define DEFAULT_B_ADAPT FALSE
|
||||
#define DEFAULT_SPATIAL_AQ FALSE
|
||||
#define DEFAULT_TEMPORAL_AQ FALSE
|
||||
#define DEFAULT_ZERO_REORDER_DELAY FALSE
|
||||
#define DEFAULT_ZEROLATENCY FALSE
|
||||
#define DEFAULT_NON_REF_P FALSE
|
||||
#define DEFAULT_STRICT_GOP FALSE
|
||||
#define DEFAULT_AQ_STRENGTH FALSE
|
||||
|
@ -164,9 +167,10 @@ typedef struct _GstNvH264Encoder
|
|||
guint bframes;
|
||||
|
||||
GstNvEncoderRCMode rc_mode;
|
||||
gint qp_i;
|
||||
gint qp_p;
|
||||
gint qp_b;
|
||||
gint qp_const;
|
||||
gint qp_const_i;
|
||||
gint qp_const_p;
|
||||
gint qp_const_b;
|
||||
guint bitrate;
|
||||
guint max_bitrate;
|
||||
guint vbv_buffer_size;
|
||||
|
@ -179,12 +183,14 @@ typedef struct _GstNvH264Encoder
|
|||
gboolean non_ref_p;
|
||||
gboolean strict_gop;
|
||||
guint aq_strength;
|
||||
gint min_qp_i;
|
||||
gint min_qp_p;
|
||||
gint min_qp_b;
|
||||
gint max_qp_i;
|
||||
gint max_qp_p;
|
||||
gint max_qp_b;
|
||||
gint qp_min;
|
||||
gint qp_min_i;
|
||||
gint qp_min_p;
|
||||
gint qp_min_b;
|
||||
gint qp_max;
|
||||
gint qp_max_i;
|
||||
gint qp_max_p;
|
||||
gint qp_max_b;
|
||||
gdouble const_quality;
|
||||
|
||||
gboolean aud;
|
||||
|
@ -360,23 +366,27 @@ gst_nv_h264_encoder_class_init (GstNvH264EncoderClass * klass, gpointer data)
|
|||
-1, G_MAXINT, DEFAULT_GOP_SIZE, param_flags));
|
||||
if (dev_caps->max_bframes > 0) {
|
||||
g_object_class_install_property (object_class, PROP_B_FRAMES,
|
||||
g_param_spec_uint ("b-frames", "B-Frames",
|
||||
g_param_spec_uint ("bframes", "B Frames",
|
||||
"Number of B-frames between I and P", 0, dev_caps->max_bframes,
|
||||
DEFAULT_B_FRAMES, conditional_param_flags));
|
||||
}
|
||||
g_object_class_install_property (object_class, PROP_RATE_CONTROL,
|
||||
g_param_spec_enum ("rate-control", "Rate Control", "Rate Control Method",
|
||||
g_param_spec_enum ("rc-mode", "RC Mode", "Rate Control Mode",
|
||||
GST_TYPE_NV_ENCODER_RC_MODE, DEFAULT_RATE_CONTROL, param_flags));
|
||||
g_object_class_install_property (object_class, PROP_QP_I,
|
||||
g_param_spec_int ("qp-i", "QP I",
|
||||
g_object_class_install_property (object_class, PROP_QP_CONST,
|
||||
g_param_spec_int ("qp-const", "QP Const",
|
||||
"DEPRECATED, use qp-const-{i,p,b} properties instead", -1, 51,
|
||||
DEFAULT_QP, param_flags));
|
||||
g_object_class_install_property (object_class, PROP_QP_CONST_I,
|
||||
g_param_spec_int ("qp-const-i", "QP Const I",
|
||||
"Constant QP value for I frame (-1 = default)", -1, 51,
|
||||
DEFAULT_QP, param_flags));
|
||||
g_object_class_install_property (object_class, PROP_QP_P,
|
||||
g_param_spec_int ("qp-p", "QP P",
|
||||
g_object_class_install_property (object_class, PROP_QP_CONST_P,
|
||||
g_param_spec_int ("qp-const-p", "QP Cost P",
|
||||
"Constant QP value for P frame (-1 = default)", -1, 51,
|
||||
DEFAULT_QP, param_flags));
|
||||
g_object_class_install_property (object_class, PROP_QP_B,
|
||||
g_param_spec_int ("qp-b", "QP B",
|
||||
g_object_class_install_property (object_class, PROP_QP_CONST_B,
|
||||
g_param_spec_int ("qp-const-b", "QP Const B",
|
||||
"Constant QP value for B frame (-1 = default)", -1, 51,
|
||||
DEFAULT_QP, param_flags));
|
||||
g_object_class_install_property (object_class, PROP_BITRATE,
|
||||
|
@ -419,10 +429,10 @@ gst_nv_h264_encoder_class_init (GstNvH264EncoderClass * klass, gpointer data)
|
|||
"Temporal Adaptive Quantization", DEFAULT_TEMPORAL_AQ,
|
||||
conditional_param_flags));
|
||||
}
|
||||
g_object_class_install_property (object_class, PROP_ZERO_REORDER_DELAY,
|
||||
g_param_spec_boolean ("zero-reorder-delay", "Zero Reorder Delay",
|
||||
"Zero latency operation (i.e., num_reorder_frames = 0)",
|
||||
DEFAULT_ZERO_REORDER_DELAY, param_flags));
|
||||
g_object_class_install_property (object_class, PROP_ZEROLATENCY,
|
||||
g_param_spec_boolean ("zerolatency", "Zerolatency",
|
||||
"Zero latency operation (no reordering delay)",
|
||||
DEFAULT_ZEROLATENCY, param_flags));
|
||||
g_object_class_install_property (object_class, PROP_NON_REF_P,
|
||||
g_param_spec_boolean ("nonref-p", "Nonref P",
|
||||
"Automatic insertion of non-reference P-frames", DEFAULT_NON_REF_P,
|
||||
|
@ -436,28 +446,36 @@ gst_nv_h264_encoder_class_init (GstNvH264EncoderClass * klass, gpointer data)
|
|||
"Adaptive Quantization Strength when spatial-aq is enabled"
|
||||
" from 1 (low) to 15 (aggressive), (0 = autoselect)",
|
||||
0, 15, DEFAULT_AQ_STRENGTH, param_flags));
|
||||
g_object_class_install_property (object_class, PROP_MIN_QP_I,
|
||||
g_param_spec_int ("min-qp-i", "Min QP I",
|
||||
"Minimum QP value for I frame, (-1 = disabled)", -1, 51,
|
||||
g_object_class_install_property (object_class, PROP_QP_MIN,
|
||||
g_param_spec_int ("qp-min", "QP Min",
|
||||
"DEPRECATED, Use qp-min-{i,p,b} properties instead", -1, 51,
|
||||
DEFAULT_QP, param_flags));
|
||||
g_object_class_install_property (object_class, PROP_MIN_QP_P,
|
||||
g_param_spec_int ("min-qp-p", "Min QP P",
|
||||
g_object_class_install_property (object_class, PROP_QP_MIN_I,
|
||||
g_param_spec_int ("qp-min-i", "QP Min I",
|
||||
"Minimum QP value for I frame, (-1 = automatic)", -1, 51,
|
||||
DEFAULT_QP, param_flags));
|
||||
g_object_class_install_property (object_class, PROP_QP_MIN_P,
|
||||
g_param_spec_int ("qp-min-p", "QP Min P",
|
||||
"Minimum QP value for P frame, (-1 = automatic)", -1, 51,
|
||||
DEFAULT_QP, param_flags));
|
||||
g_object_class_install_property (object_class, PROP_MIN_QP_B,
|
||||
g_param_spec_int ("min-qp-b", "Min QP B",
|
||||
g_object_class_install_property (object_class, PROP_QP_MIN_B,
|
||||
g_param_spec_int ("qp-min-b", "QP Min B",
|
||||
"Minimum QP value for B frame, (-1 = automatic)", -1, 51,
|
||||
DEFAULT_QP, param_flags));
|
||||
g_object_class_install_property (object_class, PROP_MAX_QP_I,
|
||||
g_param_spec_int ("max-qp-i", "Max QP I",
|
||||
"Maximum QP value for I frame, (-1 = disabled)", -1, 51,
|
||||
g_object_class_install_property (object_class, PROP_QP_MAX,
|
||||
g_param_spec_int ("qp-max", "QP Max",
|
||||
"DEPRECATED, Use qp-max-{i,p,b} properties instead", -1, 51,
|
||||
DEFAULT_QP, param_flags));
|
||||
g_object_class_install_property (object_class, PROP_MAX_QP_P,
|
||||
g_param_spec_int ("max-qp-p", "Max QP P",
|
||||
g_object_class_install_property (object_class, PROP_QP_MAX_I,
|
||||
g_param_spec_int ("qp-max-i", "QP Max I",
|
||||
"Maximum QP value for I frame, (-1 = automatic)", -1, 51,
|
||||
DEFAULT_QP, param_flags));
|
||||
g_object_class_install_property (object_class, PROP_QP_MAX_P,
|
||||
g_param_spec_int ("qp-max-p", "QP Max P",
|
||||
"Maximum QP value for P frame, (-1 = automatic)", -1, 51,
|
||||
DEFAULT_QP, param_flags));
|
||||
g_object_class_install_property (object_class, PROP_MAX_QP_B,
|
||||
g_param_spec_int ("max-qp-b", "Max QP B",
|
||||
g_object_class_install_property (object_class, PROP_QP_MAX_B,
|
||||
g_param_spec_int ("qp-max-b", "Max QP B",
|
||||
"Maximum QP value for B frame, (-1 = automatic)", -1, 51,
|
||||
DEFAULT_QP, param_flags));
|
||||
g_object_class_install_property (object_class, PROP_CONST_QUALITY,
|
||||
|
@ -557,9 +575,10 @@ gst_nv_h264_encoder_init (GstNvH264Encoder * self)
|
|||
self->gop_size = DEFAULT_GOP_SIZE;
|
||||
self->bframes = DEFAULT_B_FRAMES;
|
||||
self->rc_mode = DEFAULT_RATE_CONTROL;
|
||||
self->qp_i = DEFAULT_QP;
|
||||
self->qp_p = DEFAULT_QP;
|
||||
self->qp_b = DEFAULT_QP;
|
||||
self->qp_const = DEFAULT_QP;
|
||||
self->qp_const_i = DEFAULT_QP;
|
||||
self->qp_const_p = DEFAULT_QP;
|
||||
self->qp_const_b = DEFAULT_QP;
|
||||
self->bitrate = DEFAULT_BITRATE;
|
||||
self->max_bitrate = DEFAULT_MAX_BITRATE;
|
||||
self->vbv_buffer_size = DEFAULT_VBV_BUFFER_SIZE;
|
||||
|
@ -568,16 +587,18 @@ gst_nv_h264_encoder_init (GstNvH264Encoder * self)
|
|||
self->b_adapt = DEFAULT_B_ADAPT;
|
||||
self->spatial_aq = DEFAULT_SPATIAL_AQ;
|
||||
self->temporal_aq = DEFAULT_TEMPORAL_AQ;
|
||||
self->zero_reorder_delay = DEFAULT_ZERO_REORDER_DELAY;
|
||||
self->zero_reorder_delay = DEFAULT_ZEROLATENCY;
|
||||
self->non_ref_p = DEFAULT_NON_REF_P;
|
||||
self->strict_gop = DEFAULT_STRICT_GOP;
|
||||
self->aq_strength = DEFAULT_AQ_STRENGTH;
|
||||
self->min_qp_i = DEFAULT_QP;
|
||||
self->min_qp_p = DEFAULT_QP;
|
||||
self->min_qp_b = DEFAULT_QP;
|
||||
self->max_qp_i = DEFAULT_QP;
|
||||
self->max_qp_p = DEFAULT_QP;
|
||||
self->max_qp_b = DEFAULT_QP;
|
||||
self->qp_min = DEFAULT_QP;
|
||||
self->qp_min_i = DEFAULT_QP;
|
||||
self->qp_min_p = DEFAULT_QP;
|
||||
self->qp_min_b = DEFAULT_QP;
|
||||
self->qp_max = DEFAULT_QP;
|
||||
self->qp_max_i = DEFAULT_QP;
|
||||
self->qp_max_p = DEFAULT_QP;
|
||||
self->qp_max_b = DEFAULT_QP;
|
||||
self->const_quality = DEFAULT_CONST_QUALITY;
|
||||
self->aud = DEFAULT_AUD;
|
||||
if (klass->device_caps.cabac)
|
||||
|
@ -786,14 +807,17 @@ gst_nv_h264_encoder_set_property (GObject * object, guint prop_id,
|
|||
}
|
||||
break;
|
||||
}
|
||||
case PROP_QP_I:
|
||||
update_int (self, &self->qp_i, value, UPDATE_RC_PARAM);
|
||||
case PROP_QP_CONST:
|
||||
update_int (self, &self->qp_const, value, UPDATE_RC_PARAM);
|
||||
break;
|
||||
case PROP_QP_P:
|
||||
update_int (self, &self->qp_p, value, UPDATE_RC_PARAM);
|
||||
case PROP_QP_CONST_I:
|
||||
update_int (self, &self->qp_const_i, value, UPDATE_RC_PARAM);
|
||||
break;
|
||||
case PROP_QP_B:
|
||||
update_int (self, &self->qp_b, value, UPDATE_RC_PARAM);
|
||||
case PROP_QP_CONST_P:
|
||||
update_int (self, &self->qp_const_p, value, UPDATE_RC_PARAM);
|
||||
break;
|
||||
case PROP_QP_CONST_B:
|
||||
update_int (self, &self->qp_const_b, value, UPDATE_RC_PARAM);
|
||||
break;
|
||||
case PROP_BITRATE:
|
||||
update_uint (self, &self->bitrate, value, UPDATE_BITRATE);
|
||||
|
@ -820,7 +844,7 @@ gst_nv_h264_encoder_set_property (GObject * object, guint prop_id,
|
|||
case PROP_TEMPORAL_AQ:
|
||||
update_boolean (self, &self->temporal_aq, value, UPDATE_RC_PARAM);
|
||||
break;
|
||||
case PROP_ZERO_REORDER_DELAY:
|
||||
case PROP_ZEROLATENCY:
|
||||
update_boolean (self, &self->zero_reorder_delay, value, UPDATE_RC_PARAM);
|
||||
break;
|
||||
case PROP_NON_REF_P:
|
||||
|
@ -832,23 +856,29 @@ gst_nv_h264_encoder_set_property (GObject * object, guint prop_id,
|
|||
case PROP_AQ_STRENGTH:
|
||||
update_uint (self, &self->aq_strength, value, UPDATE_RC_PARAM);
|
||||
break;
|
||||
case PROP_MIN_QP_I:
|
||||
update_int (self, &self->min_qp_i, value, UPDATE_RC_PARAM);
|
||||
case PROP_QP_MIN:
|
||||
update_int (self, &self->qp_min, value, UPDATE_RC_PARAM);
|
||||
break;
|
||||
case PROP_MIN_QP_P:
|
||||
update_int (self, &self->min_qp_p, value, UPDATE_RC_PARAM);
|
||||
case PROP_QP_MIN_I:
|
||||
update_int (self, &self->qp_min_i, value, UPDATE_RC_PARAM);
|
||||
break;
|
||||
case PROP_MIN_QP_B:
|
||||
update_int (self, &self->min_qp_b, value, UPDATE_RC_PARAM);
|
||||
case PROP_QP_MIN_P:
|
||||
update_int (self, &self->qp_min_p, value, UPDATE_RC_PARAM);
|
||||
break;
|
||||
case PROP_MAX_QP_I:
|
||||
update_int (self, &self->max_qp_i, value, UPDATE_RC_PARAM);
|
||||
case PROP_QP_MIN_B:
|
||||
update_int (self, &self->qp_min_b, value, UPDATE_RC_PARAM);
|
||||
break;
|
||||
case PROP_MAX_QP_P:
|
||||
update_int (self, &self->max_qp_p, value, UPDATE_RC_PARAM);
|
||||
case PROP_QP_MAX:
|
||||
update_int (self, &self->qp_max, value, UPDATE_RC_PARAM);
|
||||
break;
|
||||
case PROP_MAX_QP_B:
|
||||
update_int (self, &self->max_qp_b, value, UPDATE_RC_PARAM);
|
||||
case PROP_QP_MAX_I:
|
||||
update_int (self, &self->qp_max_i, value, UPDATE_RC_PARAM);
|
||||
break;
|
||||
case PROP_QP_MAX_P:
|
||||
update_int (self, &self->qp_max_p, value, UPDATE_RC_PARAM);
|
||||
break;
|
||||
case PROP_QP_MAX_B:
|
||||
update_int (self, &self->qp_max_b, value, UPDATE_RC_PARAM);
|
||||
break;
|
||||
case PROP_CONST_QUALITY:
|
||||
update_double (self, &self->const_quality, value, UPDATE_RC_PARAM);
|
||||
|
@ -905,14 +935,17 @@ gst_nv_h264_encoder_get_property (GObject * object, guint prop_id,
|
|||
case PROP_RATE_CONTROL:
|
||||
g_value_set_enum (value, self->rc_mode);
|
||||
break;
|
||||
case PROP_QP_I:
|
||||
g_value_set_int (value, self->qp_i);
|
||||
case PROP_QP_CONST:
|
||||
g_value_set_int (value, self->qp_const);
|
||||
break;
|
||||
case PROP_QP_P:
|
||||
g_value_set_int (value, self->qp_p);
|
||||
case PROP_QP_CONST_I:
|
||||
g_value_set_int (value, self->qp_const_i);
|
||||
break;
|
||||
case PROP_QP_B:
|
||||
g_value_set_int (value, self->qp_b);
|
||||
case PROP_QP_CONST_P:
|
||||
g_value_set_int (value, self->qp_const_p);
|
||||
break;
|
||||
case PROP_QP_CONST_B:
|
||||
g_value_set_int (value, self->qp_const_b);
|
||||
break;
|
||||
case PROP_BITRATE:
|
||||
g_value_set_uint (value, self->bitrate);
|
||||
|
@ -938,7 +971,7 @@ gst_nv_h264_encoder_get_property (GObject * object, guint prop_id,
|
|||
case PROP_TEMPORAL_AQ:
|
||||
g_value_set_boolean (value, self->temporal_aq);
|
||||
break;
|
||||
case PROP_ZERO_REORDER_DELAY:
|
||||
case PROP_ZEROLATENCY:
|
||||
g_value_set_boolean (value, self->zero_reorder_delay);
|
||||
break;
|
||||
case PROP_NON_REF_P:
|
||||
|
@ -950,23 +983,29 @@ gst_nv_h264_encoder_get_property (GObject * object, guint prop_id,
|
|||
case PROP_AQ_STRENGTH:
|
||||
g_value_set_uint (value, self->aq_strength);
|
||||
break;
|
||||
case PROP_MIN_QP_I:
|
||||
g_value_set_int (value, self->min_qp_i);
|
||||
case PROP_QP_MIN:
|
||||
g_value_set_int (value, self->qp_min);
|
||||
break;
|
||||
case PROP_MIN_QP_P:
|
||||
g_value_set_int (value, self->min_qp_p);
|
||||
case PROP_QP_MIN_I:
|
||||
g_value_set_int (value, self->qp_min_i);
|
||||
break;
|
||||
case PROP_MIN_QP_B:
|
||||
g_value_set_int (value, self->min_qp_b);
|
||||
case PROP_QP_MIN_P:
|
||||
g_value_set_int (value, self->qp_min_p);
|
||||
break;
|
||||
case PROP_MAX_QP_I:
|
||||
g_value_set_int (value, self->max_qp_i);
|
||||
case PROP_QP_MIN_B:
|
||||
g_value_set_int (value, self->qp_min_b);
|
||||
break;
|
||||
case PROP_MAX_QP_P:
|
||||
g_value_set_int (value, self->max_qp_p);
|
||||
case PROP_QP_MAX:
|
||||
g_value_set_int (value, self->qp_max);
|
||||
break;
|
||||
case PROP_MAX_QP_B:
|
||||
g_value_set_int (value, self->max_qp_b);
|
||||
case PROP_QP_MAX_I:
|
||||
g_value_set_int (value, self->qp_max_i);
|
||||
break;
|
||||
case PROP_QP_MAX_P:
|
||||
g_value_set_int (value, self->qp_max_p);
|
||||
break;
|
||||
case PROP_QP_MAX_B:
|
||||
g_value_set_int (value, self->qp_max_b);
|
||||
break;
|
||||
case PROP_CONST_QUALITY:
|
||||
g_value_set_double (value, self->const_quality);
|
||||
|
@ -1344,31 +1383,41 @@ gst_nv_h264_encoder_set_format (GstNvEncoder * encoder,
|
|||
if (self->vbv_buffer_size)
|
||||
rc_params->vbvBufferSize = self->vbv_buffer_size * 1024;
|
||||
|
||||
if (self->min_qp_i >= 0) {
|
||||
if (self->qp_min >= 0) {
|
||||
rc_params->enableMinQP = TRUE;
|
||||
rc_params->minQP.qpIntra = self->min_qp_i;
|
||||
if (self->min_qp_p >= 0) {
|
||||
rc_params->minQP.qpInterP = self->min_qp_p;
|
||||
rc_params->minQP.qpIntra = self->qp_min;
|
||||
rc_params->minQP.qpInterP = self->qp_min;
|
||||
rc_params->minQP.qpInterB = self->qp_min;
|
||||
} else if (self->qp_min_i >= 0) {
|
||||
rc_params->enableMinQP = TRUE;
|
||||
rc_params->minQP.qpIntra = self->qp_min_i;
|
||||
if (self->qp_min_p >= 0) {
|
||||
rc_params->minQP.qpInterP = self->qp_min_p;
|
||||
} else {
|
||||
rc_params->minQP.qpInterP = rc_params->minQP.qpIntra;
|
||||
}
|
||||
if (self->min_qp_b >= 0) {
|
||||
rc_params->minQP.qpInterB = self->min_qp_b;
|
||||
if (self->qp_min_b >= 0) {
|
||||
rc_params->minQP.qpInterB = self->qp_min_b;
|
||||
} else {
|
||||
rc_params->minQP.qpInterB = rc_params->minQP.qpInterP;
|
||||
}
|
||||
}
|
||||
|
||||
if (self->max_qp_i >= 0) {
|
||||
if (self->qp_max >= 0) {
|
||||
rc_params->enableMaxQP = TRUE;
|
||||
rc_params->maxQP.qpIntra = self->max_qp_i;
|
||||
if (self->max_qp_p >= 0) {
|
||||
rc_params->maxQP.qpInterP = self->max_qp_p;
|
||||
rc_params->maxQP.qpIntra = self->qp_min;
|
||||
rc_params->maxQP.qpInterP = self->qp_min;
|
||||
rc_params->maxQP.qpInterB = self->qp_min;
|
||||
} else if (self->qp_max_i >= 0) {
|
||||
rc_params->enableMaxQP = TRUE;
|
||||
rc_params->maxQP.qpIntra = self->qp_max_i;
|
||||
if (self->qp_max_p >= 0) {
|
||||
rc_params->maxQP.qpInterP = self->qp_max_p;
|
||||
} else {
|
||||
rc_params->maxQP.qpInterP = rc_params->maxQP.qpIntra;
|
||||
}
|
||||
if (self->max_qp_b >= 0) {
|
||||
rc_params->maxQP.qpInterB = self->max_qp_b;
|
||||
if (self->qp_max_b >= 0) {
|
||||
rc_params->maxQP.qpInterB = self->qp_max_b;
|
||||
} else {
|
||||
rc_params->maxQP.qpInterB = rc_params->maxQP.qpInterP;
|
||||
}
|
||||
|
@ -1378,12 +1427,18 @@ gst_nv_h264_encoder_set_format (GstNvEncoder * encoder,
|
|||
&rc_params->rateControlMode, &rc_params->multiPass);
|
||||
|
||||
if (rc_params->rateControlMode == NV_ENC_PARAMS_RC_CONSTQP) {
|
||||
if (self->qp_i >= 0)
|
||||
rc_params->constQP.qpIntra = self->qp_i;
|
||||
if (self->qp_p >= 0)
|
||||
rc_params->constQP.qpInterP = self->qp_p;
|
||||
if (self->qp_b >= 0)
|
||||
rc_params->constQP.qpInterB = self->qp_b;
|
||||
if (self->qp_const >= 0) {
|
||||
rc_params->constQP.qpIntra = self->qp_const;
|
||||
rc_params->constQP.qpInterP = self->qp_const;
|
||||
rc_params->constQP.qpInterB = self->qp_const;
|
||||
} else {
|
||||
if (self->qp_const_i >= 0)
|
||||
rc_params->constQP.qpIntra = self->qp_const_i;
|
||||
if (self->qp_const_p >= 0)
|
||||
rc_params->constQP.qpInterP = self->qp_const_p;
|
||||
if (self->qp_const_b >= 0)
|
||||
rc_params->constQP.qpInterB = self->qp_const_b;
|
||||
}
|
||||
}
|
||||
|
||||
if (self->spatial_aq) {
|
||||
|
|
|
@ -77,9 +77,10 @@ enum
|
|||
/* rate-control params */
|
||||
PROP_RATE_CONTROL,
|
||||
|
||||
PROP_QP_I,
|
||||
PROP_QP_P,
|
||||
PROP_QP_B,
|
||||
PROP_QP_CONST,
|
||||
PROP_QP_CONST_I,
|
||||
PROP_QP_CONST_P,
|
||||
PROP_QP_CONST_B,
|
||||
|
||||
PROP_BITRATE,
|
||||
PROP_MAX_BITRATE,
|
||||
|
@ -90,18 +91,20 @@ enum
|
|||
PROP_B_ADAPT,
|
||||
PROP_SPATIAL_AQ,
|
||||
PROP_TEMPORAL_AQ,
|
||||
PROP_ZERO_REORDER_DELAY,
|
||||
PROP_ZEROLATENCY,
|
||||
PROP_NON_REF_P,
|
||||
PROP_STRICT_GOP,
|
||||
PROP_AQ_STRENGTH,
|
||||
|
||||
PROP_MIN_QP_I,
|
||||
PROP_MIN_QP_P,
|
||||
PROP_MIN_QP_B,
|
||||
PROP_QP_MIN,
|
||||
PROP_QP_MIN_I,
|
||||
PROP_QP_MIN_P,
|
||||
PROP_QP_MIN_B,
|
||||
|
||||
PROP_MAX_QP_I,
|
||||
PROP_MAX_QP_P,
|
||||
PROP_MAX_QP_B,
|
||||
PROP_QP_MAX,
|
||||
PROP_QP_MAX_I,
|
||||
PROP_QP_MAX_P,
|
||||
PROP_QP_MAX_B,
|
||||
|
||||
PROP_CONST_QUALITY,
|
||||
|
||||
|
@ -110,13 +113,13 @@ enum
|
|||
PROP_REPEAT_SEQUENCE_HEADER,
|
||||
};
|
||||
|
||||
#define DEFAULT_PRESET GST_NV_ENCODER_PRESET_P4
|
||||
#define DEFAULT_PRESET GST_NV_ENCODER_PRESET_DEFAULT
|
||||
#define DEFAULT_TUNE GST_NV_ENCODER_TUNE_DEFAULT
|
||||
#define DEFAULT_MULTI_PASS GST_NV_ENCODER_MULTI_PASS_DEFAULT
|
||||
#define DEFAULT_WEIGHTED_PRED FALSE
|
||||
#define DEFAULT_GOP_SIZE 30
|
||||
#define DEFAULT_GOP_SIZE 75
|
||||
#define DEFAULT_B_FRAMES 0
|
||||
#define DEFAULT_RATE_CONTROL GST_NV_ENCODER_RC_MODE_VBR
|
||||
#define DEFAULT_RATE_CONTROL GST_NV_ENCODER_RC_MODE_DEFAULT
|
||||
#define DEFAULT_QP -1
|
||||
#define DEFAULT_BITRATE 0
|
||||
#define DEFAULT_MAX_BITRATE 0
|
||||
|
@ -126,7 +129,7 @@ enum
|
|||
#define DEFAULT_B_ADAPT FALSE
|
||||
#define DEFAULT_SPATIAL_AQ FALSE
|
||||
#define DEFAULT_TEMPORAL_AQ FALSE
|
||||
#define DEFAULT_ZERO_REORDER_DELAY FALSE
|
||||
#define DEFAULT_ZEROLATENCY FALSE
|
||||
#define DEFAULT_NON_REF_P FALSE
|
||||
#define DEFAULT_STRICT_GOP FALSE
|
||||
#define DEFAULT_AQ_STRENGTH FALSE
|
||||
|
@ -170,9 +173,10 @@ typedef struct _GstNvH265Encoder
|
|||
guint bframes;
|
||||
|
||||
GstNvEncoderRCMode rc_mode;
|
||||
gint qp_i;
|
||||
gint qp_p;
|
||||
gint qp_b;
|
||||
gint qp_const;
|
||||
gint qp_const_i;
|
||||
gint qp_const_p;
|
||||
gint qp_const_b;
|
||||
guint bitrate;
|
||||
guint max_bitrate;
|
||||
guint vbv_buffer_size;
|
||||
|
@ -185,12 +189,14 @@ typedef struct _GstNvH265Encoder
|
|||
gboolean non_ref_p;
|
||||
gboolean strict_gop;
|
||||
guint aq_strength;
|
||||
gint min_qp_i;
|
||||
gint min_qp_p;
|
||||
gint min_qp_b;
|
||||
gint max_qp_i;
|
||||
gint max_qp_p;
|
||||
gint max_qp_b;
|
||||
gint qp_min;
|
||||
gint qp_min_i;
|
||||
gint qp_min_p;
|
||||
gint qp_min_b;
|
||||
gint qp_max;
|
||||
gint qp_max_i;
|
||||
gint qp_max_p;
|
||||
gint qp_max_b;
|
||||
gdouble const_quality;
|
||||
|
||||
gboolean aud;
|
||||
|
@ -365,23 +371,27 @@ gst_nv_h265_encoder_class_init (GstNvH265EncoderClass * klass, gpointer data)
|
|||
-1, G_MAXINT, DEFAULT_GOP_SIZE, param_flags));
|
||||
if (dev_caps->max_bframes > 0) {
|
||||
g_object_class_install_property (object_class, PROP_B_FRAMES,
|
||||
g_param_spec_uint ("b-frames", "B-Frames",
|
||||
g_param_spec_uint ("bframes", "B Frames",
|
||||
"Number of B-frames between I and P", 0, dev_caps->max_bframes,
|
||||
DEFAULT_B_FRAMES, conditional_param_flags));
|
||||
}
|
||||
g_object_class_install_property (object_class, PROP_RATE_CONTROL,
|
||||
g_param_spec_enum ("rate-control", "Rate Control", "Rate Control Method",
|
||||
g_param_spec_enum ("rc-mode", "RC Mode", "Rate Control Mode",
|
||||
GST_TYPE_NV_ENCODER_RC_MODE, DEFAULT_RATE_CONTROL, param_flags));
|
||||
g_object_class_install_property (object_class, PROP_QP_I,
|
||||
g_param_spec_int ("qp-i", "QP I",
|
||||
g_object_class_install_property (object_class, PROP_QP_CONST,
|
||||
g_param_spec_int ("qp-const", "QP Const",
|
||||
"DEPRECATED, use qp-const-{i,p,b} properties instead",
|
||||
-1, 51, DEFAULT_QP, param_flags));
|
||||
g_object_class_install_property (object_class, PROP_QP_CONST_I,
|
||||
g_param_spec_int ("qp-const-i", "QP Const I",
|
||||
"Constant QP value for I frame (-1 = default)", -1, 51,
|
||||
DEFAULT_QP, param_flags));
|
||||
g_object_class_install_property (object_class, PROP_QP_P,
|
||||
g_param_spec_int ("qp-p", "QP P",
|
||||
g_object_class_install_property (object_class, PROP_QP_CONST_P,
|
||||
g_param_spec_int ("qp-const-p", "QP Cost P",
|
||||
"Constant QP value for P frame (-1 = default)", -1, 51,
|
||||
DEFAULT_QP, param_flags));
|
||||
g_object_class_install_property (object_class, PROP_QP_B,
|
||||
g_param_spec_int ("qp-b", "QP B",
|
||||
g_object_class_install_property (object_class, PROP_QP_CONST_B,
|
||||
g_param_spec_int ("qp-const-b", "QP Const B",
|
||||
"Constant QP value for B frame (-1 = default)", -1, 51,
|
||||
DEFAULT_QP, param_flags));
|
||||
g_object_class_install_property (object_class, PROP_BITRATE,
|
||||
|
@ -424,10 +434,10 @@ gst_nv_h265_encoder_class_init (GstNvH265EncoderClass * klass, gpointer data)
|
|||
"Temporal Adaptive Quantization", DEFAULT_TEMPORAL_AQ,
|
||||
conditional_param_flags));
|
||||
}
|
||||
g_object_class_install_property (object_class, PROP_ZERO_REORDER_DELAY,
|
||||
g_param_spec_boolean ("zero-reorder-delay", "Zero Reorder Delay",
|
||||
"Zero latency operation (i.e., num_reorder_frames = 0)",
|
||||
DEFAULT_ZERO_REORDER_DELAY, param_flags));
|
||||
g_object_class_install_property (object_class, PROP_ZEROLATENCY,
|
||||
g_param_spec_boolean ("zerolatency", "Zerolatency",
|
||||
"Zero latency operation (no reordering delay)",
|
||||
DEFAULT_ZEROLATENCY, param_flags));
|
||||
g_object_class_install_property (object_class, PROP_NON_REF_P,
|
||||
g_param_spec_boolean ("nonref-p", "Nonref P",
|
||||
"Automatic insertion of non-reference P-frames", DEFAULT_NON_REF_P,
|
||||
|
@ -441,28 +451,36 @@ gst_nv_h265_encoder_class_init (GstNvH265EncoderClass * klass, gpointer data)
|
|||
"Adaptive Quantization Strength when spatial-aq is enabled"
|
||||
" from 1 (low) to 15 (aggressive), (0 = autoselect)",
|
||||
0, 15, DEFAULT_AQ_STRENGTH, param_flags));
|
||||
g_object_class_install_property (object_class, PROP_MIN_QP_I,
|
||||
g_param_spec_int ("min-qp-i", "Min QP I",
|
||||
"Minimum QP value for I frame, (-1 = disabled)", -1, 51,
|
||||
g_object_class_install_property (object_class, PROP_QP_MIN,
|
||||
g_param_spec_int ("qp-min", "QP Min",
|
||||
"DEPRECATED, Use qp-min-{i,p,b} properties instead", -1, 51,
|
||||
DEFAULT_QP, param_flags));
|
||||
g_object_class_install_property (object_class, PROP_MIN_QP_P,
|
||||
g_param_spec_int ("min-qp-p", "Min QP P",
|
||||
g_object_class_install_property (object_class, PROP_QP_MIN_I,
|
||||
g_param_spec_int ("qp-min-i", "QP Min I",
|
||||
"Minimum QP value for I frame, (-1 = automatic)", -1, 51,
|
||||
DEFAULT_QP, param_flags));
|
||||
g_object_class_install_property (object_class, PROP_QP_MIN_P,
|
||||
g_param_spec_int ("qp-min-p", "QP Min P",
|
||||
"Minimum QP value for P frame, (-1 = automatic)", -1, 51,
|
||||
DEFAULT_QP, param_flags));
|
||||
g_object_class_install_property (object_class, PROP_MIN_QP_B,
|
||||
g_param_spec_int ("min-qp-b", "Min QP B",
|
||||
g_object_class_install_property (object_class, PROP_QP_MIN_B,
|
||||
g_param_spec_int ("qp-min-b", "QP Min B",
|
||||
"Minimum QP value for B frame, (-1 = automatic)", -1, 51,
|
||||
DEFAULT_QP, param_flags));
|
||||
g_object_class_install_property (object_class, PROP_MAX_QP_I,
|
||||
g_param_spec_int ("max-qp-i", "Max QP I",
|
||||
"Maximum QP value for I frame, (-1 = disabled)", -1, 51,
|
||||
g_object_class_install_property (object_class, PROP_QP_MAX,
|
||||
g_param_spec_int ("qp-max", "QP Max",
|
||||
"DEPRECATED, Use qp-max-{i,p,b} properties instead", -1, 51,
|
||||
DEFAULT_QP, param_flags));
|
||||
g_object_class_install_property (object_class, PROP_MAX_QP_P,
|
||||
g_param_spec_int ("max-qp-p", "Max QP P",
|
||||
g_object_class_install_property (object_class, PROP_QP_MAX_I,
|
||||
g_param_spec_int ("qp-max-i", "QP Max I",
|
||||
"Maximum QP value for I frame, (-1 = automatic)", -1, 51,
|
||||
DEFAULT_QP, param_flags));
|
||||
g_object_class_install_property (object_class, PROP_QP_MAX_P,
|
||||
g_param_spec_int ("qp-max-p", "QP Max P",
|
||||
"Maximum QP value for P frame, (-1 = automatic)", -1, 51,
|
||||
DEFAULT_QP, param_flags));
|
||||
g_object_class_install_property (object_class, PROP_MAX_QP_B,
|
||||
g_param_spec_int ("max-qp-b", "Max QP B",
|
||||
g_object_class_install_property (object_class, PROP_QP_MAX_B,
|
||||
g_param_spec_int ("qp-max-b", "Max QP B",
|
||||
"Maximum QP value for B frame, (-1 = automatic)", -1, 51,
|
||||
DEFAULT_QP, param_flags));
|
||||
g_object_class_install_property (object_class, PROP_CONST_QUALITY,
|
||||
|
@ -558,9 +576,10 @@ gst_nv_h265_encoder_init (GstNvH265Encoder * self)
|
|||
self->gop_size = DEFAULT_GOP_SIZE;
|
||||
self->bframes = DEFAULT_B_FRAMES;
|
||||
self->rc_mode = DEFAULT_RATE_CONTROL;
|
||||
self->qp_i = DEFAULT_QP;
|
||||
self->qp_p = DEFAULT_QP;
|
||||
self->qp_b = DEFAULT_QP;
|
||||
self->qp_const = DEFAULT_QP;
|
||||
self->qp_const_i = DEFAULT_QP;
|
||||
self->qp_const_p = DEFAULT_QP;
|
||||
self->qp_const_b = DEFAULT_QP;
|
||||
self->bitrate = DEFAULT_BITRATE;
|
||||
self->max_bitrate = DEFAULT_MAX_BITRATE;
|
||||
self->vbv_buffer_size = DEFAULT_VBV_BUFFER_SIZE;
|
||||
|
@ -569,16 +588,18 @@ gst_nv_h265_encoder_init (GstNvH265Encoder * self)
|
|||
self->b_adapt = DEFAULT_B_ADAPT;
|
||||
self->spatial_aq = DEFAULT_SPATIAL_AQ;
|
||||
self->temporal_aq = DEFAULT_TEMPORAL_AQ;
|
||||
self->zero_reorder_delay = DEFAULT_ZERO_REORDER_DELAY;
|
||||
self->zero_reorder_delay = DEFAULT_ZEROLATENCY;
|
||||
self->non_ref_p = DEFAULT_NON_REF_P;
|
||||
self->strict_gop = DEFAULT_STRICT_GOP;
|
||||
self->aq_strength = DEFAULT_AQ_STRENGTH;
|
||||
self->min_qp_i = DEFAULT_QP;
|
||||
self->min_qp_p = DEFAULT_QP;
|
||||
self->min_qp_b = DEFAULT_QP;
|
||||
self->max_qp_i = DEFAULT_QP;
|
||||
self->max_qp_p = DEFAULT_QP;
|
||||
self->max_qp_b = DEFAULT_QP;
|
||||
self->qp_min = DEFAULT_QP;
|
||||
self->qp_min_i = DEFAULT_QP;
|
||||
self->qp_min_p = DEFAULT_QP;
|
||||
self->qp_min_b = DEFAULT_QP;
|
||||
self->qp_max = DEFAULT_QP;
|
||||
self->qp_max_i = DEFAULT_QP;
|
||||
self->qp_max_p = DEFAULT_QP;
|
||||
self->qp_max_b = DEFAULT_QP;
|
||||
self->const_quality = DEFAULT_CONST_QUALITY;
|
||||
self->aud = DEFAULT_AUD;
|
||||
self->repeat_sequence_header = DEFAULT_REPEAT_SEQUENCE_HEADER;
|
||||
|
@ -785,14 +806,17 @@ gst_nv_h265_encoder_set_property (GObject * object, guint prop_id,
|
|||
}
|
||||
break;
|
||||
}
|
||||
case PROP_QP_I:
|
||||
update_int (self, &self->qp_i, value, UPDATE_RC_PARAM);
|
||||
case PROP_QP_CONST:
|
||||
update_int (self, &self->qp_const, value, UPDATE_RC_PARAM);
|
||||
break;
|
||||
case PROP_QP_P:
|
||||
update_int (self, &self->qp_p, value, UPDATE_RC_PARAM);
|
||||
case PROP_QP_CONST_I:
|
||||
update_int (self, &self->qp_const_i, value, UPDATE_RC_PARAM);
|
||||
break;
|
||||
case PROP_QP_B:
|
||||
update_int (self, &self->qp_b, value, UPDATE_RC_PARAM);
|
||||
case PROP_QP_CONST_P:
|
||||
update_int (self, &self->qp_const_p, value, UPDATE_RC_PARAM);
|
||||
break;
|
||||
case PROP_QP_CONST_B:
|
||||
update_int (self, &self->qp_const_b, value, UPDATE_RC_PARAM);
|
||||
break;
|
||||
case PROP_BITRATE:
|
||||
update_uint (self, &self->bitrate, value, UPDATE_BITRATE);
|
||||
|
@ -819,7 +843,7 @@ gst_nv_h265_encoder_set_property (GObject * object, guint prop_id,
|
|||
case PROP_TEMPORAL_AQ:
|
||||
update_boolean (self, &self->temporal_aq, value, UPDATE_RC_PARAM);
|
||||
break;
|
||||
case PROP_ZERO_REORDER_DELAY:
|
||||
case PROP_ZEROLATENCY:
|
||||
update_boolean (self, &self->zero_reorder_delay, value, UPDATE_RC_PARAM);
|
||||
break;
|
||||
case PROP_NON_REF_P:
|
||||
|
@ -831,23 +855,29 @@ gst_nv_h265_encoder_set_property (GObject * object, guint prop_id,
|
|||
case PROP_AQ_STRENGTH:
|
||||
update_uint (self, &self->aq_strength, value, UPDATE_RC_PARAM);
|
||||
break;
|
||||
case PROP_MIN_QP_I:
|
||||
update_int (self, &self->min_qp_i, value, UPDATE_RC_PARAM);
|
||||
case PROP_QP_MIN:
|
||||
update_int (self, &self->qp_min, value, UPDATE_RC_PARAM);
|
||||
break;
|
||||
case PROP_MIN_QP_P:
|
||||
update_int (self, &self->min_qp_p, value, UPDATE_RC_PARAM);
|
||||
case PROP_QP_MIN_I:
|
||||
update_int (self, &self->qp_min_i, value, UPDATE_RC_PARAM);
|
||||
break;
|
||||
case PROP_MIN_QP_B:
|
||||
update_int (self, &self->min_qp_b, value, UPDATE_RC_PARAM);
|
||||
case PROP_QP_MIN_P:
|
||||
update_int (self, &self->qp_min_p, value, UPDATE_RC_PARAM);
|
||||
break;
|
||||
case PROP_MAX_QP_I:
|
||||
update_int (self, &self->max_qp_i, value, UPDATE_RC_PARAM);
|
||||
case PROP_QP_MIN_B:
|
||||
update_int (self, &self->qp_min_b, value, UPDATE_RC_PARAM);
|
||||
break;
|
||||
case PROP_MAX_QP_P:
|
||||
update_int (self, &self->max_qp_p, value, UPDATE_RC_PARAM);
|
||||
case PROP_QP_MAX:
|
||||
update_int (self, &self->qp_max, value, UPDATE_RC_PARAM);
|
||||
break;
|
||||
case PROP_MAX_QP_B:
|
||||
update_int (self, &self->max_qp_b, value, UPDATE_RC_PARAM);
|
||||
case PROP_QP_MAX_I:
|
||||
update_int (self, &self->qp_max_i, value, UPDATE_RC_PARAM);
|
||||
break;
|
||||
case PROP_QP_MAX_P:
|
||||
update_int (self, &self->qp_max_p, value, UPDATE_RC_PARAM);
|
||||
break;
|
||||
case PROP_QP_MAX_B:
|
||||
update_int (self, &self->qp_max_b, value, UPDATE_RC_PARAM);
|
||||
break;
|
||||
case PROP_CONST_QUALITY:
|
||||
update_double (self, &self->const_quality, value, UPDATE_RC_PARAM);
|
||||
|
@ -901,14 +931,17 @@ gst_nv_h265_encoder_get_property (GObject * object, guint prop_id,
|
|||
case PROP_RATE_CONTROL:
|
||||
g_value_set_enum (value, self->rc_mode);
|
||||
break;
|
||||
case PROP_QP_I:
|
||||
g_value_set_int (value, self->qp_i);
|
||||
case PROP_QP_CONST:
|
||||
g_value_set_int (value, self->qp_const);
|
||||
break;
|
||||
case PROP_QP_P:
|
||||
g_value_set_int (value, self->qp_p);
|
||||
case PROP_QP_CONST_I:
|
||||
g_value_set_int (value, self->qp_const_i);
|
||||
break;
|
||||
case PROP_QP_B:
|
||||
g_value_set_int (value, self->qp_b);
|
||||
case PROP_QP_CONST_P:
|
||||
g_value_set_int (value, self->qp_const_p);
|
||||
break;
|
||||
case PROP_QP_CONST_B:
|
||||
g_value_set_int (value, self->qp_const_b);
|
||||
break;
|
||||
case PROP_BITRATE:
|
||||
g_value_set_uint (value, self->bitrate);
|
||||
|
@ -934,7 +967,7 @@ gst_nv_h265_encoder_get_property (GObject * object, guint prop_id,
|
|||
case PROP_TEMPORAL_AQ:
|
||||
g_value_set_boolean (value, self->temporal_aq);
|
||||
break;
|
||||
case PROP_ZERO_REORDER_DELAY:
|
||||
case PROP_ZEROLATENCY:
|
||||
g_value_set_boolean (value, self->zero_reorder_delay);
|
||||
break;
|
||||
case PROP_NON_REF_P:
|
||||
|
@ -946,23 +979,29 @@ gst_nv_h265_encoder_get_property (GObject * object, guint prop_id,
|
|||
case PROP_AQ_STRENGTH:
|
||||
g_value_set_uint (value, self->aq_strength);
|
||||
break;
|
||||
case PROP_MIN_QP_I:
|
||||
g_value_set_int (value, self->min_qp_i);
|
||||
case PROP_QP_MIN:
|
||||
g_value_set_int (value, self->qp_min);
|
||||
break;
|
||||
case PROP_MIN_QP_P:
|
||||
g_value_set_int (value, self->min_qp_p);
|
||||
case PROP_QP_MIN_I:
|
||||
g_value_set_int (value, self->qp_min_i);
|
||||
break;
|
||||
case PROP_MIN_QP_B:
|
||||
g_value_set_int (value, self->min_qp_b);
|
||||
case PROP_QP_MIN_P:
|
||||
g_value_set_int (value, self->qp_min_p);
|
||||
break;
|
||||
case PROP_MAX_QP_I:
|
||||
g_value_set_int (value, self->max_qp_i);
|
||||
case PROP_QP_MIN_B:
|
||||
g_value_set_int (value, self->qp_min_b);
|
||||
break;
|
||||
case PROP_MAX_QP_P:
|
||||
g_value_set_int (value, self->max_qp_p);
|
||||
case PROP_QP_MAX:
|
||||
g_value_set_int (value, self->qp_max);
|
||||
break;
|
||||
case PROP_MAX_QP_B:
|
||||
g_value_set_int (value, self->max_qp_b);
|
||||
case PROP_QP_MAX_I:
|
||||
g_value_set_int (value, self->qp_max_i);
|
||||
break;
|
||||
case PROP_QP_MAX_P:
|
||||
g_value_set_int (value, self->qp_max_p);
|
||||
break;
|
||||
case PROP_QP_MAX_B:
|
||||
g_value_set_int (value, self->qp_max_b);
|
||||
break;
|
||||
case PROP_CONST_QUALITY:
|
||||
g_value_set_double (value, self->const_quality);
|
||||
|
@ -1331,31 +1370,41 @@ gst_nv_h265_encoder_set_format (GstNvEncoder * encoder,
|
|||
if (self->vbv_buffer_size)
|
||||
rc_params->vbvBufferSize = self->vbv_buffer_size * 1024;
|
||||
|
||||
if (self->min_qp_i >= 0) {
|
||||
if (self->qp_min >= 0) {
|
||||
rc_params->enableMinQP = TRUE;
|
||||
rc_params->minQP.qpIntra = self->min_qp_i;
|
||||
if (self->min_qp_p >= 0) {
|
||||
rc_params->minQP.qpInterP = self->min_qp_p;
|
||||
rc_params->minQP.qpIntra = self->qp_min;
|
||||
rc_params->minQP.qpInterP = self->qp_min;
|
||||
rc_params->minQP.qpInterB = self->qp_min;
|
||||
} else if (self->qp_min_i >= 0) {
|
||||
rc_params->enableMinQP = TRUE;
|
||||
rc_params->minQP.qpIntra = self->qp_min_i;
|
||||
if (self->qp_min_p >= 0) {
|
||||
rc_params->minQP.qpInterP = self->qp_min_p;
|
||||
} else {
|
||||
rc_params->minQP.qpInterP = rc_params->minQP.qpIntra;
|
||||
}
|
||||
if (self->min_qp_b >= 0) {
|
||||
rc_params->minQP.qpInterB = self->min_qp_b;
|
||||
if (self->qp_min_b >= 0) {
|
||||
rc_params->minQP.qpInterB = self->qp_min_b;
|
||||
} else {
|
||||
rc_params->minQP.qpInterB = rc_params->minQP.qpInterP;
|
||||
}
|
||||
}
|
||||
|
||||
if (self->max_qp_i >= 0) {
|
||||
if (self->qp_max >= 0) {
|
||||
rc_params->enableMaxQP = TRUE;
|
||||
rc_params->maxQP.qpIntra = self->max_qp_i;
|
||||
if (self->max_qp_p >= 0) {
|
||||
rc_params->maxQP.qpInterP = self->max_qp_p;
|
||||
rc_params->maxQP.qpIntra = self->qp_min;
|
||||
rc_params->maxQP.qpInterP = self->qp_min;
|
||||
rc_params->maxQP.qpInterB = self->qp_min;
|
||||
} else if (self->qp_max_i >= 0) {
|
||||
rc_params->enableMaxQP = TRUE;
|
||||
rc_params->maxQP.qpIntra = self->qp_max_i;
|
||||
if (self->qp_max_p >= 0) {
|
||||
rc_params->maxQP.qpInterP = self->qp_max_p;
|
||||
} else {
|
||||
rc_params->maxQP.qpInterP = rc_params->maxQP.qpIntra;
|
||||
}
|
||||
if (self->max_qp_b >= 0) {
|
||||
rc_params->maxQP.qpInterB = self->max_qp_b;
|
||||
if (self->qp_max_b >= 0) {
|
||||
rc_params->maxQP.qpInterB = self->qp_max_b;
|
||||
} else {
|
||||
rc_params->maxQP.qpInterB = rc_params->maxQP.qpInterP;
|
||||
}
|
||||
|
@ -1365,12 +1414,18 @@ gst_nv_h265_encoder_set_format (GstNvEncoder * encoder,
|
|||
&rc_params->rateControlMode, &rc_params->multiPass);
|
||||
|
||||
if (rc_params->rateControlMode == NV_ENC_PARAMS_RC_CONSTQP) {
|
||||
if (self->qp_i >= 0)
|
||||
rc_params->constQP.qpIntra = self->qp_i;
|
||||
if (self->qp_p >= 0)
|
||||
rc_params->constQP.qpInterP = self->qp_p;
|
||||
if (self->qp_b >= 0)
|
||||
rc_params->constQP.qpInterB = self->qp_b;
|
||||
if (self->qp_const >= 0) {
|
||||
rc_params->constQP.qpIntra = self->qp_const;
|
||||
rc_params->constQP.qpInterP = self->qp_const;
|
||||
rc_params->constQP.qpInterB = self->qp_const;
|
||||
} else {
|
||||
if (self->qp_const_i >= 0)
|
||||
rc_params->constQP.qpIntra = self->qp_const_i;
|
||||
if (self->qp_const_p >= 0)
|
||||
rc_params->constQP.qpInterP = self->qp_const_p;
|
||||
if (self->qp_const_b >= 0)
|
||||
rc_params->constQP.qpInterB = self->qp_const_b;
|
||||
}
|
||||
}
|
||||
|
||||
if (self->spatial_aq) {
|
||||
|
|
Loading…
Reference in a new issue