aboutsummaryrefslogtreecommitdiffstats
path: root/parse-di-ext-block.cpp
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil-cisco@xs4all.nl>2019-12-01 11:45:39 +0100
committerHans Verkuil <hverkuil-cisco@xs4all.nl>2019-12-01 11:45:39 +0100
commitc5f9a59850601449b92c3932d16239d4b81347d1 (patch)
tree5a3aa3199d10513c19c293337955302f59af4134 /parse-di-ext-block.cpp
parent71b0be20420bbebcaf9838933a126fe895a3b25f (diff)
edid-decode: add missing pieces for DI-Ext
This extension is now fully parsed. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Diffstat (limited to 'parse-di-ext-block.cpp')
-rw-r--r--parse-di-ext-block.cpp250
1 files changed, 250 insertions, 0 deletions
diff --git a/parse-di-ext-block.cpp b/parse-di-ext-block.cpp
index 701d117..470e504 100644
--- a/parse-di-ext-block.cpp
+++ b/parse-di-ext-block.cpp
@@ -198,12 +198,262 @@ static void parse_display_caps(edid_state &state, const unsigned char *x)
{
state.cur_block = "Display Capabities & Feature Support Set";
printf("%s\n", state.cur_block.c_str());
+
+ unsigned short v = x[0x14];
+
+ printf(" Legacy Modes: %s VGA/DOS Legacy Timing Modes are supported\n",
+ (v & 0x80) ? "All" : "Not all");
+ printf(" Stereo Video: ");
+ switch ((v & 0x70) >> 4) {
+ case 0x00: printf("No direct stereo\n"); break;
+ case 0x01: printf("Field seq. stereo via stereo sync signal\n"); break;
+ case 0x02: printf("auto-stereoscopic, column interleave\n"); break;
+ case 0x03: printf("auto-stereoscopic, line interleave\n"); break;
+ default:
+ printf("Unknown (0x%02x)\n", (v & 0x70) >> 4);
+ fail("Unknown Stereo Video 0x%02x\n", (v & 0x70) >> 4);
+ break;
+ }
+ printf(" Scaler On Board: %s\n", (v & 0x08) ? "Yes" : "No");
+ printf(" Image Centering: %s\n", (v & 0x04) ? "Yes" : "No");
+ printf(" Conditional Update: %s\n", (v & 0x02) ? "Yes" : "No");
+ printf(" Interlaced Video: %s\n", (v & 0x01) ? "Yes" : "No");
+
+ v = x[0x15];
+ printf(" Frame Lock: %s\n", (v & 0x80) ? "Yes" : "No");
+ printf(" Frame Rate Conversion: ");
+ switch ((v & 0x60) >> 5) {
+ case 0x00: printf("Not supported\n"); break;
+ case 0x01: printf("Vertical is converted to a single frequency\n"); break;
+ case 0x02: printf("Horizontal is convertred to a single frequency\n"); break;
+ case 0x03: printf("Both Vertical & Horizontal are converted to single frequencies\n"); break;
+ }
+ if (v & 0x1f)
+ fail("Bits 4-0 of byte 0x15 should be 0\n");
+ v = x[0x16] | (x[0x17] << 8);
+ printf(" Vertical Frequency: ");
+ if (!v) {
+ printf("Not available\n");
+ } else if (v == 0xffff) {
+ printf("Reserved\n");
+ fail("Vertical Frequency uses 0xffff (reserved value)\n");
+ } else {
+ printf("%.2f kHz\n", v / 100.0);
+ }
+ v = x[0x18] | (x[0x19] << 8);
+ printf(" Horizontal Frequency: ");
+ if (!v) {
+ printf("Not available\n");
+ } else if (v == 0xffff) {
+ printf("Reserved\n");
+ fail("Horizontal Frequency uses 0xffff (reserved value)\n");
+ } else {
+ printf("%.2f kHz\n", v / 100.0);
+ }
+
+ v = x[0x1a];
+ printf(" Display/Scan Orientation Definition Type: ");
+ switch ((v & 0xc0) >> 6) {
+ case 0x00: printf("Not defined\n"); break;
+ case 0x01: printf("Fixed Orientation\n"); break;
+ case 0x02: printf("Pivots: Default Orientation\n"); break;
+ case 0x03: printf("Pivots: Current Orientation (requires multiple EDID Extension Tables)\n"); break;
+ }
+ printf(" Screen Orientation: %s\n",
+ (v & 0x20) ? "Portrait" : "Landscape");
+ printf(" Zero Pixel Location: ");
+ switch ((v & 0x18) >> 3) {
+ case 0x00: printf("Upper Left\n"); break;
+ case 0x01: printf("Upper Right\n"); break;
+ case 0x02: printf("Lower Left\n"); break;
+ case 0x03: printf("Lower Right\n"); break;
+ }
+ printf(" Scan Direction: ");
+ switch ((v & 0x06) >> 1) {
+ case 0x00: printf("Not defined\n"); break;
+ case 0x01: printf("Fast Scan is on the Major (Long) Axis and Slow Scan is on the Minor Axis\n"); break;
+ case 0x02: printf("Fast Scan is on the Minor (Short) Axis and Slow Scan is on the Major Axis\n"); break;
+ case 0x03:
+ printf("Reserved\n");
+ fail("Scan Direction used the reserved value 0x03\n");
+ break;
+ }
+ printf(" Standalone Projector: %s\n",
+ (v & 0x01) ? "Yes" : "No");
+
+ v = x[0x1b];
+ printf(" Default Color/Luminance Decoding: ");
+ switch (v) {
+ case 0x00: printf("Not defined\n"); break;
+ case 0x01: printf("BGR\n"); break;
+ case 0x02: printf("Y/C (S-Video) NTSC\n"); break;
+ case 0x03: printf("Y/C (S-Video) PAL\n"); break;
+ case 0x04: printf("Y/C (S-Video) SECAM\n"); break;
+ case 0x05: printf("YCrCb 4:4:4 per SMPTE 293M & 294M\n"); break;
+ case 0x06: printf("YCrCb 4:2:2 per SMPTE 293M & 294M\n"); break;
+ case 0x07: printf("YCrCb 4:2:0 per SMPTE 293M & 294M\n"); break;
+ case 0x08: printf("YCrCb per SMPTE 260M (Legacy HDTV)\n"); break;
+ case 0x09: printf("YPbPr per SMPTE 240M (Legacy HDTV)\n"); break;
+ case 0x0a: printf("YCrCb per SMPTE 274M (Modern HDTV)\n"); break;
+ case 0x0b: printf("YPbPr per SMPTE 274M (Modern HDTV)\n"); break;
+ case 0x0c: printf("Y B-Y R-Y BetaCam (Sony)\n"); break;
+ case 0x0d: printf("Y B-Y R-Y M-2 (Matsushita)\n"); break;
+ case 0x0e: printf("Monochrome\n"); break;
+ default:
+ printf("Unknown (0x%02x)\n", v);
+ fail("Unknown Default Color/Luminance Decoding 0x%02x\n", v);
+ break;
+ }
+ v = x[0x1c];
+ printf(" Preferred Color/Luminance Decoder: ");
+ switch (v) {
+ case 0x00: printf("Uses Default Decoding\n"); break;
+ case 0x01: printf("BGR\n"); break;
+ case 0x02: printf("Y/C (S-Video)\n"); break;
+ case 0x03: printf("Yxx (SMPTE 2xxM)\n"); break;
+ case 0x04: printf("Monochrome\n"); break;
+ default:
+ printf("Unknown (0x%02x)\n", v);
+ fail("Unknown Preferred Color/Luminance Decoding 0x%02x\n", v);
+ break;
+ }
+ v = x[0x1d];
+ printf(" Color/Luminance Decoding Capabilities:\n");
+ printf(" BGR: %s\n", (v & 0x80) ? "Yes" : "No");
+ printf(" Y/C (S-Video) NTSC: %s\n", (v & 0x40) ? "Yes" : "No");
+ printf(" Y/C (S-Video) PAL: %s\n", (v & 0x20) ? "Yes" : "No");
+ printf(" Y/C (S-Video) SECAM: %s\n", (v & 0x10) ? "Yes" : "No");
+ printf(" YCrCb 4:4:4 per SMPTE 293M & 294M: %s\n", (v & 0x08) ? "Yes" : "No");
+ printf(" YCrCb 4:2:2 per SMPTE 293M & 294M: %s\n", (v & 0x04) ? "Yes" : "No");
+ printf(" YCrCb 4:2:0 per SMPTE 293M & 294M: %s\n", (v & 0x02) ? "Yes" : "No");
+ printf(" YCrCb per SMPTE 260M (Legacy HDTV): %s\n", (v & 0x01) ? "Yes" : "No");
+ v = x[0x1e];
+ printf(" YPbPr per SMPTE 240M (Legacy HDTV): %s\n", (v & 0x80) ? "Yes" : "No");
+ printf(" YCrCb per SMPTE 274M (Modern HDTV): %s\n", (v & 0x40) ? "Yes" : "No");
+ printf(" YPbPr per SMPTE 274M (Modern HDTV): %s\n", (v & 0x20) ? "Yes" : "No");
+ printf(" Y B-Y R-Y BetaCam (Sony): %s\n", (v & 0x10) ? "Yes" : "No");
+ printf(" Y B-Y R-Y M-2 (Matsushita): %s\n", (v & 0x08) ? "Yes" : "No");
+ printf(" Monochrome: %s\n", (v & 0x04) ? "Yes" : "No");
+ if (v & 0x03)
+ fail("Bits 1-0 of byte 0x1e should be 0\n");
+
+ v = x[0x1f];
+ printf(" Dithering: %s\n", (v & 0x80) ? "Yes" : "No");
+ if (v & 0x7f)
+ fail("Bits 6-0 of byte 0x1f should be 0\n");
+ v = x[0x20];
+ printf(" Supported Color Bit-Depth of Sub-Channel 0 (Blue): ");
+ if (!v) {
+ printf("No Information\n");
+ } else if (v <= 16) {
+ printf("%u\n", v);
+ } else {
+ printf("Reserved (0x%02x)\n", v);
+ fail("Supported Color Bit-Depth of Sub-Channel Blue value is 0x%02x\n", v);
+ }
+ v = x[0x21];
+ printf(" Supported Color Bit-Depth of Sub-Channel 1 (Green): ");
+ if (!v) {
+ printf("No Information\n");
+ } else if (v <= 16) {
+ printf("%u\n", v);
+ } else {
+ printf("Reserved (0x%02x)\n", v);
+ fail("Supported Color Bit-Depth of Sub-Channel Green value is 0x%02x\n", v);
+ }
+ v = x[0x22];
+ printf(" Supported Color Bit-Depth of Sub-Channel 2 (Red): ");
+ if (!v) {
+ printf("No Information\n");
+ } else if (v <= 16) {
+ printf("%u\n", v);
+ } else {
+ printf("Reserved (0x%02x)\n", v);
+ fail("Supported Color Bit-Depth of Sub-Channel Red value is 0x%02x\n", v);
+ }
+ v = x[0x23];
+ printf(" Supported Color Bit-Depth of Sub-Channel 0 (Cb/Pb): ");
+ if (!v) {
+ printf("No Information\n");
+ } else if (v <= 16) {
+ printf("%u\n", v);
+ } else {
+ printf("Reserved (0x%02x)\n", v);
+ fail("Supported Color Bit-Depth of Sub-Channel Cb/Pb value is 0x%02x\n", v);
+ }
+ v = x[0x24];
+ printf(" Supported Color Bit-Depth of Sub-Channel 1 (Y): ");
+ if (!v) {
+ printf("No Information\n");
+ } else if (v <= 16) {
+ printf("%u\n", v);
+ } else {
+ printf("Reserved (0x%02x)\n", v);
+ fail("Supported Color Bit-Depth of Sub-Channel Y value is 0x%02x\n", v);
+ }
+ v = x[0x25];
+ printf(" Supported Color Bit-Depth of Sub-Channel 2 (Cr/Pr): ");
+ if (!v) {
+ printf("No Information\n");
+ } else if (v <= 16) {
+ printf("%u\n", v);
+ } else {
+ printf("Reserved (0x%02x)\n", v);
+ fail("Supported Color Bit-Depth of Sub-Channel Cr/Pr value is 0x%02x\n", v);
+ }
+
+ v = x[0x26];
+ printf(" Aspect Ratio Conversion Modes: ");
+ if (!v) {
+ printf("None\n");
+ } else {
+ printf(" Full Mode: %s\n", (v & 0x80) ? "Yes" : "No");
+ printf(" Zoom Mode: %s\n", (v & 0x40) ? "Yes" : "No");
+ printf(" Squeeze (Side Bars/Letterbox) Mode: %s\n", (v & 0x20) ? "Yes" : "No");
+ printf(" Variable (Expand/Shrink) Mode: %s\n", (v & 0x10) ? "Yes" : "No");
+ }
+ if (v & 0x0f)
+ fail("Bits 3-0 of byte 0x26 should be 0\n");
}
static void parse_display_xfer(edid_state &state, const unsigned char *x)
{
state.cur_block = "Display Transfer Characteristics - Gamma";
printf("%s\n", state.cur_block.c_str());
+
+ unsigned char v = x[0x51];
+ unsigned num_entries = v & 0x3f;
+
+ switch ((v & 0xc0) >> 6) {
+ case 0x00:
+ printf(" No Display Transfer Characteristics\n");
+ return;
+ case 0x03:
+ fail("Bits 7-6 of byte 0x51 cannot be 0x03\n");
+ return;
+ default:
+ break;
+ }
+
+ if (((v & 0xc0) >> 6) == 0x01) {
+ if (!num_entries || num_entries > 45)
+ fail("White Curve with %u entries\n", num_entries);
+ if (num_entries > 45)
+ num_entries = 45;
+ printf(" White Curve (%u entries):\n", num_entries);
+ hex_block(" ", x + 0x52, num_entries, false, 15);
+ } else {
+ if (!num_entries || num_entries > 15)
+ fail("Sub-Channel Curve with %u entries\n", num_entries);
+ if (num_entries > 15)
+ num_entries = 15;
+ printf(" Sub-Channel 0 (Blue) Curve with %u entries:\n", num_entries);
+ hex_block(" ", x + 0x52, num_entries, false);
+ printf(" Sub-Channel 1 (Green) Curve with %u entries:\n", num_entries);
+ hex_block(" ", x + 0x52 + 15, num_entries, false);
+ printf(" Sub-Channel 2 (Red) Curve with %u entries:\n", num_entries);
+ hex_block(" ", x + 0x52 + 30, num_entries, false);
+ }
}
void parse_di_ext_block(edid_state &state, const unsigned char *x)

Privacy Policy