/* mptoppm - converts MPEGTool RGB file into a series of ppm format files. ** usage: mptoppm width height filename num_frames. ** ** Modified from rgb3toppm.c. ** ** Copyright (C) 1991 by Jef Poskanzer. ** ** Permission to use, copy, modify, and distribute this software and its ** documentation for any purpose and without fee is hereby granted, provided ** that the above copyright notice appear in all copies and that both that ** copyright notice and this permission notice appear in supporting ** documentation. This software is provided "as is" without express or ** implied warranty. */ #include "ppm.h" void main( argc, argv ) int argc; char* argv[]; { FILE* fd; FILE* ofd; gray* rrow; gray* rP; gray* grow; gray* gP; gray* brow; gray* bP; pixel* pixelrow; register pixel* pP; int rows, cols, trows, tcols, row, col; gray rmaxval, gmaxval, bmaxval; int rformat, gformat, bformat; pixval pmaxval; char filename[100]; int i,nf; ppm_init( &argc, argv ); if ( argc != 6 ) pm_usage( "xsize ysize mpt_file ppm_file number_of_frames" ); fd = pm_openr( argv[3] ); nf = atoi(argv[5]); cols = atoi( argv[1] ); rows = atoi( argv[2] ); pmaxval = 255; rrow = pgm_allocrow( cols*rows ); grow = pgm_allocrow( cols*rows ); brow = pgm_allocrow( cols*rows ); pixelrow = ppm_allocrow( cols ); for (i=0;i