mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 11:41:09 +00:00
vulkancolorconvert: actually support passthrough correctly
e.g. passthrough of YUV (or RGB) formats should not modify any buffers. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5317>
This commit is contained in:
parent
fcd591c1af
commit
c6b867e470
1 changed files with 41 additions and 0 deletions
|
@ -1113,6 +1113,36 @@ gst_vulkan_color_convert_start (GstBaseTransform * bt)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
vulkan_color_convert_can_passthrough_info (const GstVideoInfo * in,
|
||||
const GstVideoInfo * out)
|
||||
{
|
||||
gint i;
|
||||
|
||||
if (GST_VIDEO_INFO_FORMAT (in) != GST_VIDEO_INFO_FORMAT (out))
|
||||
return FALSE;
|
||||
if (GST_VIDEO_INFO_WIDTH (in) != GST_VIDEO_INFO_WIDTH (out))
|
||||
return FALSE;
|
||||
if (GST_VIDEO_INFO_HEIGHT (in) != GST_VIDEO_INFO_HEIGHT (out))
|
||||
return FALSE;
|
||||
if (GST_VIDEO_INFO_SIZE (in) != GST_VIDEO_INFO_SIZE (out))
|
||||
return FALSE;
|
||||
|
||||
for (i = 0; i < in->finfo->n_planes; i++) {
|
||||
if (in->stride[i] != out->stride[i])
|
||||
return FALSE;
|
||||
if (in->offset[i] != out->offset[i])
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!gst_video_colorimetry_is_equal (&in->colorimetry, &out->colorimetry))
|
||||
return FALSE;
|
||||
if (in->chroma_site != out->chroma_site)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_vulkan_color_convert_set_caps (GstBaseTransform * bt, GstCaps * in_caps,
|
||||
GstCaps * out_caps)
|
||||
|
@ -1120,12 +1150,18 @@ gst_vulkan_color_convert_set_caps (GstBaseTransform * bt, GstCaps * in_caps,
|
|||
GstVulkanVideoFilter *vfilter = GST_VULKAN_VIDEO_FILTER (bt);
|
||||
GstVulkanColorConvert *conv = GST_VULKAN_COLOR_CONVERT (bt);
|
||||
GstVulkanHandle *vert, *frag;
|
||||
gboolean passthrough;
|
||||
int i;
|
||||
|
||||
if (!GST_BASE_TRANSFORM_CLASS (parent_class)->set_caps (bt, in_caps,
|
||||
out_caps))
|
||||
return FALSE;
|
||||
|
||||
passthrough =
|
||||
vulkan_color_convert_can_passthrough_info (&vfilter->in_info,
|
||||
&vfilter->out_info);
|
||||
gst_base_transform_set_passthrough (bt, passthrough);
|
||||
|
||||
if (!gst_vulkan_full_screen_quad_set_info (conv->quad, &vfilter->in_info,
|
||||
&vfilter->out_info))
|
||||
return FALSE;
|
||||
|
@ -1135,6 +1171,11 @@ gst_vulkan_color_convert_set_caps (GstBaseTransform * bt, GstCaps * in_caps,
|
|||
conv->current_shader = NULL;
|
||||
}
|
||||
|
||||
if (passthrough) {
|
||||
conv->current_shader = NULL;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (shader_infos); i++) {
|
||||
if (shader_infos[i].from != GST_VIDEO_INFO_FORMAT (&vfilter->in_info))
|
||||
continue;
|
||||
|
|
Loading…
Reference in a new issue