Mercurial > mplayer.hg
comparison TOOLS/calcbpp.pl @ 8476:650dda2e4bbb
bunkus: Restored sane line breaks. Added note about other DVD resolutions than 720x576.
author | mosu |
---|---|
date | Mon, 16 Dec 2002 10:43:07 +0000 |
parents | 85ebbeeb913b |
children | 03d14c999d2d |
comparison
equal
deleted
inserted
replaced
8475:d914270eae60 | 8476:650dda2e4bbb |
---|---|
8 return floor($v + 0.5) != floor($v) ? | 8 return floor($v + 0.5) != floor($v) ? |
9 floor($v + 0.5) : | 9 floor($v + 0.5) : |
10 floor($v); | 10 floor($v); |
11 } | 11 } |
12 | 12 |
13 $raw_aspect = 720/576; | |
14 | |
13 if (scalar(@ARGV) < 4) { | 15 if (scalar(@ARGV) < 4) { |
14 print("Please provide a) the cropped but unscaled resolution (e.g. " . | 16 print("Please provide a) the cropped but unscaled resolution (e.g. " . |
15 "716x524), b) the aspect ratio (either 4/3 or 16/9 for most DVDs), " . | 17 "716x524), b) the aspect ratio (either 4/3 or 16/9 for most DVDs), " . |
16 "c) the video bitrate in kbps (e.g. 800) and d) the movie's fps.\n"); | 18 "c) the video bitrate in kbps (e.g. 800) and d) the movie's fps.\n"); |
19 print("If your DVD is not encoded at 720x576 then change the \$raw_aspect" . | |
20 "variable at the beginning of this script.\n"); | |
17 exit(1); | 21 exit(1); |
18 } | 22 } |
19 | 23 |
20 ($unscaled_width, $unscaled_height) = split('x', $ARGV[0]);.$encoded_at = $ARGV[1];.if ($encoded_at =~ /\//) {. my @a = split(/\//, $encoded_at);. $encoded_at = $a[0] / $a[1];.}.$scaled_width = $unscaled_width * ($encoded_at / (5/4));.$scaled_height = $unscaled_height;.$picture_ar = $scaled_width / $scaled_height;.($bps, $fps) = @ARGV[2, 3];..printf("Prescaled picture: %dx%d, AR %.2f\n", $scaled_width, $scaled_height,. $picture_ar);.for ($width = 720; $width >= 320; $width -= 16) {. $height = 16 * round($width / $picture_ar / 16);. $diff = round($width / $picture_ar - $height);. $new_ar = $width / $height;. $picture_ar_error = abs(100 - $picture_ar / $new_ar * 100);. printf("${width}x${height}, diff % 3d, new AR %.2f, AR error %.2f%% " .. "scale=%d:%d bpp: %.3f\n", $diff, $new_ar, $picture_ar_error, $width,. $height, ($bps * 1000) / ($width * $height * $fps));.}. | 24 ($unscaled_width, $unscaled_height) = split('x', $ARGV[0]); |
25 $encoded_at = $ARGV[1]; | |
26 if ($encoded_at =~ /\//) { | |
27 my @a = split(/\//, $encoded_at); | |
28 $encoded_at = $a[0] / $a[1]; | |
29 } | |
30 $scaled_width = $unscaled_width * ($encoded_at / ($raw_aspect)); | |
31 $scaled_height = $unscaled_height; | |
32 $picture_ar = $scaled_width / $scaled_height; | |
33 ($bps, $fps) = @ARGV[2, 3]; | |
21 | 34 |
35 printf("Prescaled picture: %dx%d, AR %.2f\n", $scaled_width, $scaled_height, | |
36 $picture_ar); | |
37 for ($width = 720; $width >= 320; $width -= 16) { | |
38 $height = 16 * round($width / $picture_ar / 16); | |
39 $diff = round($width / $picture_ar - $height); | |
40 $new_ar = $width / $height; | |
41 $picture_ar_error = abs(100 - $picture_ar / $new_ar * 100); | |
42 printf("${width}x${height}, diff % 3d, new AR %.2f, AR error %.2f%% " . | |
43 "scale=%d:%d bpp: %.3f\n", $diff, $new_ar, $picture_ar_error, $width, | |
44 $height, ($bps * 1000) / ($width * $height * $fps)); | |
45 } |