aboutsummaryrefslogtreecommitdiffstats
path: root/parse-base-block.cpp
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil-cisco@xs4all.nl>2020-10-30 17:21:12 +0100
committerHans Verkuil <hverkuil-cisco@xs4all.nl>2020-10-30 17:21:12 +0100
commitef391efaf35c24ae043af07146d2aaf0d63f3ac5 (patch)
tree4a798d6c678efecb845962d4ee0cdfc1f276e088 /parse-base-block.cpp
parent81c64eb15bfd51c4f5e17a5cbe3c96f486403fe3 (diff)
edid-decode: fix EDID 1.4 Aspect Ratio calculation
The aspect ratio calculation was buggy, fix this. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Reported-by: Maxime Ripard <maxime@cerno.tech>
Diffstat (limited to 'parse-base-block.cpp')
-rw-r--r--parse-base-block.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/parse-base-block.cpp b/parse-base-block.cpp
index 3026093..87e30f4 100644
--- a/parse-base-block.cpp
+++ b/parse-base-block.cpp
@@ -1671,9 +1671,9 @@ void edid_state::parse_base_block(const unsigned char *x)
}
else if (base.edid_minor >= 4 && (x[0x15] || x[0x16])) {
if (x[0x15])
- printf(" Aspect ratio: %f (landscape)\n", 100.0 / (x[0x16] + 99));
+ printf(" Aspect ratio: %f (landscape)\n", (x[0x15] + 99) / 100.0);
else
- printf(" Aspect ratio: %f (portrait)\n", 100.0 / (x[0x15] + 99));
+ printf(" Aspect ratio: %f (portrait)\n", 100.0 / (x[0x16] + 99));
} else {
/* Either or both can be zero for 1.3 and before */
printf(" Image size is variable\n");

Privacy Policy