#include "amma/VideoByte.hh" #include "amma/VideoYUV.hh" #include "amma/VideoIntl.hh" #include "amma/ByteImag.hh" #include "amma/YUVImage.hh" #include "amma/ImgField.hh" #include "amma/Filename.hh" #include "amma/Option.hh" #include int main (int argc, char* argv[]) { OptionC opt(argc, argv); opt.Comment( "Reads image sequence in one format & writes it to another; " "file formats are determined by the file names (see the class documentation)\n\n" "Examples:\n\n" " exIntl fred.qcif jim.ppm\n\n" "- reads in stream of YUV images from \"fred.qcif\"\n" "- writes them to a set of ppm image files jim0.ppm jim1.ppm ....\n\n" " exIntl fred.yuv jim.cif\n\n" "- reads YUV images from the Abekas format files fred000.yuv fred001.yuv ....\n" "- writes them to a cif file \"jim.cif\"\n\n" " exIntl /vol/vssp/video/database/abekas/calender/cal.yuv - -n 1 -i -s 6 | xv -\n\n" "- reads file cal006.yuv and pipes it into xv\n\n" "Note that images writen to .yuv files are *not* scaled; they are truncated / padded to fit.\n" ); FilenameC ip_name(opt.String("", "", "I/p file or file prefix")); FilenameC op_name(opt.String("", "", "O/p file")); IntT N(opt.Int("n", INT_MAX, "Max no. of frames read")); IntT start(opt.Int("s", 0, " Start at nth field")); IntT sub(opt.Int("sub", 1, "Only read in 1 in every n frames")); BooleanT grey(opt. Boolean("g", false, "Luminance only written")); BooleanT interlaced(opt. Boolean("i", false, "Fields as separate images")); BooleanT rev_interlaced(opt. Boolean("r", false, "Fields as separate images; reversed interlace")); opt.CompulsoryArgs (2); opt.Check (); opt.DependXor("i r"); ScanT scan(Progressive); if (interlaced) scan = Interlaced; else if (rev_interlaced) scan = ReverseIntl; VideoYUVInC vidthing(ip_name, 0); VideoIntlInC ip (vidthing, scan); if (start > 0) ip.Seek(start); if (grey) { VideoByteOutC op(op_name); while (ip.IsOk() && (N-- > 0)) { cerr << "Field "<< ip.ImageNo() << '\n'; op.Put(ByteImageC(YUVImageC(ip.Get().Image()))); if(sub > 1) ip.DSeek(sub-1); } } else { VideoYUVOutC op(op_name); while (ip.IsOk() && (N-- > 0)) { cerr << "Field "<< ip.ImageNo() << '\n'; op.Put(ip.Get().Image()); if(sub > 1) ip.DSeek(sub-1); } } return 0; }