Common: adds ffEdidIsValid

This commit is contained in:
李通洲
2026-03-13 09:39:28 +08:00
parent 3a35f9735b
commit cfabee4ba7
2 changed files with 14 additions and 0 deletions
+1
View File
@@ -10,3 +10,4 @@ void ffEdidGetPhysicalResolution(const uint8_t edid[128], uint32_t* width, uint3
void ffEdidGetPhysicalSize(const uint8_t edid[128], uint32_t* width, uint32_t* height); // in mm
void ffEdidGetSerialAndManufactureDate(const uint8_t edid[128], uint32_t* serial, uint16_t* year, uint16_t* week);
bool ffEdidGetHdrCompatible(const uint8_t* edid, uint32_t length);
bool ffEdidIsValid(const uint8_t edid[128], uint32_t length);
+13
View File
@@ -128,3 +128,16 @@ bool ffEdidGetHdrCompatible(const uint8_t* edid, uint32_t length)
}
return false;
}
bool ffEdidIsValid(const uint8_t edid[128], uint32_t length)
{
if (length < 128 || length % 128 != 0) return false;
static const uint8_t edidHeader[] = { 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00 };
if (memcmp(edid, edidHeader, sizeof(edidHeader)) != 0) return false;
uint8_t sum = 0;
for (uint32_t i = 0; i < 128; i++) sum += edid[i];
return sum == 0;
}