mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-10 03:19:40 +00:00
encoder: h264: Add support of low power/high performance encoding mode
Added a new property "low-power-enc" for enabling low power encoding mode. Certain encoding tools may not be available with the VAEntrypointEncSliceLP. https://bugzilla.gnome.org/show_bug.cgi?id=766050
This commit is contained in:
parent
8c1cfbaa1e
commit
32ee78bc52
3 changed files with 31 additions and 5 deletions
|
@ -604,10 +604,10 @@ set_context_info (GstVaapiEncoder * encoder)
|
|||
|
||||
cip->usage = GST_VAAPI_CONTEXT_USAGE_ENCODE;
|
||||
cip->profile = encoder->profile;
|
||||
cip->entrypoint = GST_VAAPI_ENTRYPOINT_SLICE_ENCODE;
|
||||
if (cdata->codec != GST_VAAPI_CODEC_JPEG)
|
||||
cip->entrypoint = GST_VAAPI_ENTRYPOINT_SLICE_ENCODE;
|
||||
else
|
||||
if (cdata->codec != GST_VAAPI_CODEC_JPEG) {
|
||||
if (cip->entrypoint != GST_VAAPI_ENTRYPOINT_SLICE_ENCODE_LP)
|
||||
cip->entrypoint = GST_VAAPI_ENTRYPOINT_SLICE_ENCODE;
|
||||
} else
|
||||
cip->entrypoint = GST_VAAPI_ENTRYPOINT_PICTURE_ENCODE;
|
||||
cip->chroma_type = gst_vaapi_video_format_get_chroma_type (format);
|
||||
cip->width = GST_VAAPI_ENCODER_WIDTH (encoder);
|
||||
|
|
|
@ -745,6 +745,7 @@ struct _GstVaapiEncoderH264
|
|||
|
||||
GstVaapiProfile profile;
|
||||
GstVaapiLevelH264 level;
|
||||
GstVaapiEntrypoint entrypoint;
|
||||
guint8 profile_idc;
|
||||
guint8 max_profile_idc;
|
||||
guint8 hw_max_profile_idc;
|
||||
|
@ -758,6 +759,7 @@ struct _GstVaapiEncoderH264
|
|||
guint32 mb_height;
|
||||
gboolean use_cabac;
|
||||
gboolean use_dct8x8;
|
||||
gboolean enable_lp;
|
||||
GstClockTime cts_offset;
|
||||
gboolean config_changed;
|
||||
|
||||
|
@ -1071,6 +1073,11 @@ ensure_hw_profile (GstVaapiEncoderH264 * encoder)
|
|||
GstVaapiProfile profile, profiles[4];
|
||||
guint i, num_profiles = 0;
|
||||
|
||||
if (encoder->enable_lp)
|
||||
entrypoint = GST_VAAPI_ENTRYPOINT_SLICE_ENCODE_LP;
|
||||
|
||||
encoder->entrypoint = entrypoint;
|
||||
|
||||
profiles[num_profiles++] = encoder->profile;
|
||||
switch (encoder->profile) {
|
||||
case GST_VAAPI_PROFILE_H264_CONSTRAINED_BASELINE:
|
||||
|
@ -2777,6 +2784,8 @@ set_context_info (GstVaapiEncoder * base_encoder)
|
|||
base_encoder->codedbuf_size += encoder->num_slices * (4 +
|
||||
GST_ROUND_UP_8 (MAX_SLICE_HDR_SIZE) / 8);
|
||||
|
||||
base_encoder->context_info.entrypoint = encoder->entrypoint;
|
||||
|
||||
return GST_VAAPI_ENCODER_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -2938,6 +2947,9 @@ gst_vaapi_encoder_h264_set_property (GstVaapiEncoder * base_encoder,
|
|||
}
|
||||
break;
|
||||
}
|
||||
case GST_VAAPI_ENCODER_H264_PROP_LP_MODE:
|
||||
encoder->enable_lp = g_value_get_boolean (value);
|
||||
break;
|
||||
default:
|
||||
return GST_VAAPI_ENCODER_STATUS_ERROR_INVALID_PARAMETER;
|
||||
}
|
||||
|
@ -3102,6 +3114,17 @@ gst_vaapi_encoder_h264_get_default_properties (void)
|
|||
"view id values used for mvc encoding", 0, MAX_VIEW_ID, 0,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS),
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
/**
|
||||
* GstVaapiEncoderH264:enable_lp:
|
||||
*
|
||||
* Enable low power/high performace encoding mode.
|
||||
*/
|
||||
GST_VAAPI_ENCODER_PROPERTIES_APPEND (props,
|
||||
GST_VAAPI_ENCODER_H264_PROP_LP_MODE,
|
||||
g_param_spec_boolean ("low-power-enc",
|
||||
"Enable Low Power Encode",
|
||||
"Enable Low Power/High Performace encoding",
|
||||
FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
return props;
|
||||
}
|
||||
|
|
|
@ -48,6 +48,8 @@ typedef struct _GstVaapiEncoderH264 GstVaapiEncoderH264;
|
|||
* in milliseconds (uint).
|
||||
* @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_LP_MODE: Enable Low Power/High Performace
|
||||
* encoding.
|
||||
*
|
||||
* The set of H.264 encoder specific configurable properties.
|
||||
*/
|
||||
|
@ -60,7 +62,8 @@ typedef enum {
|
|||
GST_VAAPI_ENCODER_H264_PROP_DCT8X8 = -6,
|
||||
GST_VAAPI_ENCODER_H264_PROP_CPB_LENGTH = -7,
|
||||
GST_VAAPI_ENCODER_H264_PROP_NUM_VIEWS = -8,
|
||||
GST_VAAPI_ENCODER_H264_PROP_VIEW_IDS = -9
|
||||
GST_VAAPI_ENCODER_H264_PROP_VIEW_IDS = -9,
|
||||
GST_VAAPI_ENCODER_H264_PROP_LP_MODE = -10
|
||||
} GstVaapiEncoderH264Prop;
|
||||
|
||||
GstVaapiEncoder *
|
||||
|
|
Loading…
Reference in a new issue