Commit 0c11d220 authored by wangfei's avatar wangfei
Browse files

hevc icq/qvbr.

parent 51963b1a
Pipeline #59985 passed with stages
in 27 minutes and 2 seconds
......@@ -40,7 +40,9 @@
#define SUPPORTED_RATECONTROLS \
(GST_VAAPI_RATECONTROL_MASK (CQP) | \
GST_VAAPI_RATECONTROL_MASK (CBR) | \
GST_VAAPI_RATECONTROL_MASK (VBR))
GST_VAAPI_RATECONTROL_MASK (VBR) | \
GST_VAAPI_RATECONTROL_MASK (ICQ) | \
GST_VAAPI_RATECONTROL_MASK (QVBR))
/* Supported set of tuning options, within this implementation */
#define SUPPORTED_TUNE_OPTIONS \
......@@ -111,6 +113,7 @@ struct _GstVaapiEncoderH265
guint32 ctu_height;
guint32 luma_width;
guint32 luma_height;
guint32 quality_factor;
GstClockTime cts_offset;
gboolean config_changed;
gboolean low_delay_b;
......@@ -1871,6 +1874,14 @@ ensure_control_rate_params (GstVaapiEncoderH265 * encoder)
if (GST_VAAPI_ENCODER_RATE_CONTROL (encoder) == GST_VAAPI_RATECONTROL_CQP)
return TRUE;
#if VA_CHECK_VERSION(1,1,0)
if (GST_VAAPI_ENCODER_RATE_CONTROL (encoder) == GST_VAAPI_RATECONTROL_ICQ) {
GST_VAAPI_ENCODER_VA_RATE_CONTROL (encoder).ICQ_quality_factor =
encoder->quality_factor;
return TRUE;
}
#endif
/* RateControl params */
GST_VAAPI_ENCODER_VA_RATE_CONTROL (encoder).bits_per_second =
encoder->bitrate_bits;
......@@ -1889,6 +1900,11 @@ ensure_control_rate_params (GstVaapiEncoderH265 * encoder)
(guint) encoder->mbbrc;
#endif
#if VA_CHECK_VERSION(1,3,0)
GST_VAAPI_ENCODER_VA_RATE_CONTROL (encoder).quality_factor =
encoder->quality_factor;
#endif
/* HRD params */
fill_hrd_params (encoder, &GST_VAAPI_ENCODER_VA_HRD (encoder));
......@@ -2006,6 +2022,7 @@ ensure_bitrate (GstVaapiEncoderH265 * encoder)
switch (GST_VAAPI_ENCODER_RATE_CONTROL (encoder)) {
case GST_VAAPI_RATECONTROL_CBR:
case GST_VAAPI_RATECONTROL_VBR:
case GST_VAAPI_RATECONTROL_QVBR:
if (!base_encoder->bitrate) {
/* FIXME: Provide better estimation */
/* Using a 1/6 compression ratio */
......@@ -2696,6 +2713,9 @@ gst_vaapi_encoder_h265_set_property (GstVaapiEncoder * base_encoder,
case GST_VAAPI_ENCODER_H265_PROP_MAX_QP:
encoder->max_qp = g_value_get_uint (value);
break;
case GST_VAAPI_ENCODER_H265_PROP_QUALITY_FACTOR:
encoder->quality_factor = g_value_get_uint (value);
break;
default:
return GST_VAAPI_ENCODER_STATUS_ERROR_INVALID_PARAMETER;
......@@ -2888,6 +2908,19 @@ gst_vaapi_encoder_h265_get_default_properties (void)
"Transforms P frames into predictive B frames. Enable it when P frames are not supported.",
FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
/**
* GstVaapiEncoderH265:quality_factor:
*
* quality factor used under ICQ/QVBR bitrate control mode.
*/
GST_VAAPI_ENCODER_PROPERTIES_APPEND (props,
GST_VAAPI_ENCODER_H265_PROP_QUALITY_FACTOR,
g_param_spec_uint ("quality-factor",
"Quality factor for ICQ/QVBR",
"quality factor for ICQ/QVBR bitrate control mode"
"(low value means higher-quality, higher value means lower-quality)",
1, 51, 26, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
return props;
}
......
......@@ -48,6 +48,7 @@ typedef struct _GstVaapiEncoderH265 GstVaapiEncoderH265;
* @GST_VAAPI_ENCODER_H265_PROP_QP_IB: Difference of QP between I and B frame.
* @GST_VAAPI_ENCODER_H265_PROP_LOW_DELAY_B: use low delay b feature.
* @GST_VAAPI_ENCODER_H265_PROP_MAX_QP: Maximal quantizer value (uint).
* @GST_VAAPI_ENCODER_H265_PROP_QUALITY_FACTOR: Factor for ICQ/QVBR bitrate control mode.
*
* The set of H.265 encoder specific configurable properties.
*/
......@@ -63,6 +64,7 @@ typedef enum {
GST_VAAPI_ENCODER_H265_PROP_QP_IB = -10,
GST_VAAPI_ENCODER_H265_PROP_LOW_DELAY_B = -11,
GST_VAAPI_ENCODER_H265_PROP_MAX_QP = -12,
GST_VAAPI_ENCODER_H265_PROP_QUALITY_FACTOR = -13,
} GstVaapiEncoderH265Prop;
GstVaapiEncoder *
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment