From 83886ced66dd0ae5a962efb2c14fc0a910b60f56 Mon Sep 17 00:00:00 2001 From: Matteo Valdina Date: Thu, 15 Feb 2018 14:55:42 -0600 Subject: [PATCH] libs: encoder: h264,h265: extend max periodic keyframe. Increased max values of periodic key frame for h26x codecs. This allow more fine tunning of encoder that in certian scenario want higher periodic key frame. For example: it doesn't want a key frame each 10 seconds but each 120 seconds. https://bugzilla.gnome.org/show_bug.cgi?id=786320 --- gst-libs/gst/vaapi/gstvaapiencoder.c | 2 +- gst-libs/gst/vaapi/gstvaapiencoder_h264.c | 2 -- gst-libs/gst/vaapi/gstvaapiencoder_h264_fei.c | 5 ----- gst-libs/gst/vaapi/gstvaapiencoder_h265.c | 2 -- gst-libs/gst/vaapi/gstvaapifeienc_h264.c | 5 ----- gst-libs/gst/vaapi/gstvaapifeipak_h264.c | 3 --- gst-libs/gst/vaapi/gstvaapiutils_h26x_priv.h | 3 --- 7 files changed, 1 insertion(+), 21 deletions(-) diff --git a/gst-libs/gst/vaapi/gstvaapiencoder.c b/gst-libs/gst/vaapi/gstvaapiencoder.c index 46d40cf7ef..f0d68997f1 100644 --- a/gst-libs/gst/vaapi/gstvaapiencoder.c +++ b/gst-libs/gst/vaapi/gstvaapiencoder.c @@ -164,7 +164,7 @@ gst_vaapi_encoder_properties_get_default (const GstVaapiEncoderClass * klass) GST_VAAPI_ENCODER_PROP_KEYFRAME_PERIOD, g_param_spec_uint ("keyframe-period", "Keyframe Period", - "Maximal distance between two keyframes (0: auto-calculate)", 1, 300, + "Maximal distance between two keyframes (0: auto-calculate)", 1, G_MAXUINT32, 30, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); /** diff --git a/gst-libs/gst/vaapi/gstvaapiencoder_h264.c b/gst-libs/gst/vaapi/gstvaapiencoder_h264.c index 0c4b8712f0..2355d912f3 100644 --- a/gst-libs/gst/vaapi/gstvaapiencoder_h264.c +++ b/gst-libs/gst/vaapi/gstvaapiencoder_h264.c @@ -2761,8 +2761,6 @@ reset_properties (GstVaapiEncoderH264 * encoder) if (encoder->idr_period < base_encoder->keyframe_period) encoder->idr_period = base_encoder->keyframe_period; - if (encoder->idr_period > MAX_IDR_PERIOD) - encoder->idr_period = MAX_IDR_PERIOD; if (encoder->min_qp > encoder->init_qp) encoder->min_qp = encoder->init_qp; diff --git a/gst-libs/gst/vaapi/gstvaapiencoder_h264_fei.c b/gst-libs/gst/vaapi/gstvaapiencoder_h264_fei.c index 68ef213ad1..a99f780887 100644 --- a/gst-libs/gst/vaapi/gstvaapiencoder_h264_fei.c +++ b/gst-libs/gst/vaapi/gstvaapiencoder_h264_fei.c @@ -58,9 +58,6 @@ gst_vaapi_encoder_h264_fei_ensure_secondary_context (GstVaapiEncoder * /* Define the maximum value for view-id */ #define MAX_VIEW_ID 1023 -/* Define the maximum IDR period */ -#define MAX_IDR_PERIOD 512 - /* Default CPB length (in milliseconds) */ #define DEFAULT_CPB_LENGTH 1500 @@ -2650,8 +2647,6 @@ reset_properties (GstVaapiEncoderH264Fei * encoder) if (encoder->idr_period < base_encoder->keyframe_period) encoder->idr_period = base_encoder->keyframe_period; - if (encoder->idr_period > MAX_IDR_PERIOD) - encoder->idr_period = MAX_IDR_PERIOD; if (encoder->min_qp > encoder->init_qp || (GST_VAAPI_ENCODER_RATE_CONTROL (encoder) == GST_VAAPI_RATECONTROL_CQP && diff --git a/gst-libs/gst/vaapi/gstvaapiencoder_h265.c b/gst-libs/gst/vaapi/gstvaapiencoder_h265.c index 557901fe03..479294e926 100644 --- a/gst-libs/gst/vaapi/gstvaapiencoder_h265.c +++ b/gst-libs/gst/vaapi/gstvaapiencoder_h265.c @@ -2024,8 +2024,6 @@ reset_properties (GstVaapiEncoderH265 * encoder) if (encoder->idr_period < base_encoder->keyframe_period) encoder->idr_period = base_encoder->keyframe_period; - if (encoder->idr_period > MAX_IDR_PERIOD) - encoder->idr_period = MAX_IDR_PERIOD; if (encoder->min_qp > encoder->init_qp) encoder->min_qp = encoder->init_qp; diff --git a/gst-libs/gst/vaapi/gstvaapifeienc_h264.c b/gst-libs/gst/vaapi/gstvaapifeienc_h264.c index 4438a7fc81..c551e62556 100644 --- a/gst-libs/gst/vaapi/gstvaapifeienc_h264.c +++ b/gst-libs/gst/vaapi/gstvaapifeienc_h264.c @@ -49,9 +49,6 @@ /* Define the maximum value for view-id */ #define MAX_VIEW_ID 1023 -/* Define the maximum IDR period */ -#define MAX_IDR_PERIOD 512 - /* Default CPB length (in milliseconds) */ #define DEFAULT_CPB_LENGTH 1500 @@ -1303,8 +1300,6 @@ reset_properties (GstVaapiFeiEncH264 * feienc) if (feienc->idr_period < base_encoder->keyframe_period) feienc->idr_period = base_encoder->keyframe_period; - if (feienc->idr_period > MAX_IDR_PERIOD) - feienc->idr_period = MAX_IDR_PERIOD; if (feienc->min_qp > feienc->init_qp || (GST_VAAPI_ENCODER_RATE_CONTROL (feienc) == GST_VAAPI_RATECONTROL_CQP && diff --git a/gst-libs/gst/vaapi/gstvaapifeipak_h264.c b/gst-libs/gst/vaapi/gstvaapifeipak_h264.c index 7a49f0a9a4..2eddaa64f5 100644 --- a/gst-libs/gst/vaapi/gstvaapifeipak_h264.c +++ b/gst-libs/gst/vaapi/gstvaapifeipak_h264.c @@ -46,9 +46,6 @@ /* Define the maximum value for view-id */ #define MAX_VIEW_ID 1023 -/* Define the maximum IDR period */ -#define MAX_IDR_PERIOD 512 - /* Default CPB length (in milliseconds) */ #define DEFAULT_CPB_LENGTH 1500 diff --git a/gst-libs/gst/vaapi/gstvaapiutils_h26x_priv.h b/gst-libs/gst/vaapi/gstvaapiutils_h26x_priv.h index 3d3e5014ec..23749ea07c 100644 --- a/gst-libs/gst/vaapi/gstvaapiutils_h26x_priv.h +++ b/gst-libs/gst/vaapi/gstvaapiutils_h26x_priv.h @@ -29,9 +29,6 @@ G_BEGIN_DECLS -/* Define the maximum IDR period */ -#define MAX_IDR_PERIOD 512 - /* Default CPB length (in milliseconds) */ #define DEFAULT_CPB_LENGTH 1500