diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2008-07-07 17:19:59 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2008-07-07 17:19:59 +0000 |
commit | 0db638a86a2533a60255ff92fb9a96d7d6224f70 (patch) | |
tree | 0b4254f60d81aff490d7c2aaded11ba1b6d35559 /monitor-parse-edid | |
parent | 250bd374a954cc1835e01e07542f04ca50ac4e8a (diff) | |
download | monitor-edid-0db638a86a2533a60255ff92fb9a96d7d6224f70.tar monitor-edid-0db638a86a2533a60255ff92fb9a96d7d6224f70.tar.gz monitor-edid-0db638a86a2533a60255ff92fb9a96d7d6224f70.tar.bz2 monitor-edid-0db638a86a2533a60255ff92fb9a96d7d6224f70.tar.xz monitor-edid-0db638a86a2533a60255ff92fb9a96d7d6224f70.zip |
move things (for next commit)
Diffstat (limited to 'monitor-parse-edid')
-rwxr-xr-x | monitor-parse-edid | 35 |
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}) + |