Main Page | Namespace List | Compound List | File List | Compound Members | File Members

jpeg.main.cc

Go to the documentation of this file.
00001 /*--------------------------------------------------------------------
00002  *
00003  * (C) Copyright Koninklijke Philips Electronics NV 2006. 
00004  * All rights reserved. This software is licensed under the terms of
00005  * version 2.1 of the GNU Lesser General Public License as published 
00006  * by the Free Software Foundation. For licensing and warranty
00007  * information, see the file COPYING in the main directory.
00008  *
00009  *------------------------------------------------------------------*/
00010 
00011 #include "yapi.h"
00012 #include "jpeg.h"
00013 #include "parse_options.h"
00014 #ifdef GCC_2
00015 #include <fstream.h>
00016 #else
00017 #include <fstream>
00018 using namespace std;
00019 #endif
00020 
00021 int main(int argc, char *argv[])
00022 {
00023   static struct
00024   {
00025     char* path;
00026     char* fefile;
00027     char* scfile;
00028     char* befile;
00029   } cmdl;
00030   char fefile[256];
00031   char scfile[256];
00032   char befile[256];
00033   
00034   option_t options[] =
00035   {
00036     { "-path",    "str", "srcdir",      &cmdl.path,   "Environment variable containing path to files"},
00037     { "-fe-file", "str", "jpeg.fe.ini", &cmdl.fefile, "Ini file for frontend"},
00038     { "-sc-file", "str", "jpeg.sc.ini", &cmdl.scfile, "Ini file for scaler"},
00039     { "-be-file", "str", "jpeg.be.ini", &cmdl.befile, "Ini file for backend"},
00040     { NULL, NULL, NULL, NULL, NULL}
00041   };
00042 
00043   if (parse_options("jpeg", argc, argv, options))
00044   {
00045     #ifdef VERBOSE
00046     fprintf(stderr, "(use \"-help\" for help)\n");
00047     #endif
00048     exit(1);
00049   }
00050   #ifdef VERBOSE
00051   print_option_values("jpeg", options);
00052   #endif
00053   
00054   if (getenv(cmdl.path))
00055   {
00056     strcpy(fefile, getenv(cmdl.path));
00057     strcat(fefile, "/");
00058     strcat(fefile, cmdl.fefile);
00059 
00060     strcpy(scfile, getenv(cmdl.path));
00061     strcat(scfile, "/");
00062     strcat(scfile, cmdl.scfile);
00063 
00064     strcpy(befile, getenv(cmdl.path));
00065     strcat(befile, "/");
00066     strcat(befile, cmdl.befile);
00067   }
00068   else
00069   {
00070     strcpy(fefile, cmdl.fefile);
00071     strcpy(scfile, cmdl.scfile);
00072     strcpy(befile, cmdl.befile);
00073   }
00074   
00075   // create yapi run-time environment
00076   RTE rte;
00077 
00078   // redirect standard output
00079   ofstream f("./Results/jpeg.out");
00080   rte.setOutStream(f);
00081 
00082   // redirect standard error
00083   ofstream g("./Results/jpeg.err");
00084   rte.setErrorStream(g);
00085 
00086   JPEG *jpeg = new JPEG(
00087     id("jpeg"),
00088     fefile,
00089     scfile,
00090     befile
00091   );
00092 
00093   // start the process network and
00094   // wait for processes to finish
00095   rte.start(*jpeg);
00096 
00097   // print workload
00098   ofstream h("./Results/jpeg.workload");
00099   printWorkload(*jpeg, h);
00100 
00101   // generate dotty file
00102   ofstream i("./Results/jpeg.dot");
00103   printDotty(*jpeg, i);
00104 
00105   f.close();
00106   g.close();
00107   h.close();
00108   i.close();
00109 
00110   delete jpeg;
00111   
00112   return 0;
00113 }

Generated on Wed Feb 15 14:52:45 2006 for jpegdec by doxygen 1.3.2