[svn] / trunk / xvidcore / examples / xvid_encraw.c Repository:
ViewVC logotype

Diff of /trunk/xvidcore/examples/xvid_encraw.c

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

revision 1710, Fri Jun 16 10:08:28 2006 UTC revision 1729, Wed Oct 11 13:52:06 2006 UTC
# Line 21  Line 21 
21   *  along with this program; if not, write to the Free Software   *  along with this program; if not, write to the Free Software
22   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
23   *   *
24   * $Id: xvid_encraw.c,v 1.25 2006-06-16 10:08:28 syskin Exp $   * $Id: xvid_encraw.c,v 1.28 2006-10-11 13:52:06 Skal Exp $
25   *   *
26   ****************************************************************************/   ****************************************************************************/
27    
# Line 39  Line 39 
39   ************************************************************************/   ************************************************************************/
40    
41  #include <stdio.h>  #include <stdio.h>
42  #include <io.h>  //#include <io.h>
43  #include <stdlib.h>  #include <stdlib.h>
44  #include <string.h>  #include <string.h>
45  #include <math.h>  #include <math.h>
# Line 165  Line 165 
165  static  frame_stats_t framestats[7];  static  frame_stats_t framestats[7];
166    
167  static  int ARG_STATS = 0;  static  int ARG_STATS = 0;
168    static  int ARG_SSIM = 0;
169    static  char* ARG_SSIM_PATH = NULL;
170  static  int ARG_DUMP = 0;  static  int ARG_DUMP = 0;
171  static  int ARG_LUMIMASKING = 0;  static  int ARG_LUMIMASKING = 0;
172  static  int ARG_BITRATE = 0;  static  int ARG_BITRATE = 0;
# Line 174  Line 176 
176  static  char *ARG_PASS2 = 0;  static  char *ARG_PASS2 = 0;
177  //static int ARG_QUALITY = ME_ELEMENTS - 1;  //static int ARG_QUALITY = ME_ELEMENTS - 1;
178  static  int ARG_QUALITY = 6;  static  int ARG_QUALITY = 6;
179  static  float ARG_FRAMERATE = 0.00f;  static  float ARG_FRAMERATE = 25.00f;
180  static  int ARG_DWRATE = 25;  static  int ARG_DWRATE = 25;
181  static  int ARG_DWSCALE = 1;  static  int ARG_DWSCALE = 1;
182  static  int ARG_MAXFRAMENR = ABS_MAXFRAMENR;  static  int ARG_MAXFRAMENR = ABS_MAXFRAMENR;
# Line 196  Line 198 
198  static  PAVIFILE avi_file = NULL;  static  PAVIFILE avi_file = NULL;
199  static  LPBITMAPINFOHEADER info_header = NULL;  static  LPBITMAPINFOHEADER info_header = NULL;
200  static  PGETFRAME get_frame = NULL;  static  PGETFRAME get_frame = NULL;
201    #else
202    #define get_frame NULL
203  #endif  #endif
204  static  char *ARG_TIMECODEFILE = NULL;  static  char *ARG_TIMECODEFILE = NULL;
205  static  int XDIM = 0;  static  int XDIM = 0;
# Line 576  Line 580 
580                          ARG_INPUTFILE = argv[i];                          ARG_INPUTFILE = argv[i];
581                  } else if (strcmp("-stats", argv[i]) == 0) {                  } else if (strcmp("-stats", argv[i]) == 0) {
582                          ARG_STATS = 1;                          ARG_STATS = 1;
583                    } else if (strcmp("-ssim", argv[i]) == 0) {
584                            ARG_SSIM = 1;
585                    } else if (strcmp("-ssim_file", argv[i]) == 0 && i < argc -1) {
586                            i++;
587                            ARG_SSIM_PATH = argv[i];
588                  } else if (strcmp("-timecode", argv[i]) == 0 && i < argc -1) {                  } else if (strcmp("-timecode", argv[i]) == 0 && i < argc -1) {
589                          i++;                          i++;
590                          ARG_TIMECODEFILE = argv[i];                          ARG_TIMECODEFILE = argv[i];
# Line 648  Line 657 
657                          i++;                          i++;
658                          ARG_AVIOUTPUTFILE = argv[i];                          ARG_AVIOUTPUTFILE = argv[i];
659  #else  #else
660                          fprintf("Not compiled with AVI output support.\n");                          fprintf( stderr, "Not compiled with AVI output support.\n");
661                          return(-1);                          return(-1);
662  #endif  #endif
663                  } else if (strcmp("-mkv", argv[i]) == 0 && i < argc - 1) {                  } else if (strcmp("-mkv", argv[i]) == 0 && i < argc - 1) {
# Line 965  Line 974 
974          }          }
975    
976          /* Jump to the starting frame */          /* Jump to the starting frame */
977          if (ARG_INPUTTYPE < 2)          if (ARG_INPUTTYPE == 0)
978                  fseek(in_file, ARG_STARTFRAMENR*IMAGE_SIZE(XDIM, YDIM), SEEK_SET);                  fseek(in_file, ARG_STARTFRAMENR*IMAGE_SIZE(XDIM, YDIM), SEEK_SET);
979    
980          /* now we know the sizes, so allocate memory */          /* now we know the sizes, so allocate memory */
981          if (get_frame == NULL) {          if (get_frame == NULL)
982            {
983                  in_buffer = (unsigned char *) malloc(4*XDIM*YDIM);                  in_buffer = (unsigned char *) malloc(4*XDIM*YDIM);
984                  if (!in_buffer)                  if (!in_buffer)
985                          goto free_all_memory;                          goto free_all_memory;
# Line 1558  Line 1568 
1568          fprintf(stderr, " -noclosed_gop                  : Disable closed GOP mode\n");          fprintf(stderr, " -noclosed_gop                  : Disable closed GOP mode\n");
1569          fprintf(stderr, " -lumimasking                   : use lumimasking algorithm\n");          fprintf(stderr, " -lumimasking                   : use lumimasking algorithm\n");
1570          fprintf(stderr, " -stats                         : print stats about encoded frames\n");          fprintf(stderr, " -stats                         : print stats about encoded frames\n");
1571            fprintf(stderr, " -ssim                          : prints the ssim stats for every encoded frame (slow!)\n");
1572            fprintf(stderr, " -ssim_file filename            : outputs the ssim stats into a file\n");
1573          fprintf(stderr, " -debug                         : activates xvidcore internal debugging output\n");          fprintf(stderr, " -debug                         : activates xvidcore internal debugging output\n");
1574          fprintf(stderr, " -vop_debug                     : print some info directly into encoded frames\n");          fprintf(stderr, " -vop_debug                     : print some info directly into encoded frames\n");
1575          fprintf(stderr, " -nochromame                    : Disable chroma motion estimation\n");          fprintf(stderr, " -nochromame                    : Disable chroma motion estimation\n");
# Line 1760  Line 1772 
1772      xvid_plugin_single_t single;      xvid_plugin_single_t single;
1773          xvid_plugin_2pass1_t rc2pass1;          xvid_plugin_2pass1_t rc2pass1;
1774          xvid_plugin_2pass2_t rc2pass2;          xvid_plugin_2pass2_t rc2pass2;
1775            xvid_plugin_ssim_t ssim;
1776          //xvid_plugin_fixed_t rcfixed;          //xvid_plugin_fixed_t rcfixed;
1777          xvid_enc_plugin_t plugins[7];          xvid_enc_plugin_t plugins[8];
1778          xvid_gbl_init_t xvid_gbl_init;          xvid_gbl_init_t xvid_gbl_init;
1779          xvid_enc_create_t xvid_enc_create;          xvid_enc_create_t xvid_enc_create;
1780          int i;          int i;
# Line 1890  Line 1903 
1903                  xvid_enc_create.num_plugins++;                  xvid_enc_create.num_plugins++;
1904          }          }
1905    
1906    #ifndef WIN32
1907            if (ARG_SSIM) {
1908                    plugins[xvid_enc_create.num_plugins].func = xvid_plugin_ssim;
1909                    ssim.b_printstat = 1;
1910                    ssim.stat_path = ARG_SSIM_PATH;
1911                    ssim.b_visualize = 0;
1912                    plugins[xvid_enc_create.num_plugins].param = &ssim;
1913                    xvid_enc_create.num_plugins++;
1914            }
1915    #endif
1916    
1917  #if 0  #if 0
1918          if (ARG_DEBUG) {          if (ARG_DEBUG) {
1919                  plugins[xvid_enc_create.num_plugins].func = rawenc_debug;                  plugins[xvid_enc_create.num_plugins].func = rawenc_debug;

Legend:
Removed from v.1710  
changed lines
  Added in v.1729

No admin address has been configured
ViewVC Help
Powered by ViewVC 1.0.4