diff options
author | He Junyan <junyan.he@hotmail.com> | 2020-04-15 16:26:55 +0800 |
---|---|---|
committer | Víctor Manuel Jáquez Leal <vjaquez@igalia.com> | 2020-07-27 16:32:49 +0200 |
commit | ee7677211add3dbb8ada038c415373827ecb0721 (patch) | |
tree | ac16f088867b19002c503435487bedb22c7ba84d /gst-libs | |
parent | 5b05e28a55f573492e9b1c5bc981d388bdfe9fbf (diff) |
libs: encoder: h265: Deprecate the low-delay-b property.
In HEVC, P and B definitions are different from AVC: P frames have
just one reference list and so 1 MV, while B frames have two reference
lists and so 2 MVs. No matter B or P, ist reference lists can contain
forward/backward reference. So P and B can both have bi-directions
dependency, the difference is just their reference list
number (i.e. MV number). This is different from the AVC.
The *low delay b mode* refers to a special HEVC mode, in which the
stream just contain I and B frames, without P frames, and all B frames
only have forward direction dependencies (i.e. all inter frames have 2
reference lists but no backward reference in both lists). This is
similar to AVC I/P mode, but changing the P to the forward dependent
B.
The `low-delay-b` property is now just used to simply convert all P
frames to B frames when driver does not support P frames (so both
reference lists have the same references frames). This is a little
different from the meaning of low delay b mode (the two ref lists may
have the different reference frames). And the driver now can report
whether it supports P frames correctly, so there is no need to use
this property and deprecate it.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/284>
Diffstat (limited to 'gst-libs')
-rw-r--r-- | gst-libs/gst/vaapi/gstvaapiencoder_h265.c | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/gst-libs/gst/vaapi/gstvaapiencoder_h265.c b/gst-libs/gst/vaapi/gstvaapiencoder_h265.c index 1530a27e..a4fd43bf 100644 --- a/gst-libs/gst/vaapi/gstvaapiencoder_h265.c +++ b/gst-libs/gst/vaapi/gstvaapiencoder_h265.c @@ -116,7 +116,8 @@ struct _GstVaapiEncoderH265 guint32 quality_factor; GstClockTime cts_offset; gboolean config_changed; - gboolean low_delay_b; + /* Always need two reference lists for inter frame */ + gboolean no_p_frame; guint32 num_tile_cols; guint32 num_tile_rows; /* CTUs start address used in stream pack */ @@ -1873,7 +1874,7 @@ create_and_fill_one_slice (GstVaapiEncoderH265 * encoder, memset (slice_param, 0, sizeof (VAEncSliceParameterBufferHEVC)); slice_param->slice_type = h265_get_slice_type (picture->type); - if (encoder->low_delay_b && slice_param->slice_type == GST_H265_P_SLICE) { + if (encoder->no_p_frame && slice_param->slice_type == GST_H265_P_SLICE) { slice_param->slice_type = GST_H265_B_SLICE; } slice_param->slice_pic_parameter_set_id = 0; @@ -1888,7 +1889,7 @@ create_and_fill_one_slice (GstVaapiEncoderH265 * encoder, slice_param->num_ref_idx_l1_active_minus1 = reflist_1_count - 1; else slice_param->num_ref_idx_l1_active_minus1 = 0; - if (picture->type == GST_VAAPI_PICTURE_TYPE_P && encoder->low_delay_b) + if (picture->type == GST_VAAPI_PICTURE_TYPE_P && encoder->no_p_frame) slice_param->num_ref_idx_l1_active_minus1 = slice_param->num_ref_idx_l0_active_minus1; @@ -1912,7 +1913,7 @@ create_and_fill_one_slice (GstVaapiEncoderH265 * encoder, GST_VAAPI_SURFACE_PROXY_SURFACE_ID (reflist_1[i_ref]->pic); slice_param->ref_pic_list1[i_ref].pic_order_cnt = reflist_1[i_ref]->poc; } - } else if (picture->type == GST_VAAPI_PICTURE_TYPE_P && encoder->low_delay_b) { + } else if (picture->type == GST_VAAPI_PICTURE_TYPE_P && encoder->no_p_frame) { for (; i_ref < reflist_0_count; ++i_ref) { slice_param->ref_pic_list1[i_ref].picture_id = GST_VAAPI_SURFACE_PROXY_SURFACE_ID (reflist_0[i_ref]->pic); @@ -1979,7 +1980,6 @@ add_slice_headers (GstVaapiEncoderH265 * encoder, GstVaapiEncPicture * picture, " CTU num %d", i_slice, encoder->tile_slice_address[i_slice], slice_param->slice_segment_address, slice_param->num_ctu_in_slice); - if (i_slice == encoder->num_slices - 1) slice_param->slice_fields.bits.last_slice_of_pic_flag = 1; @@ -3171,6 +3171,7 @@ gst_vaapi_encoder_h265_init (GstVaapiEncoderH265 * encoder) encoder->conformance_window_flag = 0; encoder->num_slices = 1; + encoder->no_p_frame = FALSE; /* re-ordering list initialize */ reorder_pool = &encoder->reorder_pool; @@ -3263,7 +3264,9 @@ enum ENCODER_H265_PROP_MBBRC, ENCODER_H265_PROP_QP_IP, ENCODER_H265_PROP_QP_IB, +#ifndef GST_REMOVE_DEPRECATED ENCODER_H265_PROP_LOW_DELAY_B, +#endif ENCODER_H265_PROP_MAX_QP, ENCODER_H265_PROP_QUALITY_FACTOR, ENCODER_H265_PROP_NUM_TILE_COLS, @@ -3321,9 +3324,19 @@ gst_vaapi_encoder_h265_set_property (GObject * object, guint prop_id, case ENCODER_H265_PROP_MBBRC: encoder->mbbrc = g_value_get_enum (value); break; +#ifndef GST_REMOVE_DEPRECATED case ENCODER_H265_PROP_LOW_DELAY_B: - encoder->low_delay_b = g_value_get_boolean (value); +#if !VA_CHECK_VERSION(1,9,0) + encoder->no_p_frame = g_value_get_boolean (value); +#else + if (g_value_get_boolean (value) == TRUE) { + GST_WARNING ("Deprecate low-delay-b property. Driver now already" + " has the ability to detect whether supporting P frames. this" + " value should not be set manually and will take no effect."); + } +#endif break; +#endif case ENCODER_H265_PROP_MAX_QP: encoder->max_qp = g_value_get_uint (value); break; @@ -3382,9 +3395,11 @@ gst_vaapi_encoder_h265_get_property (GObject * object, guint prop_id, case ENCODER_H265_PROP_MBBRC: g_value_set_enum (value, encoder->mbbrc); break; +#ifndef GST_REMOVE_DEPRECATED case ENCODER_H265_PROP_LOW_DELAY_B: - g_value_set_boolean (value, encoder->low_delay_b); + g_value_set_boolean (value, encoder->no_p_frame); break; +#endif case ENCODER_H265_PROP_MAX_QP: g_value_set_uint (value, encoder->max_qp); break; @@ -3576,6 +3591,7 @@ gst_vaapi_encoder_h265_class_init (GstVaapiEncoderH265Class * klass) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT | GST_VAAPI_PARAM_ENCODER_EXPOSURE); +#ifndef GST_REMOVE_DEPRECATED /** * GstVaapiEncoderH265:low_delay_b: * @@ -3588,6 +3604,7 @@ gst_vaapi_encoder_h265_class_init (GstVaapiEncoderH265Class * klass) " Enable it when P frames are not supported.", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT | GST_VAAPI_PARAM_ENCODER_EXPOSURE); +#endif /** * GstVaapiEncoderH265:quality_factor: |