summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHe Junyan <junyan.he@hotmail.com>2019-12-26 16:45:51 +0800
committerVíctor Manuel Jáquez Leal <vjaquez@igalia.com>2020-01-15 09:22:52 +0000
commit6c7d4450109eb00955a49842dbc32609622b3cc1 (patch)
tree04eef94eb791288818486e57a9875d721fb09996
parent9da5196b5a5c1e8a4c5023f8ba9d8e7dad108cd5 (diff)
libs: encoder: h265: Set encoder paramters base on entrypoint.
When the tune is NONE, we now can choose entrypoint freely. So the GST_VAAPI_ENCODER_TUNE macro may not return the correct current entrypoint. We also delay CTU size calculation after entrypoint has been decided.
-rw-r--r--gst-libs/gst/vaapi/gstvaapiencoder_h265.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/gst-libs/gst/vaapi/gstvaapiencoder_h265.c b/gst-libs/gst/vaapi/gstvaapiencoder_h265.c
index c7bfed9e..9407de96 100644
--- a/gst-libs/gst/vaapi/gstvaapiencoder_h265.c
+++ b/gst-libs/gst/vaapi/gstvaapiencoder_h265.c
@@ -1577,7 +1577,7 @@ fill_sequence (GstVaapiEncoderH265 * encoder, GstVaapiEncSequence * sequence)
/* Based on 32x32 CTU (64x64 when using lowpower mode for hardware limitation) */
seq_param->log2_min_luma_coding_block_size_minus3 = 0;
- if (GST_VAAPI_ENCODER_TUNE (encoder) == GST_VAAPI_ENCODER_TUNE_LOW_POWER)
+ if (encoder->entrypoint == GST_VAAPI_ENTRYPOINT_SLICE_ENCODE_LP)
seq_param->log2_diff_max_min_luma_coding_block_size = 3;
else
seq_param->log2_diff_max_min_luma_coding_block_size = 2;
@@ -1677,7 +1677,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
- || GST_VAAPI_ENCODER_TUNE (encoder) == GST_VAAPI_ENCODER_TUNE_LOW_POWER)
+ || encoder->entrypoint == GST_VAAPI_ENTRYPOINT_SLICE_ENCODE_LP)
pic_param->pic_fields.bits.cu_qp_delta_enabled_flag = 1;
/* XXX: Intel's media-driver, when using low-power mode, requires
@@ -1686,7 +1686,7 @@ fill_picture (GstVaapiEncoderH265 * encoder, GstVaapiEncPicture * picture,
*
* For now we assume that on only Intel's media-drivers supports
* H265 low-power */
- if ((GST_VAAPI_ENCODER_TUNE (encoder) == GST_VAAPI_ENCODER_TUNE_LOW_POWER) &&
+ if ((encoder->entrypoint == GST_VAAPI_ENTRYPOINT_SLICE_ENCODE_LP) &&
(pic_param->pic_fields.bits.cu_qp_delta_enabled_flag))
pic_param->diff_cu_qp_delta_depth = 3;
@@ -2605,13 +2605,6 @@ gst_vaapi_encoder_h265_reconfigure (GstVaapiEncoder * base_encoder)
GST_VAAPI_ENCODER_HEIGHT (encoder));
encoder->luma_width = GST_ROUND_UP_16 (luma_width);
encoder->luma_height = GST_ROUND_UP_16 (luma_height);
- if (GST_VAAPI_ENCODER_TUNE (encoder) == GST_VAAPI_ENCODER_TUNE_LOW_POWER) {
- encoder->ctu_width = (encoder->luma_width + 63) / 64;
- encoder->ctu_height = (encoder->luma_height + 63) / 64;
- } else {
- encoder->ctu_width = (encoder->luma_width + 31) / 32;
- encoder->ctu_height = (encoder->luma_height + 31) / 32;
- }
encoder->config_changed = TRUE;
/* Frame Cropping */
if ((GST_VAAPI_ENCODER_WIDTH (encoder) & 15) ||
@@ -2634,6 +2627,15 @@ gst_vaapi_encoder_h265_reconfigure (GstVaapiEncoder * base_encoder)
if (status != GST_VAAPI_ENCODER_STATUS_SUCCESS)
return status;
+ /* Set ctu size based on entrypoint. */
+ if (encoder->entrypoint == GST_VAAPI_ENTRYPOINT_SLICE_ENCODE_LP) {
+ encoder->ctu_width = (encoder->luma_width + 63) / 64;
+ encoder->ctu_height = (encoder->luma_height + 63) / 64;
+ } else {
+ encoder->ctu_width = (encoder->luma_width + 31) / 32;
+ encoder->ctu_height = (encoder->luma_height + 31) / 32;
+ }
+
reset_properties (encoder);
ensure_control_rate_params (encoder);
return set_context_info (base_encoder);