summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHe Junyan <junyan.he@hotmail.com>2019-04-03 14:12:23 +0800
committerVíctor Manuel Jáquez Leal <vjaquez@igalia.com>2019-04-10 14:59:23 +0200
commit5b1fe9c68afcdd956dea6c43db529eb546cc1eb3 (patch)
tree5172e73f82c964ead9b8bc6456308284b3f2afa7
parentd4bc0cb6da56091945e771bddd52e81f28b11688 (diff)
libs: encoder: h264,h265: Set max_qp if min_qp is non-zero.
media-driver currently fails to set a correct value of max_qp when min_qp is different to zero, in CBR and VBR mode, generating full quality frames, thus unexpected huge output. This patch sets max_qp to an arbitrary value to avoid this output temporary. Fixes: #144
-rw-r--r--gst-libs/gst/vaapi/gstvaapiencoder_h264.c4
-rw-r--r--gst-libs/gst/vaapi/gstvaapiencoder_h264_fei.c4
-rw-r--r--gst-libs/gst/vaapi/gstvaapiencoder_h265.c4
3 files changed, 12 insertions, 0 deletions
diff --git a/gst-libs/gst/vaapi/gstvaapiencoder_h264.c b/gst-libs/gst/vaapi/gstvaapiencoder_h264.c
index e6947204..b87f420e 100644
--- a/gst-libs/gst/vaapi/gstvaapiencoder_h264.c
+++ b/gst-libs/gst/vaapi/gstvaapiencoder_h264.c
@@ -2519,6 +2519,10 @@ 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;
+ /* @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;
#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 1ed8255a..7bb95200 100644
--- a/gst-libs/gst/vaapi/gstvaapiencoder_h264_fei.c
+++ b/gst-libs/gst/vaapi/gstvaapiencoder_h264_fei.c
@@ -2449,6 +2449,10 @@ 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;
+ /* @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;
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 a2e61d80..4290ad37 100644
--- a/gst-libs/gst/vaapi/gstvaapiencoder_h265.c
+++ b/gst-libs/gst/vaapi/gstvaapiencoder_h265.c
@@ -1858,6 +1858,10 @@ 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;
+ /* @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;
#if VA_CHECK_VERSION(1,0,0)
GST_VAAPI_ENCODER_VA_RATE_CONTROL (encoder).rc_flags.bits.mb_rate_control =