[Pkg-gstreamer-commits] [gstreamer-vaapi] 119/176: encoder: h264: support "high-compression" tuning option.

Vincent Cheng vcheng at moszumanska.debian.org
Tue Jun 3 08:09:33 UTC 2014


This is an automated email from the git hooks/post-receive script.

vcheng pushed a commit to branch upstream
in repository gstreamer-vaapi.

commit 7b1233faa8bb12b4ecb2e9e6dcdee72f94b468f4
Author: Gwenole Beauchesne <gwenole.beauchesne at intel.com>
Date:   Mon Jan 13 11:11:25 2014 +0100

    encoder: h264: support "high-compression" tuning option.
    
    Add support for "high-compression" tuning option. First, determine the
    largest supported profile by the hardware. Next, check any target limit
    set by the user. Then, enable each individual coding tool based on the
    resulting profile_idc value to use.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=719696
---
 gst-libs/gst/vaapi/gstvaapiencoder_h264.c | 51 +++++++++++++++++++++++++++++--
 1 file changed, 49 insertions(+), 2 deletions(-)

diff --git a/gst-libs/gst/vaapi/gstvaapiencoder_h264.c b/gst-libs/gst/vaapi/gstvaapiencoder_h264.c
index 7f0362f..0362f84 100644
--- a/gst-libs/gst/vaapi/gstvaapiencoder_h264.c
+++ b/gst-libs/gst/vaapi/gstvaapiencoder_h264.c
@@ -45,8 +45,9 @@
    GST_VAAPI_RATECONTROL_MASK (VBR_CONSTRAINED))
 
 /* Supported set of tuning options, within this implementation */
-#define SUPPORTED_TUNE_OPTIONS \
-  (GST_VAAPI_ENCODER_TUNE_MASK (NONE))
+#define SUPPORTED_TUNE_OPTIONS                          \
+  (GST_VAAPI_ENCODER_TUNE_MASK (NONE) |                 \
+   GST_VAAPI_ENCODER_TUNE_MASK (HIGH_COMPRESSION))
 
 #define GST_VAAPI_ENCODER_H264_NAL_REF_IDC_NONE        0
 #define GST_VAAPI_ENCODER_H264_NAL_REF_IDC_LOW         1
@@ -316,6 +317,50 @@ error_unsupported_level:
   }
 }
 
+/* Enable "high-compression" tuning options */
+static gboolean
+ensure_tuning_high_compression (GstVaapiEncoderH264 * encoder)
+{
+  guint8 profile_idc;
+
+  if (!ensure_hw_profile_limits (encoder))
+    return FALSE;
+
+  profile_idc = encoder->hw_max_profile_idc;
+  if (encoder->max_profile_idc && encoder->max_profile_idc < profile_idc)
+    profile_idc = encoder->max_profile_idc;
+
+  /* Tuning options to enable Main profile */
+  if (profile_idc >= 77) {
+    encoder->use_cabac = TRUE;
+    if (!encoder->num_bframes)
+      encoder->num_bframes = 1;
+  }
+
+  /* Tuning options to enable High profile */
+  if (profile_idc >= 100) {
+    encoder->use_dct8x8 = TRUE;
+  }
+  return TRUE;
+}
+
+/* Ensure tuning options */
+static gboolean
+ensure_tuning (GstVaapiEncoderH264 * encoder)
+{
+  gboolean success;
+
+  switch (GST_VAAPI_ENCODER_TUNE (encoder)) {
+    case GST_VAAPI_ENCODER_TUNE_HIGH_COMPRESSION:
+      success = ensure_tuning_high_compression (encoder);
+      break;
+    default:
+      success = TRUE;
+      break;
+  }
+  return success;
+}
+
 static inline void
 _reset_gop_start (GstVaapiEncoderH264 * encoder)
 {
@@ -1294,6 +1339,8 @@ ensure_misc (GstVaapiEncoderH264 * encoder, GstVaapiEncPicture * picture)
 static GstVaapiEncoderStatus
 ensure_profile_and_level (GstVaapiEncoderH264 * encoder)
 {
+  ensure_tuning (encoder);
+
   if (!ensure_profile (encoder) || !ensure_profile_limits (encoder))
     return GST_VAAPI_ENCODER_STATUS_ERROR_UNSUPPORTED_PROFILE;
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gstreamer/gstreamer-vaapi.git



More information about the Pkg-gstreamer-commits mailing list