(GST_VAAPI_RATECONTROL_MASK (CQP) | \
GST_VAAPI_RATECONTROL_MASK (CBR) | \
GST_VAAPI_RATECONTROL_MASK (VBR) | \
- GST_VAAPI_RATECONTROL_MASK (VBR_CONSTRAINED))
+ GST_VAAPI_RATECONTROL_MASK (VBR_CONSTRAINED) | \
+ GST_VAAPI_RATECONTROL_MASK (ICQ) | \
+ GST_VAAPI_RATECONTROL_MASK (QVBR))
/* Supported set of tuning options, within this implementation */
#define SUPPORTED_TUNE_OPTIONS \
guint32 num_bframes;
guint32 mb_width;
guint32 mb_height;
+ guint32 quality_factor;
gboolean use_cabac;
gboolean use_dct8x8;
guint temporal_levels; /* Number of temporal levels */
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;
(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));
case GST_VAAPI_RATECONTROL_CBR:
case GST_VAAPI_RATECONTROL_VBR:
case GST_VAAPI_RATECONTROL_VBR_CONSTRAINED:
+ case GST_VAAPI_RATECONTROL_QVBR:
if (!base_encoder->bitrate) {
/* According to the literature and testing, CABAC entropy coding
mode could provide for +10% to +18% improvement in general,
case GST_VAAPI_ENCODER_H264_PROP_MAX_QP:
encoder->max_qp = g_value_get_uint (value);
break;
+ case GST_VAAPI_ENCODER_H264_PROP_QUALITY_FACTOR:
+ encoder->quality_factor = g_value_get_uint (value);
+ break;
default:
return GST_VAAPI_ENCODER_STATUS_ERROR_INVALID_PARAMETER;
gst_vaapi_encoder_h264_compliance_mode_type (),
GST_VAAPI_ENCODER_H264_COMPLIANCE_MODE_STRICT, G_PARAM_READWRITE));
+ /**
+ * GstVaapiEncoderH264:quality_factor:
+ *
+ * quality factor used under ICQ/QVBR bitrate control mode.
+ */
+ GST_VAAPI_ENCODER_PROPERTIES_APPEND (props,
+ GST_VAAPI_ENCODER_H264_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;
}
* @GST_VAAPI_ENCODER_H264_PROP_TEMPORAL_LEVELS: Number of temporal levels
* @GST_VAAPI_ENCODER_H264_PROP_PREDICTION_TYPE: Reference picture selection modes
* @GST_VAAPI_ENCODER_H264_PROP_MAX_QP: Maximal quantizer value (uint).
+ * @GST_VAAPI_ENCODER_H264_PROP_QUALITY_FACTOR: Factor for ICQ/QVBR bitrate control mode.
*
* The set of H.264 encoder specific configurable properties.
*/
GST_VAAPI_ENCODER_H264_PROP_TEMPORAL_LEVELS = -16,
GST_VAAPI_ENCODER_H264_PROP_PREDICTION_TYPE = -17,
GST_VAAPI_ENCODER_H264_PROP_MAX_QP = -18,
+ GST_VAAPI_ENCODER_H264_PROP_QUALITY_FACTOR = -19,
} GstVaapiEncoderH264Prop;
GstVaapiEncoder *
* @GST_VAAPI_RATECONTROL_VBR_CONSTRAINED: Variable bitrate with peak
* rate higher than average bitrate
* @GST_VAAPI_RATECONTROL_MB: Macroblock based rate control
+ * @GST_VAAPI_RATECONTROL_ICQ: Intelligent Constant QP, use
+ * quality_factor to improve subjective quality base on motion
+ * @GST_VAAPI_RATECONTROL_QVBR: Quality defined VBR, use
+ * quality_factor to get good enough quality and save bits
*
* The set of allowed rate control values for #GstVaapiRateControl.
* Note: this is only valid for encoders.
GST_VAAPI_RATECONTROL_VBR,
GST_VAAPI_RATECONTROL_VBR_CONSTRAINED,
GST_VAAPI_RATECONTROL_MB,
+ GST_VAAPI_RATECONTROL_ICQ,
+ GST_VAAPI_RATECONTROL_QVBR,
} GstVaapiRateControl;
/* Define a mask for GstVaapiRateControl */
#if VA_CHECK_VERSION(0,39,1)
case VA_RC_MB:
return "MB";
+#endif
+#if VA_CHECK_VERSION(1,1,0)
+ case VA_RC_ICQ:
+ return "VA_RC_ICQ";
+#endif
+#if VA_CHECK_VERSION(1,3,0)
+ case VA_RC_QVBR:
+ return "VA_RC_QVBR";
#endif
default:
break;
#if VA_CHECK_VERSION(0,39,1)
case GST_VAAPI_RATECONTROL_MB:
return VA_RC_MB;
+#endif
+#if VA_CHECK_VERSION(1,1,0)
+ case GST_VAAPI_RATECONTROL_ICQ:
+ return VA_RC_ICQ;
+#endif
+#if VA_CHECK_VERSION(1,3,0)
+ case GST_VAAPI_RATECONTROL_QVBR:
+ return VA_RC_QVBR;
#endif
}
GST_ERROR ("unsupported GstVaapiRateControl value %u", value);
case VA_RC_MB:
return GST_VAAPI_RATECONTROL_MB;
#endif
+#if VA_CHECK_VERSION(1,1,0)
+ case VA_RC_ICQ:
+ return GST_VAAPI_RATECONTROL_ICQ;
+#endif
+#if VA_CHECK_VERSION(1,3,0)
+ case VA_RC_QVBR:
+ return GST_VAAPI_RATECONTROL_QVBR;
+#endif
+
}
GST_ERROR ("unsupported VA-API Rate Control value %u", value);
return GST_VAAPI_RATECONTROL_NONE;
"Variable bitrate - Constrained", "vbr_constrained"},
{GST_VAAPI_RATECONTROL_MB,
"Macroblock based rate control", "mb"},
+ {GST_VAAPI_RATECONTROL_ICQ,
+ "Constant QP - Intelligent", "icq"},
+ {GST_VAAPI_RATECONTROL_QVBR,
+ "Variable bitrate - Quality defined", "qvbr"},
{0, NULL, NULL},
};