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
@ -254,6 +254,7 @@ gst_d3d11_color_convert_propose_allocation (GstBaseTransform * trans,
|
|||||||
static gboolean
|
static gboolean
|
||||||
gst_d3d11_color_convert_decide_allocation (GstBaseTransform * trans,
|
gst_d3d11_color_convert_decide_allocation (GstBaseTransform * trans,
|
||||||
GstQuery * query);
|
GstQuery * query);
|
||||||
|
static gboolean gst_d3d11_color_convert_start (GstBaseTransform * trans);
|
||||||
|
|
||||||
static GstFlowReturn gst_d3d11_color_convert_transform (GstBaseTransform *
|
static GstFlowReturn gst_d3d11_color_convert_transform (GstBaseTransform *
|
||||||
trans, GstBuffer * inbuf, GstBuffer * outbuf);
|
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);
|
GST_DEBUG_FUNCPTR (gst_d3d11_color_convert_decide_allocation);
|
||||||
trans_class->transform =
|
trans_class->transform =
|
||||||
GST_DEBUG_FUNCPTR (gst_d3d11_color_convert_transform);
|
GST_DEBUG_FUNCPTR (gst_d3d11_color_convert_transform);
|
||||||
|
trans_class->start = GST_DEBUG_FUNCPTR (gst_d3d11_color_convert_start);
|
||||||
|
|
||||||
bfilter_class->set_info =
|
bfilter_class->set_info =
|
||||||
GST_DEBUG_FUNCPTR (gst_d3d11_color_convert_set_info);
|
GST_DEBUG_FUNCPTR (gst_d3d11_color_convert_set_info);
|
||||||
@ -560,11 +562,15 @@ static GstCaps *
|
|||||||
gst_d3d11_color_convert_transform_caps (GstBaseTransform *
|
gst_d3d11_color_convert_transform_caps (GstBaseTransform *
|
||||||
trans, GstPadDirection direction, GstCaps * caps, GstCaps * filter)
|
trans, GstPadDirection direction, GstCaps * caps, GstCaps * filter)
|
||||||
{
|
{
|
||||||
|
GstD3D11ColorConvert *self = GST_D3D11_COLOR_CONVERT (trans);
|
||||||
GstCaps *tmp, *tmp2;
|
GstCaps *tmp, *tmp2;
|
||||||
GstCaps *result;
|
GstCaps *result;
|
||||||
|
|
||||||
/* Get all possible caps that we can transform to */
|
/* Get all possible caps that we can transform to */
|
||||||
|
if (self->can_convert)
|
||||||
tmp = gst_d3d11_color_convert_caps_remove_format_info (caps);
|
tmp = gst_d3d11_color_convert_caps_remove_format_info (caps);
|
||||||
|
else
|
||||||
|
tmp = gst_caps_copy (caps);
|
||||||
|
|
||||||
if (filter) {
|
if (filter) {
|
||||||
tmp2 = gst_caps_intersect_full (filter, tmp, GST_CAPS_INTERSECT_FIRST);
|
tmp2 = gst_caps_intersect_full (filter, tmp, GST_CAPS_INTERSECT_FIRST);
|
||||||
@ -840,6 +846,28 @@ gst_d3d11_color_convert_decide_allocation (GstBaseTransform * trans,
|
|||||||
query);
|
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 */
|
/* from video-converter.c */
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
@ -59,6 +59,7 @@ struct _GstD3D11ColorConvert
|
|||||||
guint num_output_view;
|
guint num_output_view;
|
||||||
|
|
||||||
D3D11_VIEWPORT viewport;
|
D3D11_VIEWPORT viewport;
|
||||||
|
gboolean can_convert;
|
||||||
|
|
||||||
GstD3D11ColorConvertPrivate *priv;
|
GstD3D11ColorConvertPrivate *priv;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user