video-info: Don't assume colorimetry of UHD resolution as BT.2020

BT.2020 color primaries are designed to cover much wider range of
CIE chromaticity than BT.709, and also it's used for both SDR and HDR
contents. So, the incorrect assumption (i.e., BT.709 as a BT.2020)
is risky and resulting image color tends to be visually very wrong.
Unless there's obvious clue, don't consider color space of high resolution
video stream as BT.2020

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1445>
This commit is contained in:
Seungha Yang 2021-12-13 16:19:44 +09:00 committed by GStreamer Marge Bot
parent abd61732bf
commit 11791f7ce5

View file

@ -150,7 +150,6 @@ gst_video_info_init (GstVideoInfo * info)
#define DEFAULT_RGB 2
#define DEFAULT_GRAY 3
#define DEFAULT_UNKNOWN 4
#define DEFAULT_YUV_UHD 5
static const GstVideoColorimetry default_color[] = {
MAKE_COLORIMETRY (_16_235, BT601, BT601, SMPTE170M),
@ -158,7 +157,6 @@ static const GstVideoColorimetry default_color[] = {
MAKE_COLORIMETRY (_0_255, RGB, SRGB, BT709),
MAKE_COLORIMETRY (_0_255, BT601, UNKNOWN, UNKNOWN),
MAKE_COLORIMETRY (_UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN),
MAKE_COLORIMETRY (_16_235, BT2020, BT2020_12, BT2020),
};
static void
@ -167,10 +165,7 @@ set_default_colorimetry (GstVideoInfo * info)
const GstVideoFormatInfo *finfo = info->finfo;
if (GST_VIDEO_FORMAT_INFO_IS_YUV (finfo)) {
if (info->height >= 2160) {
info->chroma_site = GST_VIDEO_CHROMA_SITE_H_COSITED;
info->colorimetry = default_color[DEFAULT_YUV_UHD];
} else if (info->height > 576) {
if (info->height > 576) {
info->chroma_site = GST_VIDEO_CHROMA_SITE_H_COSITED;
info->colorimetry = default_color[DEFAULT_YUV_HD];
} else {