summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorNicolas Dufresne <nicolas.dufresne@collabora.com>2015-11-16 16:23:43 -0500
committerNicolas Dufresne <nicolas.dufresne@collabora.com>2015-11-17 12:27:31 -0500
commitb848c1b6ffd1e508228820a013f94fb445e4777f (patch)
treecfcf2da64083823534f1b2728e22d1d8d6971e1e /ext
parent8bcc733ceca037b1d680ddb21c0317b6f85fab19 (diff)
downloadgstreamer-plugins-good-b848c1b6ffd1e508228820a013f94fb445e4777f.tar.gz
vpxdec: Use threads on multi-core systems
This adds an automatic mode to the threads property of vpxdec in order to use as many threads as there is CPU on the platform. This brings back GStreamer VPX decoding performance closer to what is achieved by other players, including Chromium. https://bugzilla.gnome.org/show_bug.cgi?id=758195
Diffstat (limited to 'ext')
-rw-r--r--ext/vpx/gstvp8dec.c12
-rw-r--r--ext/vpx/gstvp9dec.c12
2 files changed, 16 insertions, 8 deletions
diff --git a/ext/vpx/gstvp8dec.c b/ext/vpx/gstvp8dec.c
index c86cc4c9d..9d90562ce 100644
--- a/ext/vpx/gstvp8dec.c
+++ b/ext/vpx/gstvp8dec.c
@@ -58,7 +58,7 @@ GST_DEBUG_CATEGORY_STATIC (gst_vp8dec_debug);
#define DEFAULT_POST_PROCESSING_FLAGS (VP8_DEBLOCK | VP8_DEMACROBLOCK | VP8_MFQE)
#define DEFAULT_DEBLOCKING_LEVEL 4
#define DEFAULT_NOISE_LEVEL 0
-#define DEFAULT_THREADS 1
+#define DEFAULT_THREADS 0
enum
{
@@ -168,8 +168,8 @@ gst_vp8_dec_class_init (GstVP8DecClass * klass)
g_object_class_install_property (gobject_class, PROP_THREADS,
g_param_spec_uint ("threads", "Max Threads",
- "Maximum number of decoding threads",
- 1, 16, DEFAULT_THREADS, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ "Maximum number of decoding threads (0 = automatic)",
+ 0, 16, DEFAULT_THREADS, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gst_vp8_dec_src_template));
@@ -456,7 +456,11 @@ open_codec (GstVP8Dec * dec, GstVideoCodecFrame * frame)
cfg.w = stream_info.w;
cfg.h = stream_info.h;
- cfg.threads = dec->threads;
+
+ if (dec->threads > 0)
+ cfg.threads = dec->threads;
+ else
+ cfg.threads = g_get_num_processors ();
caps = vpx_codec_get_caps (&vpx_codec_vp8_dx_algo);
diff --git a/ext/vpx/gstvp9dec.c b/ext/vpx/gstvp9dec.c
index 3de5a6412..242cdd40f 100644
--- a/ext/vpx/gstvp9dec.c
+++ b/ext/vpx/gstvp9dec.c
@@ -58,7 +58,7 @@ GST_DEBUG_CATEGORY_STATIC (gst_vp9dec_debug);
#define DEFAULT_POST_PROCESSING_FLAGS (VP8_DEBLOCK | VP8_DEMACROBLOCK)
#define DEFAULT_DEBLOCKING_LEVEL 4
#define DEFAULT_NOISE_LEVEL 0
-#define DEFAULT_THREADS 1
+#define DEFAULT_THREADS 0
enum
{
@@ -168,8 +168,8 @@ gst_vp9_dec_class_init (GstVP9DecClass * klass)
g_object_class_install_property (gobject_class, PROP_THREADS,
g_param_spec_uint ("threads", "Max Threads",
- "Maximum number of decoding threads",
- 1, 16, DEFAULT_THREADS, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ "Maximum number of decoding threads (0 = automatic)",
+ 0, 16, DEFAULT_THREADS, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gst_vp9_dec_src_template));
@@ -449,7 +449,11 @@ open_codec (GstVP9Dec * dec, GstVideoCodecFrame * frame)
cfg.w = stream_info.w;
cfg.h = stream_info.h;
- cfg.threads = dec->threads;
+
+ if (dec->threads > 0)
+ cfg.threads = dec->threads;
+ else
+ cfg.threads = g_get_num_processors ();
caps = vpx_codec_get_caps (&vpx_codec_vp9_dx_algo);