Commit d61c1e9e authored by Sebastian Dröge's avatar Sebastian Dröge

[MOVED FROM BAD 125/134] vp8dec: Add support for multiple decoding threads

parent 59d906b6
......@@ -62,6 +62,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
enum
{
......@@ -69,7 +70,8 @@ enum
PROP_POST_PROCESSING,
PROP_POST_PROCESSING_FLAGS,
PROP_DEBLOCKING_LEVEL,
PROP_NOISE_LEVEL
PROP_NOISE_LEVEL,
PROP_THREADS
};
#define C_FLAGS(v) ((guint) v)
......@@ -178,6 +180,11 @@ gst_vp8_dec_class_init (GstVP8DecClass * klass)
"Codec/Decoder/Video",
"Decode VP8 video streams", "David Schleef <ds@entropywave.com>");
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));
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gst_vp8_dec_src_template));
gst_element_class_add_pad_template (element_class,
......@@ -236,6 +243,9 @@ gst_vp8_dec_set_property (GObject * object, guint prop_id,
case PROP_NOISE_LEVEL:
dec->noise_level = g_value_get_uint (value);
break;
case PROP_THREADS:
dec->threads = g_value_get_uint (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
......@@ -264,6 +274,9 @@ gst_vp8_dec_get_property (GObject * object, guint prop_id, GValue * value,
case PROP_NOISE_LEVEL:
g_value_set_uint (value, dec->noise_level);
break;
case PROP_THREADS:
g_value_set_uint (value, dec->threads);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
......@@ -384,11 +397,13 @@ open_codec (GstVP8Dec * dec, GstVideoCodecFrame * frame)
int flags = 0;
vpx_codec_stream_info_t stream_info;
vpx_codec_caps_t caps;
vpx_codec_dec_cfg_t cfg;
GstVideoCodecState *state = dec->input_state;
vpx_codec_err_t status;
GstMapInfo minfo;
memset (&stream_info, 0, sizeof (stream_info));
memset (&cfg, 0, sizeof (cfg));
stream_info.sz = sizeof (stream_info);
if (!gst_buffer_map (frame->input_buffer, &minfo, GST_MAP_READ)) {
......@@ -413,6 +428,10 @@ open_codec (GstVP8Dec * dec, GstVideoCodecFrame * frame)
GST_VIDEO_FORMAT_I420, stream_info.w, stream_info.h, state);
gst_vp8_dec_send_tags (dec);
cfg.w = stream_info.w;
cfg.h = stream_info.h;
cfg.threads = dec->threads;
caps = vpx_codec_get_caps (&vpx_codec_vp8_dx_algo);
if (dec->post_processing) {
......@@ -424,7 +443,7 @@ open_codec (GstVP8Dec * dec, GstVideoCodecFrame * frame)
}
status =
vpx_codec_dec_init (&dec->decoder, &vpx_codec_vp8_dx_algo, NULL, flags);
vpx_codec_dec_init (&dec->decoder, &vpx_codec_vp8_dx_algo, &cfg, flags);
if (status != VPX_CODEC_OK) {
GST_ELEMENT_ERROR (dec, LIBRARY, INIT,
("Failed to initialize VP8 decoder"), ("%s",
......
......@@ -66,6 +66,7 @@ struct _GstVP8Dec
enum vp8_postproc_level post_processing_flags;
gint deblocking_level;
gint noise_level;
gint threads;
GstVideoCodecState *input_state;
GstVideoCodecState *output_state;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment