Skip to content

complex format can have RGB color-matrix

Célestin Marot requested to merge (removed):encoded_colorimetry_validation into main

In some elements, like here in the videodecoder base class, a GstVideoInfo structure is created from the caps of an encoded frame thanks to gst_video_info_from_caps(). If the caps contains information about the colorimetry of the encoded frame and it specifies an RGB (identity) color matrix, gst_video_info_from_caps() issues some warnings:

WARN	video-info video-info.c:196:validate_colorimetry: color matrix RGB is only supported with RGB format, ENCODED is not
WARN	video-info video-info.c:520:gst_video_info_from_caps: invalid colorimetry, using default

and all the colorimetry information is lost... (well, it is still in the caps, but anyone would expect it to also be in the video-info structure).

I am pretty sure that gst_video_info_from_caps() should keep the colorimetry information of the encoded frame as it can be very useful to retrieve the full caps of the original image once it is decoded.

Encoded frames format is set to GST_VIDEO_FORMAT_ENCODED, which has the colorspace flag GST_VIDEO_FORMAT_FLAG_COMPLEX, but not the RGB or YUV flag, which is why validate_colorimetry() fails with the above warning. I think we can say that a "Complex" format can possibly have an associated RGB color-matrix, which is exactly what this very small commit fixes.

Merge request reports