summaryrefslogtreecommitdiffstats
path: root/TOOLS
diff options
context:
space:
mode:
authormosu <mosu@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-12-16 10:43:07 +0000
committermosu <mosu@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-12-16 10:43:07 +0000
commitccf116f7ab81a91d5977e609a26f958189df57fc (patch)
tree82e430d1babfaf28d71b85ba9ee9ff436ee668fb /TOOLS
parentf2ccd0fa56bcf5de8ddeaa18b146005e03dac49e (diff)
downloadmpv-ccf116f7ab81a91d5977e609a26f958189df57fc.tar.bz2
mpv-ccf116f7ab81a91d5977e609a26f958189df57fc.tar.xz
bunkus: Restored sane line breaks. Added note about other DVD resolutions than 720x576.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@8477 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'TOOLS')
-rwxr-xr-xTOOLS/calcbpp.pl26
1 files changed, 25 insertions, 1 deletions
diff --git a/TOOLS/calcbpp.pl b/TOOLS/calcbpp.pl
index 067434c1e1..34eb408e61 100755
--- a/TOOLS/calcbpp.pl
+++ b/TOOLS/calcbpp.pl
@@ -10,12 +10,36 @@ sub round {
floor($v);
}
+$raw_aspect = 720/576;
+
if (scalar(@ARGV) < 4) {
print("Please provide a) the cropped but unscaled resolution (e.g. " .
"716x524), b) the aspect ratio (either 4/3 or 16/9 for most DVDs), " .
"c) the video bitrate in kbps (e.g. 800) and d) the movie's fps.\n");
+ print("If your DVD is not encoded at 720x576 then change the \$raw_aspect" .
+ "variable at the beginning of this script.\n");
exit(1);
}
-($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));.}.
+($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 / ($raw_aspect));
+$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));
+}