From 0db638a86a2533a60255ff92fb9a96d7d6224f70 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Mon, 7 Jul 2008 17:19:59 +0000 Subject: move things (for next commit) --- monitor-parse-edid | 35 ++++++++++++++++++----------------- 1 file 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}) + -- cgit v1.2.1