aboutsummaryrefslogtreecommitdiffstats
path: root/parse-base-block.cpp
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil-cisco@xs4all.nl>2021-05-27 13:56:20 +0200
committerHans Verkuil <hverkuil-cisco@xs4all.nl>2021-05-27 13:56:20 +0200
commiteaee00f196ec4081b2a2dfcde71f46b9097e9bf5 (patch)
tree99c89817d4dcfa1711c645bbf356751c04a477bd /parse-base-block.cpp
parente908154d87394de9e84e900162a3035e6c398fb2 (diff)
edid-decode: fail if sRGB is not signalled, but it should
If the chromaticities match those of sRGB, then fail if the sRGB bit is not set. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Diffstat (limited to 'parse-base-block.cpp')
-rw-r--r--parse-base-block.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/parse-base-block.cpp b/parse-base-block.cpp
index 2b1a6e0..6d17282 100644
--- a/parse-base-block.cpp
+++ b/parse-base-block.cpp
@@ -1297,6 +1297,17 @@ void edid_state::detailed_block(const unsigned char *x)
}
}
+/*
+ * The sRGB chromaticities are (x, y):
+ * red: 0.640, 0.330
+ * green: 0.300, 0.600
+ * blue: 0.150, 0.060
+ * white: 0.3127, 0.3290
+ */
+static const unsigned char srgb_chromaticity[10] = {
+ 0xee, 0x91, 0xa3, 0x54, 0x4c, 0x99, 0x26, 0x0f, 0x50, 0x54
+};
+
void edid_state::parse_base_block(const unsigned char *x)
{
time_t the_time;
@@ -1469,20 +1480,13 @@ void edid_state::parse_base_block(const unsigned char *x)
}
if (x[0x18] & 0x04) {
- /*
- * The sRGB chromaticities are (x, y):
- * red: 0.640, 0.330
- * green: 0.300, 0.600
- * blue: 0.150, 0.060
- * white: 0.3127, 0.3290
- */
- static const unsigned char srgb_chromaticity[10] = {
- 0xee, 0x91, 0xa3, 0x54, 0x4c, 0x99, 0x26, 0x0f, 0x50, 0x54
- };
printf(" Default (sRGB) color space is primary color space\n");
if (memcmp(x + 0x19, srgb_chromaticity, sizeof(srgb_chromaticity)))
fail("sRGB is signaled, but the chromaticities do not match.\n");
+ } else if (!memcmp(x + 0x19, srgb_chromaticity, sizeof(srgb_chromaticity))) {
+ fail("The chromaticities match sRGB, but sRGB is not signaled.\n");
}
+
if (base.edid_minor >= 4) {
/* 1.4 always has a preferred timing and this bit means something else. */
has_preferred_timing = true;

Privacy Policy