summaryrefslogtreecommitdiff
path: root/gst-libs/gst/vaapi/gstvaapiencoder_priv.h
diff options
context:
space:
mode:
authorSreerenj Balachandran <sreerenj.balachandran@intel.com>2017-04-19 13:04:44 -0700
committerVíctor Manuel Jáquez Leal <vjaquez@igalia.com>2017-05-11 11:51:56 +0200
commit4f343f82e3e9051b3d5759290c1a9aa418d8559d (patch)
treeb71378122b8579243985636c26f88b683e8a06f9 /gst-libs/gst/vaapi/gstvaapiencoder_priv.h
parent10eb6efb30c0fde968ba0bacdd032219a2c485be (diff)
encoders: add quality level tuning
This patch adds the handling of VAEncMiscParameterTypeQualityLevel, in gstreamer-vaapi encoders: The encoding quality could be set through this structure, if the implementation supports multiple quality levels. The quality level set through this structure is persistent over the entire coded sequence, or until a new structure is being sent. The quality level range can be queried through the VAConfigAttribEncQualityRange attribute. A lower value means higher quality, and a value of 1 represents the highest quality. The quality level setting is used as a trade-off between quality and speed/power consumption, with higher quality corresponds to lower speed and higher power consumption. The quality level is set by the element's parameter "quality-level" with a hard-coded range of 1 to 8. Later, when the encoder is configured in run time, just before start processing, the quality level is scaled to the codec range. If VAConfigAttribEncQualityRange is not available in the used VA backend, then the quality level is set to zero, which means "disabled". All the available codecs now process this parameter if it is available. https://bugzilla.gnome.org/show_bug.cgi?id=778733 Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
Diffstat (limited to 'gst-libs/gst/vaapi/gstvaapiencoder_priv.h')
-rw-r--r--gst-libs/gst/vaapi/gstvaapiencoder_priv.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/gst-libs/gst/vaapi/gstvaapiencoder_priv.h b/gst-libs/gst/vaapi/gstvaapiencoder_priv.h
index 5cf748a7..a80ba76f 100644
--- a/gst-libs/gst/vaapi/gstvaapiencoder_priv.h
+++ b/gst-libs/gst/vaapi/gstvaapiencoder_priv.h
@@ -164,6 +164,17 @@ G_BEGIN_DECLS
#define GST_VAAPI_ENCODER_TUNE(encoder) \
(GST_VAAPI_ENCODER_CAST (encoder)->tune)
+/**
+ * GST_VAAPI_ENCODER_QUALITY_LEVEL:
+ * @encoder: a #GstVaapiEncoder
+ *
+ * Macro that evaluates to the quality level
+ * This is an internal macro that does not do any run-time type check.
+ */
+#undef GST_VAAPI_ENCODER_QUALITY_LEVEL
+#define GST_VAAPI_ENCODER_QUALITY_LEVEL(encoder) \
+ (GST_VAAPI_ENCODER_CAST (encoder)->quality_level)
+
/* Generate a mask for the supplied tuning option (internal) */
#define GST_VAAPI_ENCODER_TUNE_MASK(TUNE) \
(1U << G_PASTE (GST_VAAPI_ENCODER_TUNE_, TUNE))
@@ -216,6 +227,7 @@ struct _GstVaapiEncoder
guint32 rate_control_mask;
guint bitrate; /* kbps */
guint keyframe_period;
+ guint quality_level;
GMutex mutex;
GCond surface_free;
@@ -340,6 +352,11 @@ gst_vaapi_encoder_release_surface (GstVaapiEncoder * encoder,
gst_vaapi_surface_proxy_unref (proxy);
}
+G_GNUC_INTERNAL
+gboolean
+gst_vaapi_encoder_ensure_param_quality_level (GstVaapiEncoder * encoder,
+ GstVaapiEncPicture * picture);
+
G_END_DECLS
#endif /* GST_VAAPI_ENCODER_PRIV_H */