/[amv]/amv.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /amv.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 11 by dpavlin, Fri Jul 20 16:07:46 2007 UTC revision 15 by dpavlin, Sat Jul 21 11:05:43 2007 UTC
# Line 15  use strict; Line 15  use strict;
15  use Data::Dump qw/dump/;  use Data::Dump qw/dump/;
16  use Carp qw/confess/;  use Carp qw/confess/;
17  use File::Path;  use File::Path;
18    use Getopt::Long;
19    
20  my $dump = 0;  my $dump = 0;
21  my $debug = 0;  my $debug = 0;
22    my $dump_dir = '/tmp/dump/';
23    
24    GetOptions(
25            "dump!"                 => \$dump,
26            "debug!"                => \$debug,
27            "dump-dir=s"    => \$dump_dir,
28    );
29    
30  my $path = shift @ARGV || die "usage: $0 movie.amv\n";  my $path = shift @ARGV || die "usage: $0 movie.amv\n";
31    
32  my $dump_dir = '/tmp/dump/';  
33  rmtree $dump_dir if -e $dump_dir;  rmtree $dump_dir if -e $dump_dir;
34  mkpath $dump_dir || die "can't create $dump_dir: $!";  mkpath $dump_dir || die "can't create $dump_dir: $!";
35    
# Line 323  sub mkjpg { Line 331  sub mkjpg {
331          );          );
332  #------------------------------------------------------------------  #------------------------------------------------------------------
333    
334            my $header =
335            # SOI
336            "\xFF\xD8".
337            # JFIF
338            "\xFF\xE0".
339            "\x00\x0e\x41\x56\x49\x31\x00\x00\x00\x00\x00\x00\x00\x00".
340            "\xff\xDD\x00\x04\x00\x00".
341            # quantization table
342            "\xFF\xDB".
343            "\x00\x43\x00\x21\x16\x18".
344            "\x1D\x18\x14\x21\x1D\x1B\x1D\x25".
345            "\x23\x21\x27\x31\x53\x36\x31\x2D".
346            "\x2D\x31\x65\x48\x4c\x3c\x53\x78".
347            "\x6a\x7e\x7c\x76\x6a\x74\x72\x85".
348            "\x95\xbf\xa2\x85\x8d\xb4\x8f\x72".
349            "\x74\xa6\xe2\xa8\xb4\xc5\xcb\xd6".
350            "\xd8\xd6\x80\xa0\xeb\xfb\xe8\xd0".
351            "\xf9\xbf\xd2\xd6\xcd".
352            # quantization table
353            "\xff\xdb".
354            "\x00\x43\x01\x23\x25\x25\x31\x2b\x31".
355            "\x61\x36\x36\x61\xcd\x89\x74\x89".
356            "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd".
357            "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd".
358            "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd".
359            "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd".
360            "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd".
361            "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd".
362            "\xcd\xcd".
363            # Define huffman table (section B.2.4.1)
364            "\xFF\xC4".     # Marker
365            "\x00\x1F".     # Length (31 bytes)
366            "\x00".         # DC luminance, table 0
367            "\x00\x01\x05\x01\x01\x01\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00".
368            "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B".
369            # Define huffman table (section B.2.4.1)
370            "\xFF\xC4".     # Marker
371            "\x00\x1F".     # Length (31 bytes)
372            "\x01".         # DC chrominance, table 1
373            "\x00\x03\x01\x01\x01\x01\x01\x01\x01\x01\x01\x00".
374            "\x00\x00\x00\x00".
375            "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B".
376            # Define huffman table (section B.2.4.1)
377            "\xFF\xC4".     # Marker
378            "\x00\xB5".     # Length (181 bytes)
379            "\x10".         # AC luminance, table 0
380            "\x00\x02\x01\x03\x03\x02\x04\x03\x05\x05\x04\x04\x00\x00\x01\x7D".
381            "\x01\x02\x03\x00\x04\x11\x05\x12".
382            "\x21\x31\x41\x06\x13\x51\x61\x07\x22\x71\x14\x32".
383            "\x81\x91\xA1\x08\x23\x42\xB1\xC1\x15\x52\xD1\xF0".
384            "\x24\x33\x62\x72\x82\x09\x0A\x16\x17\x18\x19\x1A".
385            "\x25\x26\x27\x28\x29\x2A\x34\x35\x36\x37\x38\x39".
386            "\x3A\x43\x44\x45\x46\x47\x48\x49\x4A\x53\x54\x55".
387            "\x56\x57\x58\x59\x5A\x63\x64\x65\x66\x67\x68\x69".
388            "\x6A\x73\x74\x75\x76\x77\x78\x79\x7A\x83\x84\x85".
389            "\x86\x87\x88\x89\x8A\x92\x93\x94\x95\x96\x97\x98".
390            "\x99\x9A\xA2\xA3\xA4\xA5\xA6\xA7\xA8\xA9\xAA\xB2".
391            "\xB3\xB4\xB5\xB6\xB7\xB8\xB9\xBA\xC2\xC3\xC4\xC5".
392            "\xC6\xC7\xC8\xC9\xCA\xD2\xD3\xD4\xD5\xD6\xD7\xD8".
393            "\xD9\xDA\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA".
394            "\xF1\xF2\xF3\xF4\xF5\xF6\xF7\xF8\xF9\xFA".
395            #/* Define huffman table (section B.2.4.1) */
396            "\xFF\xC4".     # Marker
397            "\x00\xB5".     # Length (181 bytes)
398            "\x11".         # AC chrominance, table 1
399            "\x00\x02\x01\x02\x04\x04\x03\x04\x07\x05\x04\x04".
400            "\x00\x01\x02\x77".
401            "\x00\x01\x02\x03\x11\x04\x05\x21".
402            "\x31\x06\x12\x41\x51\x07\x61\x71\x13\x22\x32\x81".
403            "\x08\x14\x42\x91\xA1\xB1\xC1\x09\x23\x33\x52\xF0".
404            "\x15\x62\x72\xD1\x0A\x16\x24\x34\xE1\x25\xF1\x17".
405            "\x18\x19\x1A\x26\x27\x28\x29\x2A\x35\x36\x37\x38".
406            "\x39\x3A\x43\x44\x45\x46\x47\x48\x49\x4A\x53\x54".
407            "\x55\x56\x57\x58\x59\x5A\x63\x64\x65\x66\x67\x68".
408            "\x69\x6A\x73\x74\x75\x76\x77\x78\x79\x7A\x82\x83".
409            "\x84\x85\x86\x87\x88\x89\x8A\x92\x93\x94\x95\x96".
410            "\x97\x98\x99\x9A\xA2\xA3\xA4\xA5\xA6\xA7\xA8\xA9".
411            "\xAA\xB2\xB3\xB4\xB5\xB6\xB7\xB8\xB9\xBA\xC2\xC3".
412            "\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xD2\xD3\xD4\xD5\xD6".
413            "\xD7\xD8\xD9\xDA\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9".
414            "\xEA\xF2\xF3\xF4\xF5\xF6\xF7\xF8\xF9\xFA".
415            # start of frame
416            "\xff\xc0".
417            "\x00\x11\x08".
418            pack("nn", 120, 160).
419            "\x03\x01\x21\x00\x02\x11\x01\x03\x11\x01".
420            #
421            "\xff\xda".
422            "\x00\x0c\x03\x01\x00\x02\x11\x03\x11".
423            "\x00\x3f\x00";
424    
425          if ( $dump ) {          if ( $dump ) {
426                  warn "## created JPEG header...\n";                  warn "## created JPEG header...\n";

Legend:
Removed from v.11  
changed lines
  Added in v.15

  ViewVC Help
Powered by ViewVC 1.1.26