encoder: h264 : Use "tune=low-power" for enabling lowpower encode

Remove the duplicate property "low-power-enc" and use the
tune property for enabling low power encoding mode.

https://bugzilla.gnome.org/show_bug.cgi?id=766050
This commit is contained in:
Sreerenj Balachandran 2016-05-13 11:44:57 +03:00
parent d446013ae4
commit 43af7c362c
2 changed files with 16 additions and 26 deletions

View file

@ -74,7 +74,8 @@
/* Supported set of tuning options, within this implementation */
#define SUPPORTED_TUNE_OPTIONS \
(GST_VAAPI_ENCODER_TUNE_MASK (NONE) | \
GST_VAAPI_ENCODER_TUNE_MASK (HIGH_COMPRESSION))
GST_VAAPI_ENCODER_TUNE_MASK (HIGH_COMPRESSION) | \
GST_VAAPI_ENCODER_TUNE_MASK (LOW_POWER))
/* Supported set of VA packed headers, within this implementation */
#define SUPPORTED_PACKED_HEADERS \
@ -759,7 +760,6 @@ struct _GstVaapiEncoderH264
guint32 mb_height;
gboolean use_cabac;
gboolean use_dct8x8;
gboolean enable_lp;
GstClockTime cts_offset;
gboolean config_changed;
@ -1069,15 +1069,10 @@ static gboolean
ensure_hw_profile (GstVaapiEncoderH264 * encoder)
{
GstVaapiDisplay *const display = GST_VAAPI_ENCODER_DISPLAY (encoder);
GstVaapiEntrypoint entrypoint = GST_VAAPI_ENTRYPOINT_SLICE_ENCODE;
GstVaapiEntrypoint entrypoint = encoder->entrypoint;
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:
@ -1251,6 +1246,14 @@ ensure_tuning (GstVaapiEncoderH264 * encoder)
case GST_VAAPI_ENCODER_TUNE_HIGH_COMPRESSION:
success = ensure_tuning_high_compression (encoder);
break;
case GST_VAAPI_ENCODER_TUNE_LOW_POWER:
/* Set low-power encode entry point. If hardware doesn't have
* support, it will fail in ensure_hw_profile() in later stage.
* So not duplicating the profile/entrypont query mechanism
* here as a part of optimization */
encoder->entrypoint = GST_VAAPI_ENTRYPOINT_SLICE_ENCODE_LP;
success = TRUE;
break;
default:
success = TRUE;
break;
@ -2398,7 +2401,8 @@ ensure_profile_and_level (GstVaapiEncoderH264 * encoder)
const GstVaapiProfile profile = encoder->profile;
const GstVaapiLevelH264 level = encoder->level;
ensure_tuning (encoder);
if (!ensure_tuning (encoder))
GST_WARNING ("Failed to set some of the tuning option as expected! ");
if (!ensure_profile (encoder) || !ensure_profile_limits (encoder))
return GST_VAAPI_ENCODER_STATUS_ERROR_UNSUPPORTED_PROFILE;
@ -2832,6 +2836,9 @@ gst_vaapi_encoder_h264_init (GstVaapiEncoder * base_encoder)
GST_VAAPI_ENCODER_H264_CAST (base_encoder);
guint32 i;
/* Default encoding entrypoint */
encoder->entrypoint = GST_VAAPI_ENTRYPOINT_SLICE_ENCODE;
/* Multi-view coding information */
encoder->is_mvc = FALSE;
encoder->num_views = 1;
@ -2947,9 +2954,6 @@ 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;
}
@ -3114,17 +3118,6 @@ 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;
}

View file

@ -48,8 +48,6 @@ 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.
*/
@ -63,7 +61,6 @@ typedef enum {
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_LP_MODE = -10
} GstVaapiEncoderH264Prop;
GstVaapiEncoder *