On 30/10/2020 16:58, Maxime Ripard wrote: > Hi! > > I was playing around with some code to generate EDIDs, and I think I > found a bug in how edid-decode parses the landscape and portrait ratio > in the base block, bytes 0x15 and 0x16. > > The spec (section 3.6.2) provides a formula to get back the aspect ratio > from the stored value which is: > > in landscape > aspect ratio = (stored value + 99) / 100 > > With the value in the byte 0x15 > > and in portrait > aspect ratio = 100 / (stored value + 99) > > with the value in the byte 0x16 > > However, parse-base-block.cpp has: > > if (x[0x15]) > printf(" Aspect ratio: %f (landscape)\n", 100.0 / (x[0x16] + 99)); > else > printf(" Aspect ratio: %f (portrait)\n", 100.0 / (x[0x15] + 99)); > > Which applies the same formula to both ratio types, and seems to invert > the bytes supposed to be used? > > The spec provides some example later on, for example with 4/3 (so > 1.333333...) where the stored value is supposed to be 34/0x22, while > edid-decode parses that as 1.010101 Yup, it's wrong. It's a very old bug, it was already there before I became maintainer of edid-decode. So not my fault :-) Thanks! Hans