mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 14:26:43 +00:00
vp9enc: expose row-mt property
With recent libvpx versions, multithreading can be enabled on a per-tile basis, instead of on a per tile-column basis. In combination with the new tile-rows property, this allows the encoder to make much better use of the available CPU power. Bump minimum libvpx version to 1.7.0 Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/707>
This commit is contained in:
parent
fe6b59d0cc
commit
39fcc7f58f
4 changed files with 55 additions and 1 deletions
|
@ -25885,6 +25885,18 @@
|
|||
}
|
||||
},
|
||||
"properties": {
|
||||
"row-mt": {
|
||||
"blurb": "Whether each row should be encoded using multiple threads",
|
||||
"conditionally-available": false,
|
||||
"construct": false,
|
||||
"construct-only": false,
|
||||
"controllable": false,
|
||||
"default": "false",
|
||||
"mutable": "null",
|
||||
"readable": true,
|
||||
"type": "gboolean",
|
||||
"writable": true
|
||||
},
|
||||
"tile-columns": {
|
||||
"blurb": "Number of tile columns, log2",
|
||||
"conditionally-available": false,
|
||||
|
|
|
@ -70,11 +70,14 @@ GST_DEBUG_CATEGORY_STATIC (gst_vp9enc_debug);
|
|||
|
||||
#define DEFAULT_TILE_COLUMNS 6
|
||||
#define DEFAULT_TILE_ROWS 0
|
||||
#define DEFAULT_ROW_MT 0
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_TILE_COLUMNS,
|
||||
PROP_TILE_ROWS,
|
||||
PROP_ROW_MT,
|
||||
};
|
||||
|
||||
/* FIXME: Y42B do not work yet it seems */
|
||||
|
@ -157,6 +160,19 @@ gst_vp9_enc_class_init (GstVP9EncClass * klass)
|
|||
0, 2, DEFAULT_TILE_ROWS,
|
||||
(GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
|
||||
|
||||
/**
|
||||
* GstVP9Enc:row-mt:
|
||||
*
|
||||
* Whether each row should be encoded using multiple threads
|
||||
*
|
||||
* Since: 1.20
|
||||
*/
|
||||
g_object_class_install_property (gobject_class, PROP_ROW_MT,
|
||||
g_param_spec_boolean ("row-mt", "Row Multithreading",
|
||||
"Whether each row should be encoded using multiple threads",
|
||||
DEFAULT_ROW_MT,
|
||||
(GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
|
||||
|
||||
gst_element_class_add_static_pad_template (element_class,
|
||||
&gst_vp9_enc_src_template);
|
||||
gst_element_class_add_static_pad_template (element_class,
|
||||
|
@ -204,6 +220,7 @@ gst_vp9_enc_init (GstVP9Enc * gst_vp9_enc)
|
|||
|
||||
gst_vp9_enc->tile_columns = DEFAULT_TILE_COLUMNS;
|
||||
gst_vp9_enc->tile_rows = DEFAULT_TILE_ROWS;
|
||||
gst_vp9_enc->row_mt = DEFAULT_ROW_MT;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -243,6 +260,18 @@ gst_vp9_enc_set_property (GObject * object, guint prop_id,
|
|||
}
|
||||
}
|
||||
break;
|
||||
case PROP_ROW_MT:
|
||||
gst_vp9_enc->row_mt = g_value_get_boolean (value);
|
||||
if (gst_vpx_enc->inited) {
|
||||
status =
|
||||
vpx_codec_control (&gst_vpx_enc->encoder, VP9E_SET_ROW_MT,
|
||||
gst_vp9_enc->row_mt ? 1 : 0);
|
||||
if (status != VPX_CODEC_OK) {
|
||||
GST_WARNING_OBJECT (gst_vpx_enc,
|
||||
"Failed to set VP9E_SET_ROW_MT: %s", gst_vpx_error_name (status));
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
|
@ -267,6 +296,9 @@ gst_vp9_enc_get_property (GObject * object, guint prop_id, GValue * value,
|
|||
case PROP_TILE_ROWS:
|
||||
g_value_set_int (value, gst_vp9_enc->tile_rows);
|
||||
break;
|
||||
case PROP_ROW_MT:
|
||||
g_value_set_boolean (value, gst_vp9_enc->row_mt);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
|
@ -296,6 +328,13 @@ gst_vp9_enc_configure_encoder (GstVPXEnc * encoder)
|
|||
GST_DEBUG_OBJECT (encoder, "Failed to set VP9E_SET_TILE_ROWS: %s",
|
||||
gst_vpx_error_name (status));
|
||||
}
|
||||
status =
|
||||
vpx_codec_control (&encoder->encoder, VP9E_SET_ROW_MT,
|
||||
vp9enc->row_mt ? 1 : 0);
|
||||
if (status != VPX_CODEC_OK) {
|
||||
GST_DEBUG_OBJECT (encoder,
|
||||
"Failed to set VP9E_SET_ROW_MT: %s", gst_vpx_error_name (status));
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -47,6 +47,9 @@ struct _GstVP9Enc
|
|||
|
||||
guint tile_columns;
|
||||
guint tile_rows;
|
||||
#ifdef VPX_CTRL_VP9E_SET_ROW_MT
|
||||
gboolean row_mt;
|
||||
#endif
|
||||
};
|
||||
|
||||
G_END_DECLS
|
||||
|
|
|
@ -17,7 +17,7 @@ vpx_features = [
|
|||
]
|
||||
|
||||
vpx_option = get_option('vpx')
|
||||
vpx_dep = dependency('vpx', version : '>=1.5.0', required : vpx_option)
|
||||
vpx_dep = dependency('vpx', version : '>=1.7.0', required : vpx_option)
|
||||
|
||||
if vpx_dep.found()
|
||||
vpx_args = []
|
||||
|
|
Loading…
Reference in a new issue