libs: encoder: h264: add refs property

Users can provide the number of reference frame by this property.

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.

https://bugzilla.gnome.org/show_bug.cgi?id=783803
This commit is contained in:
Hyunjun Ko 2017-08-02 14:53:34 +09:00 committed by Víctor Manuel Jáquez Leal
parent ec76a9a7e3
commit cd6a9736bd
2 changed files with 18 additions and 0 deletions

View file

@ -730,6 +730,7 @@ struct _GstVaapiEncoderH264
guint32 idr_num;
guint8 pic_order_cnt_type;
guint8 delta_pic_order_always_zero_flag;
guint num_ref_frames;
GstBuffer *sps_data;
GstBuffer *subset_sps_data;
@ -3104,6 +3105,9 @@ gst_vaapi_encoder_h264_set_property (GstVaapiEncoder * base_encoder,
case GST_VAAPI_ENCODER_H264_PROP_COMPLIANCE_MODE:
encoder->compliance_mode = g_value_get_enum (value);
break;
case GST_VAAPI_ENCODER_H264_PROP_NUM_REF_FRAMES:
encoder->num_ref_frames = g_value_get_uint (value);
break;
default:
return GST_VAAPI_ENCODER_STATUS_ERROR_INVALID_PARAMETER;
@ -3171,6 +3175,18 @@ gst_vaapi_encoder_h264_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));
/**
* GstVaapiEncoderH264: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_H264_PROP_NUM_REF_FRAMES,
g_param_spec_uint ("refs", "Number of Reference Frames",
"Number of reference frames", 1, 8, 1,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
/**
* GstVaapiEncoderH264:init-qp:
*

View file

@ -49,6 +49,7 @@ typedef struct _GstVaapiEncoderH264 GstVaapiEncoderH264;
* @GST_VAAPI_ENCODER_H264_PROP_NUM_VIEWS: Number of views per frame.
* @GST_VAAPI_ENCODER_H264_PROP_VIEW_IDS: View IDs
* @GST_VAAPI_ENCODER_H264_PROP_COMPLIANCE_MODE: Relax Compliance restrictions
* @GST_VAAPI_ENCODER_H264_PROP_NUM_REF_FRAMES: Maximum number of reference frames.
*
* The set of H.264 encoder specific configurable properties.
*/
@ -64,6 +65,7 @@ typedef enum {
GST_VAAPI_ENCODER_H264_PROP_VIEW_IDS = -9,
GST_VAAPI_ENCODER_H264_PROP_AUD = -10,
GST_VAAPI_ENCODER_H264_PROP_COMPLIANCE_MODE = -11,
GST_VAAPI_ENCODER_H264_PROP_NUM_REF_FRAMES = -12,
} GstVaapiEncoderH264Prop;
GstVaapiEncoder *