summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHyunjun Ko <zzoon@igalia.com>2017-08-02 14:53:34 +0900
committerVíctor Manuel Jáquez Leal <vjaquez@igalia.com>2017-08-02 11:20:35 +0200
commitcd6a9736bd289157bb1dbf4358f1439365ce289d (patch)
treef3bcafc31a0889ce941bb4bed44dab09052c4b04
parentec76a9a7e3eb1da58190799c15854897daa2898e (diff)
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
-rw-r--r--gst-libs/gst/vaapi/gstvaapiencoder_h264.c16
-rw-r--r--gst-libs/gst/vaapi/gstvaapiencoder_h264.h2
2 files changed, 18 insertions, 0 deletions
diff --git a/gst-libs/gst/vaapi/gstvaapiencoder_h264.c b/gst-libs/gst/vaapi/gstvaapiencoder_h264.c
index a3824124..34018286 100644
--- a/gst-libs/gst/vaapi/gstvaapiencoder_h264.c
+++ b/gst-libs/gst/vaapi/gstvaapiencoder_h264.c
@@ -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;
@@ -3172,6 +3176,18 @@ gst_vaapi_encoder_h264_get_default_properties (void)
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:
*
* The initial quantizer value.
diff --git a/gst-libs/gst/vaapi/gstvaapiencoder_h264.h b/gst-libs/gst/vaapi/gstvaapiencoder_h264.h
index dec2ea97..181cadec 100644
--- a/gst-libs/gst/vaapi/gstvaapiencoder_h264.h
+++ b/gst-libs/gst/vaapi/gstvaapiencoder_h264.h
@@ -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 *