summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVíctor Manuel Jáquez Leal <vjaquez@igalia.com>2019-04-15 19:34:05 +0200
committerVíctor Manuel Jáquez Leal <vjaquez@igalia.com>2019-04-15 19:38:01 +0200
commit029bb3e504d6f89f2517007129b9d53a95f8f6b7 (patch)
treec0616bf582d211154892a28327f82054619f4fa7
parentc0485943701176f201cf45d9dea80903f56ee467 (diff)
libs: encoder: h264,h265: guard VA version for max_qp property
This patch fixes a regression from commit 5b1fe9c6. max_qp, in rate control configuration, appeared in libva release 2.1 (API 1.1), thus it is required to guard the VA API version. Fixes: #150
-rw-r--r--gst-libs/gst/vaapi/gstvaapiencoder_h264.c3
-rw-r--r--gst-libs/gst/vaapi/gstvaapiencoder_h264_fei.c4
-rw-r--r--gst-libs/gst/vaapi/gstvaapiencoder_h265.c3
3 files changed, 10 insertions, 0 deletions
diff --git a/gst-libs/gst/vaapi/gstvaapiencoder_h264.c b/gst-libs/gst/vaapi/gstvaapiencoder_h264.c
index b87f420e..10c407bc 100644
--- a/gst-libs/gst/vaapi/gstvaapiencoder_h264.c
+++ b/gst-libs/gst/vaapi/gstvaapiencoder_h264.c
@@ -2519,10 +2519,13 @@ ensure_control_rate_params (GstVaapiEncoderH264 * encoder)
GST_VAAPI_ENCODER_VA_RATE_CONTROL (encoder).window_size = encoder->cpb_length;
GST_VAAPI_ENCODER_VA_RATE_CONTROL (encoder).initial_qp = encoder->init_qp;
GST_VAAPI_ENCODER_VA_RATE_CONTROL (encoder).min_qp = encoder->min_qp;
+
+#if VA_CHECK_VERSION(1,1,0)
/* @FIXME: should not set this value, should be ignored if set to zero *
* https://github.com/intel/media-driver/issues/587 */
if (encoder->min_qp > 0)
GST_VAAPI_ENCODER_VA_RATE_CONTROL (encoder).max_qp = 51;
+#endif
#if VA_CHECK_VERSION(1,0,0)
GST_VAAPI_ENCODER_VA_RATE_CONTROL (encoder).rc_flags.bits.mb_rate_control =
diff --git a/gst-libs/gst/vaapi/gstvaapiencoder_h264_fei.c b/gst-libs/gst/vaapi/gstvaapiencoder_h264_fei.c
index 7bb95200..91152819 100644
--- a/gst-libs/gst/vaapi/gstvaapiencoder_h264_fei.c
+++ b/gst-libs/gst/vaapi/gstvaapiencoder_h264_fei.c
@@ -2449,10 +2449,14 @@ ensure_misc_params (GstVaapiEncoderH264Fei * encoder,
rate_control->window_size = encoder->cpb_length;
rate_control->initial_qp = encoder->init_qp;
rate_control->min_qp = encoder->min_qp;
+
+#if VA_CHECK_VERSION(1,1,0)
/* @FIXME: should not set this value, should be ignored if set to zero *
* https://github.com/intel/media-driver/issues/587 */
if (rate_control->min_qp > 0)
rate_control->max_qp = 51;
+#endif
+
rate_control->basic_unit_size = 0;
gst_vaapi_enc_picture_add_misc_param (picture, misc);
gst_vaapi_codec_object_replace (&misc, NULL);
diff --git a/gst-libs/gst/vaapi/gstvaapiencoder_h265.c b/gst-libs/gst/vaapi/gstvaapiencoder_h265.c
index 665beeba..01425523 100644
--- a/gst-libs/gst/vaapi/gstvaapiencoder_h265.c
+++ b/gst-libs/gst/vaapi/gstvaapiencoder_h265.c
@@ -1865,10 +1865,13 @@ ensure_control_rate_params (GstVaapiEncoderH265 * encoder)
GST_VAAPI_ENCODER_VA_RATE_CONTROL (encoder).window_size = encoder->cpb_length;
GST_VAAPI_ENCODER_VA_RATE_CONTROL (encoder).initial_qp = encoder->init_qp;
GST_VAAPI_ENCODER_VA_RATE_CONTROL (encoder).min_qp = encoder->min_qp;
+
+#if VA_CHECK_VERSION(1,1,0)
/* @FIXME: should not set this value, should be ignored if set to zero *
* https://github.com/intel/media-driver/issues/587 */
if (encoder->min_qp > 0)
GST_VAAPI_ENCODER_VA_RATE_CONTROL (encoder).max_qp = 51;
+#endif
#if VA_CHECK_VERSION(1,0,0)
GST_VAAPI_ENCODER_VA_RATE_CONTROL (encoder).rc_flags.bits.mb_rate_control =