video-converter: ignore matrix for RGB formats

For RGB formats, the matrix in the colorimetry (conversion from YUV to
RGB) is irrelevant and we should ignore it and assume the identity
transform for everything we do.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=759624
This commit is contained in:
Wim Taymans 2016-01-20 10:02:20 +01:00
parent 1bf18f6f44
commit 83fe1c7705

View file

@ -2128,6 +2128,13 @@ gst_video_converter_new (GstVideoInfo * in_info, GstVideoInfo * out_info,
finfo = gst_video_format_get_info (convert->unpack_format);
convert->unpack_bits = GST_VIDEO_FORMAT_INFO_DEPTH (finfo, 0);
convert->unpack_rgb = GST_VIDEO_FORMAT_INFO_IS_RGB (finfo);
if (convert->unpack_rgb
&& in_info->colorimetry.matrix != GST_VIDEO_COLOR_MATRIX_RGB) {
/* force identity matrix for RGB input */
GST_WARNING ("invalid matrix %d for input RGB format, using RGB",
in_info->colorimetry.matrix);
convert->in_info.colorimetry.matrix = GST_VIDEO_COLOR_MATRIX_RGB;
}
convert->pack_format = out_info->finfo->unpack_format;
finfo = gst_video_format_get_info (convert->pack_format);
@ -2136,6 +2143,13 @@ gst_video_converter_new (GstVideoInfo * in_info, GstVideoInfo * out_info,
convert->pack_pal =
gst_video_format_get_palette (GST_VIDEO_INFO_FORMAT (out_info),
&convert->pack_palsize);
if (convert->pack_rgb
&& out_info->colorimetry.matrix != GST_VIDEO_COLOR_MATRIX_RGB) {
/* force identity matrix for RGB output */
GST_WARNING ("invalid matrix %d for output RGB format, using RGB",
out_info->colorimetry.matrix);
convert->out_info.colorimetry.matrix = GST_VIDEO_COLOR_MATRIX_RGB;
}
if (video_converter_lookup_fastpath (convert))
goto done;