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>
This commit is contained in:
He Junyan 2021-03-22 13:41:13 +08:00
parent d270654c48
commit 993d46bb2f
3 changed files with 7 additions and 1 deletions

View file

@ -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;

View file

@ -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;

View file

@ -266,6 +266,7 @@ struct _GstVaapiEncPicture
guint frame_num;
guint poc;
guint temporal_id;
gboolean has_roi;
};
G_GNUC_INTERNAL