mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-19 16:21:17 +00:00
d3d11colorconvert: Disable color conversion with software rasterizer
It's much slower than our CPU based color-converter in most case.
This commit is contained in:
parent
79e88b76da
commit
71ae632b25
2 changed files with 30 additions and 1 deletions
|
@ -254,6 +254,7 @@ gst_d3d11_color_convert_propose_allocation (GstBaseTransform * trans,
|
|||
static gboolean
|
||||
gst_d3d11_color_convert_decide_allocation (GstBaseTransform * trans,
|
||||
GstQuery * query);
|
||||
static gboolean gst_d3d11_color_convert_start (GstBaseTransform * trans);
|
||||
|
||||
static GstFlowReturn gst_d3d11_color_convert_transform (GstBaseTransform *
|
||||
trans, GstBuffer * inbuf, GstBuffer * outbuf);
|
||||
|
@ -456,6 +457,7 @@ gst_d3d11_color_convert_class_init (GstD3D11ColorConvertClass * klass)
|
|||
GST_DEBUG_FUNCPTR (gst_d3d11_color_convert_decide_allocation);
|
||||
trans_class->transform =
|
||||
GST_DEBUG_FUNCPTR (gst_d3d11_color_convert_transform);
|
||||
trans_class->start = GST_DEBUG_FUNCPTR (gst_d3d11_color_convert_start);
|
||||
|
||||
bfilter_class->set_info =
|
||||
GST_DEBUG_FUNCPTR (gst_d3d11_color_convert_set_info);
|
||||
|
@ -560,11 +562,15 @@ static GstCaps *
|
|||
gst_d3d11_color_convert_transform_caps (GstBaseTransform *
|
||||
trans, GstPadDirection direction, GstCaps * caps, GstCaps * filter)
|
||||
{
|
||||
GstD3D11ColorConvert *self = GST_D3D11_COLOR_CONVERT (trans);
|
||||
GstCaps *tmp, *tmp2;
|
||||
GstCaps *result;
|
||||
|
||||
/* Get all possible caps that we can transform to */
|
||||
tmp = gst_d3d11_color_convert_caps_remove_format_info (caps);
|
||||
if (self->can_convert)
|
||||
tmp = gst_d3d11_color_convert_caps_remove_format_info (caps);
|
||||
else
|
||||
tmp = gst_caps_copy (caps);
|
||||
|
||||
if (filter) {
|
||||
tmp2 = gst_caps_intersect_full (filter, tmp, GST_CAPS_INTERSECT_FIRST);
|
||||
|
@ -840,6 +846,28 @@ gst_d3d11_color_convert_decide_allocation (GstBaseTransform * trans,
|
|||
query);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_d3d11_color_convert_start (GstBaseTransform * trans)
|
||||
{
|
||||
GstD3D11BaseFilter *filter = GST_D3D11_BASE_FILTER (trans);
|
||||
GstD3D11ColorConvert *self = GST_D3D11_COLOR_CONVERT (trans);
|
||||
gboolean is_hardware;
|
||||
|
||||
if (!GST_BASE_TRANSFORM_CLASS (parent_class)->start (trans))
|
||||
return FALSE;
|
||||
|
||||
g_object_get (filter->device, "hardware", &is_hardware, NULL);
|
||||
|
||||
if (!is_hardware) {
|
||||
GST_WARNING_OBJECT (trans, "D3D11 device is running on software emulation");
|
||||
self->can_convert = FALSE;
|
||||
} else {
|
||||
self->can_convert = TRUE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* from video-converter.c */
|
||||
typedef struct
|
||||
{
|
||||
|
|
|
@ -59,6 +59,7 @@ struct _GstD3D11ColorConvert
|
|||
guint num_output_view;
|
||||
|
||||
D3D11_VIEWPORT viewport;
|
||||
gboolean can_convert;
|
||||
|
||||
GstD3D11ColorConvertPrivate *priv;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue