aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xmonitor-parse-edid35
1 files changed, 18 insertions, 17 deletions
diff --git a/monitor-parse-edid b/monitor-parse-edid
index 4d40970..d8b76b9 100755
--- a/monitor-parse-edid
+++ b/monitor-parse-edid
@@ -298,6 +298,24 @@ sub parse_edid {
}
foreach my $h (@{$edid{detailed_timings}}) {
+
+ # if the mm size given in the detailed_timing is not far from the cm size
+ # put it as a more precise cm size
+ my %in_cm = map { $_ => $h->{$_ . '_image_size'} / 10 } ('horizontal', 'vertical');
+ my ($error) = sort { $b <=> $a } map { abs($edid{'max_size_' . $_} - $in_cm{$_}) } keys %in_cm;
+ if ($error <= 0.5) {
+ $edid{'max_size_' . $_} = $in_cm{$_} foreach keys %in_cm;
+ $edid{max_size_precision} = 'mm';
+ }
+ if ($error < 1 && $in_cm{vertical}) {
+ # using it for the ratio
+ $edid{ratio} = $in_cm{horizontal} / $in_cm{vertical};
+ $edid{ratio_name} = ratio_name($in_cm{horizontal}, $in_cm{vertical}, 'mm');
+ $edid{ratio_precision} = 'mm';
+ }
+
+ $h->{bad_ratio} = 1 if abs($edid{ratio} - $h->{horizontal_active} / $h->{vertical_active}) > ($edid{ratio_precision} eq 'mm' ? 0.02 : 0.2);
+
my $horizontal_total = $h->{horizontal_active} + $h->{horizontal_blanking};
my $vertical_total = $h->{vertical_active} + $h->{vertical_blanking};
@@ -321,23 +339,6 @@ sub parse_edid {
$h->{horizontal_sync_positive} ? '+' : '-',
$h->{vertical_sync_positive} ? '+' : '-';
-
- # if the mm size given in the detailed_timing is not far from the cm size
- # put it as a more precise cm size
- my %in_cm = map { $_ => $h->{$_ . '_image_size'} / 10 } ('horizontal', 'vertical');
- my ($error) = sort { $b <=> $a } map { abs($edid{'max_size_' . $_} - $in_cm{$_}) } keys %in_cm;
- if ($error <= 0.5) {
- $edid{'max_size_' . $_} = $in_cm{$_} foreach keys %in_cm;
- $edid{max_size_precision} = 'mm';
- }
- if ($error < 1 && $in_cm{vertical}) {
- # using it for the ratio
- $edid{ratio} = $in_cm{horizontal} / $in_cm{vertical};
- $edid{ratio_name} = ratio_name($in_cm{horizontal}, $in_cm{vertical}, 'mm');
- $edid{ratio_precision} = 'mm';
- }
-
- $h->{bad_ratio} = 1 if abs($edid{ratio} - $h->{horizontal_active} / $h->{vertical_active}) > ($edid{ratio_precision} eq 'mm' ? 0.02 : 0.2);
}
$edid{diagonal_size} = sqrt(sqr($edid{max_size_horizontal}) +