#!/usr/bin/perl -w # generate_interlaced_ppm.pl - Don Yang (uguu.org) # # Generate interlaced image for testing odd/even downsampling. # # 12/23/11 use strict; sub write_even_scanline($) { my ($y) = @_; for(my $x = 1; $x < 255; $x++) { print "$x $y $y 0 0 0 "; } print "255 $y $y\n"; } sub write_odd_scanline($) { my ($y) = @_; for(my $x = 255; $x > 1; $x--) { print "0 0 0 $y $x $y "; } print "0 0 0\n"; } print "P3\n509 509\n255\n"; for(my $y = 1; $y < 255; $y++) { write_even_scanline($y); write_odd_scanline($y); } write_even_scanline(255);