simple benchmark for scaling
authorTony Cook <tony@develop=help.com>
Thu, 13 Sep 2001 10:53:57 +0000 (10:53 +0000)
committerTony Cook <tony@develop=help.com>
Thu, 13 Sep 2001 10:53:57 +0000 (10:53 +0000)
bench/scale.perl [new file with mode: 0644]
bench/scale.sh.perl [new file with mode: 0644]
bench/scalebench [new file with mode: 0644]

diff --git a/bench/scale.perl b/bench/scale.perl
new file mode 100644 (file)
index 0000000..0966808
--- /dev/null
@@ -0,0 +1,23 @@
+#!perl -w
+use strict;
+use Imager;
+
+print "$0\n";
+my @allfiles = (@ARGV) x 120;
+my $srcdir = '.';
+
+my %opts1 = (scalefactor=>.333334);
+my %opts2 = (scalefactor=>.25);
+my %exopts=();
+for my $file (@allfiles) {
+  # print STDERR "reading $srcdir/$file\n";
+  my $img=Imager->new();
+  $img->read(file=>"$srcdir/$file") or die "error on \"$srcdir/$file\":
+".$img->{ERRSTR}."\n";
+  # print STDERR "making med_res_imager/$file\n";
+  my $scale=$img->scale(%opts1) or die "error on scale: ".$img->{ERRSTR};
+  $scale->write(file=>"med_res_imager/$file",%exopts);
+  # print STDERR "making icon_imager/$file\n";
+  my $scale2=$scale->scale(%opts2);
+  $scale2->write(file=>"icon_imager/$file",%exopts);
+}
diff --git a/bench/scale.sh.perl b/bench/scale.sh.perl
new file mode 100644 (file)
index 0000000..f0180fd
--- /dev/null
@@ -0,0 +1,13 @@
+#!perl -w
+use strict;
+
+print "$0\n";
+my @allfiles = (@ARGV) x 120;
+my $srcdir = '.';
+
+for my $file (@allfiles) {
+  # print STDERR "djpeg $srcdir/$file | pnmscale 0.33334 | cjpeg >med_res_pnm/$file\n";
+  system("djpeg $srcdir/$file | pnmscale 0.33334 | cjpeg > med_res_pnm/$file");
+  # print STDERR "djpeg med_res_pnm/$file | pnmscale 0.25 | cjpeg -quality 60 >icon_pnm/$file\n";
+  system("djpeg med_res_pnm/$file | pnmscale 0.25 | cjpeg -quality 60 >icon_pnm/$file");
+}
diff --git a/bench/scalebench b/bench/scalebench
new file mode 100644 (file)
index 0000000..35baa2b
--- /dev/null
@@ -0,0 +1,8 @@
+#!/bin/sh
+mkdir med_res_imager
+mkdir icon_imager
+mkdir med_res_pnm
+mkdir icon_pnm
+pngtopnm <kscdisplay.png | cjpeg >kscdisplay.jpg
+time perl -Mblib=.. scale.perl kscdisplay.jpg
+time perl scale.sh.perl kscdisplay.jpg