libs: encoder: h265: add refs property

Users can provide the number of reference frame by this property,
which is exaclty same as h264.

The value of the property will be considered as the number of
reference picture list0 and will add 1 reference frame more to the
reference picture list1 internally if b-frame encoding.

If the value provided is bigger than the number of refrence frames
supported in the driver, it will be lowered.

The maximum value is aligned to the value of the driver supported now.

https://bugzilla.gnome.org/show_bug.cgi?id=783804
This commit is contained in:
Hyunjun Ko 2017-09-13 11:37:33 +09:00 committed by Víctor Manuel Jáquez Leal
parent f14563759a
commit 3dbf440373
2 changed files with 18 additions and 0 deletions

View file

@ -118,6 +118,7 @@ struct _GstVaapiEncoderH265
guint32 max_pic_order_cnt;
guint32 log2_max_pic_order_cnt;
guint32 idr_num;
guint num_ref_frames;
GstBuffer *vps_data;
GstBuffer *sps_data;
@ -2502,6 +2503,9 @@ gst_vaapi_encoder_h265_set_property (GstVaapiEncoder * base_encoder,
case GST_VAAPI_ENCODER_H265_PROP_CPB_LENGTH:
encoder->cpb_length = g_value_get_uint (value);
break;
case GST_VAAPI_ENCODER_H265_PROP_NUM_REF_FRAMES:
encoder->num_ref_frames = g_value_get_uint (value);
break;
default:
return GST_VAAPI_ENCODER_STATUS_ERROR_INVALID_PARAMETER;
}
@ -2568,6 +2572,18 @@ gst_vaapi_encoder_h265_get_default_properties (void)
"Max B-Frames", "Number of B-frames between I and P", 0, 10, 0,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
/**
* GstVaapiEncoderH265:refs:
*
* The number of reference frames.
* If B frame is encoded, it will add 1 reference frame more.
*/
GST_VAAPI_ENCODER_PROPERTIES_APPEND (props,
GST_VAAPI_ENCODER_H265_PROP_NUM_REF_FRAMES,
g_param_spec_uint ("refs",
"Number of Reference Frames", "Number of reference frames", 1, 3, 1,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
/**
* GstVaapiEncoderH265:init-qp:
*

View file

@ -40,6 +40,7 @@ typedef struct _GstVaapiEncoderH265 GstVaapiEncoderH265;
* @GST_VAAPI_ENCODER_H265_PROP_INIT_QP: Initial quantizer value (uint).
* @GST_VAAPI_ENCODER_H265_PROP_MIN_QP: Minimal quantizer value (uint).
* @GST_VAAPI_ENCODER_H265_PROP_NUM_SLICES: Number of slices per frame (uint).
* @GST_VAAPI_ENCODER_H265_PROP_NUM_REF_FRAMES: Maximum number of reference frames.
* @GST_VAAPI_ENCODER_H265_PROP_CPB_LENGTH: Length of the CPB buffer
* in milliseconds (uint).
*
@ -50,6 +51,7 @@ typedef enum {
GST_VAAPI_ENCODER_H265_PROP_INIT_QP = -2,
GST_VAAPI_ENCODER_H265_PROP_MIN_QP = -3,
GST_VAAPI_ENCODER_H265_PROP_NUM_SLICES = -4,
GST_VAAPI_ENCODER_H265_PROP_NUM_REF_FRAMES = -5,
GST_VAAPI_ENCODER_H265_PROP_CPB_LENGTH = -7
} GstVaapiEncoderH265Prop;