diff options
author | He Junyan <junyan.he@intel.com> | 2021-03-22 13:41:13 +0800 |
---|---|---|
committer | He Junyan <junyan.he@intel.com> | 2021-03-22 13:43:01 +0800 |
commit | 993d46bb2ff28169b269e4a9f951539cc2da6f24 (patch) | |
tree | 9c17e52ee2cbe452b4cb417889979cef34c72277 /gst-libs | |
parent | d270654c48c19afc3234e126269bf613540b44d8 (diff) |
decoder: H265: Enable cu_qp_delta_enabled_flag when ROI
If ROI is enabled, the CUs within the ROI region may have different
QP from the other part of the picture. This needs us to enable the
cu_qp_delta_enabled_flag even in the CQP mode.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/419>
Diffstat (limited to 'gst-libs')
-rw-r--r-- | gst-libs/gst/vaapi/gstvaapiencoder.c | 6 | ||||
-rw-r--r-- | gst-libs/gst/vaapi/gstvaapiencoder_h265.c | 1 | ||||
-rw-r--r-- | gst-libs/gst/vaapi/gstvaapiencoder_objects.h | 1 |
3 files changed, 7 insertions, 1 deletions
diff --git a/gst-libs/gst/vaapi/gstvaapiencoder.c b/gst-libs/gst/vaapi/gstvaapiencoder.c index 6c103ace..8ab33ca5 100644 --- a/gst-libs/gst/vaapi/gstvaapiencoder.c +++ b/gst-libs/gst/vaapi/gstvaapiencoder.c @@ -193,6 +193,8 @@ gst_vaapi_encoder_ensure_param_roi_regions (GstVaapiEncoder * encoder, g_quark_to_string (roi->roi_type), roi->id, roi->x, roi->y, roi->w, roi->h); + picture->has_roi = TRUE; + region_roi[i].roi_rectangle.x = roi->x; region_roi[i].roi_rectangle.y = roi->y; region_roi[i].roi_rectangle.width = roi->w; @@ -214,7 +216,9 @@ gst_vaapi_encoder_ensure_param_roi_regions (GstVaapiEncoder * encoder, } } - gst_vaapi_enc_picture_add_misc_param (picture, misc); + if (picture->has_roi) + gst_vaapi_enc_picture_add_misc_param (picture, misc); + gst_vaapi_codec_object_replace (&misc, NULL); #endif return TRUE; diff --git a/gst-libs/gst/vaapi/gstvaapiencoder_h265.c b/gst-libs/gst/vaapi/gstvaapiencoder_h265.c index 46db870c..caec85f0 100644 --- a/gst-libs/gst/vaapi/gstvaapiencoder_h265.c +++ b/gst-libs/gst/vaapi/gstvaapiencoder_h265.c @@ -2033,6 +2033,7 @@ fill_picture (GstVaapiEncoderH265 * encoder, GstVaapiEncPicture * picture, /* it seems driver requires enablement of cu_qp_delta_enabled_flag * to modifiy QP values in CBR mode or low power encoding */ if (GST_VAAPI_ENCODER_RATE_CONTROL (encoder) != GST_VAAPI_RATECONTROL_CQP + || picture->has_roi || encoder->entrypoint == GST_VAAPI_ENTRYPOINT_SLICE_ENCODE_LP) pic_param->pic_fields.bits.cu_qp_delta_enabled_flag = 1; diff --git a/gst-libs/gst/vaapi/gstvaapiencoder_objects.h b/gst-libs/gst/vaapi/gstvaapiencoder_objects.h index 8037c184..49f271dc 100644 --- a/gst-libs/gst/vaapi/gstvaapiencoder_objects.h +++ b/gst-libs/gst/vaapi/gstvaapiencoder_objects.h @@ -266,6 +266,7 @@ struct _GstVaapiEncPicture guint frame_num; guint poc; guint temporal_id; + gboolean has_roi; }; G_GNUC_INTERNAL |