libs: encoder: h264: Add new property "prediction-type"

Adds new property "prediction-type" to select different reference
picture selection modes like hierarchical-p, hierarchical-b etc.

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>

https://bugzilla.gnome.org/show_bug.cgi?id=788918
This commit is contained in:
Sreerenj Balachandran 2016-07-28 15:53:48 +03:00 committed by Víctor Manuel Jáquez Leal
parent dc583452d8
commit ff91d62415
2 changed files with 52 additions and 0 deletions

View file

@ -109,6 +109,38 @@ gst_vaapi_encoder_h264_compliance_mode_type (void)
return gtype;
}
typedef enum
{
GST_VAAPI_ENCODER_H264_PREDICTION_DEFAULT,
GST_VAAPI_ENCODER_H264_PREDICTION_HIERARCHICAL_P,
GST_VAAPI_ENCODER_H264_PREDICTION_HIERARCHICAL_B
} GstVaapiEnoderH264PredictionType;
static GType
gst_vaapi_encoder_h264_prediction_type (void)
{
static GType gtype = 0;
if (gtype == 0) {
static const GEnumValue values[] = {
{GST_VAAPI_ENCODER_H264_PREDICTION_DEFAULT,
"Default encode, prev/next frame as ref ",
"default"},
{GST_VAAPI_ENCODER_H264_PREDICTION_HIERARCHICAL_P,
"Hierarchical P frame encode",
"hierarchical-p"},
{GST_VAAPI_ENCODER_H264_PREDICTION_HIERARCHICAL_B,
"Hierarchical B frame encode",
"hierarchical-b"},
{0, NULL, NULL},
};
gtype =
g_enum_register_static ("GstVaapiEncoderH264PredictionType", values);
}
return gtype;
}
/* only for internal usage, values won't be equal to actual payload type */
typedef enum
{
@ -724,6 +756,7 @@ struct _GstVaapiEncoderH264
gboolean use_dct8x8;
guint temporal_levels; /* Number of temporal levels */
guint temporal_level_div[MAX_TEMPORAL_LEVELS]; /* to find the temporal id */
guint prediction_type;
GstClockTime cts_offset;
gboolean config_changed;
@ -3168,6 +3201,9 @@ gst_vaapi_encoder_h264_set_property (GstVaapiEncoder * base_encoder,
case GST_VAAPI_ENCODER_H264_PROP_TEMPORAL_LEVELS:
encoder->temporal_levels = g_value_get_uint (value);
break;
case GST_VAAPI_ENCODER_H264_PROP_PREDICTION_TYPE:
encoder->prediction_type = g_value_get_enum (value);
break;
default:
return GST_VAAPI_ENCODER_STATUS_ERROR_INVALID_PARAMETER;
@ -3362,6 +3398,20 @@ gst_vaapi_encoder_h264_get_default_properties (void)
MIN_TEMPORAL_LEVELS, MAX_TEMPORAL_LEVELS, MIN_TEMPORAL_LEVELS,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
/**
* GstVaapiEncoderH264:prediction-type:
*
* Select the referece picture selection modes
*/
GST_VAAPI_ENCODER_PROPERTIES_APPEND (props,
GST_VAAPI_ENCODER_H264_PROP_PREDICTION_TYPE,
g_param_spec_enum ("prediction-type",
"RefPic Selection",
"Reference Picture Selection Modes",
gst_vaapi_encoder_h264_prediction_type (),
GST_VAAPI_ENCODER_H264_PREDICTION_DEFAULT,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
/**
* GstVaapiEncoderH264:cpb-length:
*

View file

@ -55,6 +55,7 @@ typedef struct _GstVaapiEncoderH264 GstVaapiEncoderH264;
* @GST_VAAPI_ENCODER_H264_PROP_QP_IP: Difference of QP between I and P frame.
* @GST_VAAPI_ENCODER_H264_PROP_QP_IB: Difference of QP between I and B frame.
* @GST_VAAPI_ENCODER_H264_PROP_TEMPORAL_LEVELS: Number of temporal levels
* @GST_VAAPI_ENCODER_H264_PROP_PREDICTION_TYPE: Reference picture selection modes
*
* The set of H.264 encoder specific configurable properties.
*/
@ -75,6 +76,7 @@ typedef enum {
GST_VAAPI_ENCODER_H264_PROP_QP_IP = -14,
GST_VAAPI_ENCODER_H264_PROP_QP_IB = -15,
GST_VAAPI_ENCODER_H264_PROP_TEMPORAL_LEVELS = -16,
GST_VAAPI_ENCODER_H264_PROP_PREDICTION_TYPE = -17,
} GstVaapiEncoderH264Prop;
GstVaapiEncoder *