[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 1645, Thu Oct 6 18:28:31 2005 UTC revision 1683, Fri Feb 24 10:39:23 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.21 2005-10-06 18:28:31 Isibaar Exp $   * $Id: xvid_encraw.c,v 1.24 2006-02-24 10:39:23 syskin Exp $
25   *   *
26   ****************************************************************************/   ****************************************************************************/
27    
# Line 128  Line 128 
128  static int NUM_ZONES = 0;  static int NUM_ZONES = 0;
129    
130  /* Maximum number of frames to encode */  /* Maximum number of frames to encode */
131  #define ABS_MAXFRAMENR 9999  #define ABS_MAXFRAMENR -1 /* no limit */
132    
133  static int ARG_STATS = 0;  static int ARG_STATS = 0;
134  static int ARG_DUMP = 0;  static int ARG_DUMP = 0;
# Line 164  Line 164 
164  static int ARG_VHQMODE = 0;  static int ARG_VHQMODE = 0;
165  static int ARG_BVHQ = 0;  static int ARG_BVHQ = 0;
166  static int ARG_CLOSED_GOP = 0;  static int ARG_CLOSED_GOP = 0;
167    static int ARG_THREADS = 0;
168    
169  #ifndef READ_PNM  #ifndef READ_PNM
170  #define IMAGE_SIZE(x,y) ((x)*(y)*3/2)  #define IMAGE_SIZE(x,y) ((x)*(y)*3/2)
# Line 397  Line 398 
398                          ARG_GMC = 1;                          ARG_GMC = 1;
399                  } else if (strcmp("-interlaced", argv[i]) == 0) {                  } else if (strcmp("-interlaced", argv[i]) == 0) {
400                          ARG_INTERLACING = 1;                          ARG_INTERLACING = 1;
401                    } else if (strcmp("-threads", argv[i]) == 0) {
402                            i++;
403                            ARG_THREADS = atoi(argv[i]);
404                  } else if (strcmp("-closed_gop", argv[i]) == 0) {                  } else if (strcmp("-closed_gop", argv[i]) == 0) {
405                          ARG_CLOSED_GOP = 1;                          ARG_CLOSED_GOP = 1;
406                  } else if (strcmp("-help", argv[i])) {                  } else if (strcmp("-help", argv[i])) {
# Line 431  Line 435 
435                  return (-1);                  return (-1);
436          }          }
437    
438          if (ARG_MAXFRAMENR <= 0) {          if (ARG_MAXFRAMENR == 0) {
439                  fprintf(stderr, "Wrong number of frames\n");                  fprintf(stderr, "Wrong number of frames\n");
440                  return (-1);                  return (-1);
441          }          }
# Line 445  Line 449 
449                    ARG_INPUTTYPE==2)                    ARG_INPUTTYPE==2)
450        {        {
451                    AVISTREAMINFO avi_info;                    AVISTREAMINFO avi_info;
452                      FILE *avi_fp = fopen(ARG_INPUTFILE, "rb");
453                      if (avi_fp == NULL) {
454                              fprintf(stderr, "Couldn't open file '%s'!\n", ARG_INPUTFILE);
455                              return (-1);
456                      }
457                      fclose(avi_fp);
458    
459                    AVIFileInit();                    AVIFileInit();
460                    if (AVIStreamOpenFromFile(&avi_stream, ARG_INPUTFILE, streamtypeVIDEO, 0, OF_READ, NULL) != AVIERR_OK) {                    if (AVIStreamOpenFromFile(&avi_stream, ARG_INPUTFILE, streamtypeVIDEO, 0, OF_READ, NULL) != AVIERR_OK) {
# Line 467  Line 477 
477                return (-1);                return (-1);
478                    }                    }
479    
480    
481              if (ARG_MAXFRAMENR<0)
482                            ARG_MAXFRAMENR = avi_info.dwLength;
483                      else
484                            ARG_MAXFRAMENR = min(ARG_MAXFRAMENR, avi_info.dwLength);
485    
486                    XDIM = avi_info.rcFrame.right - avi_info.rcFrame.left;                    XDIM = avi_info.rcFrame.right - avi_info.rcFrame.left;
487                    YDIM = avi_info.rcFrame.bottom - avi_info.rcFrame.top;                    YDIM = avi_info.rcFrame.bottom - avi_info.rcFrame.top;
488                    ARG_FRAMERATE = (float) avi_info.dwRate / (float) avi_info.dwScale;                    ARG_FRAMERATE = (float) avi_info.dwRate / (float) avi_info.dwScale;
# Line 548  Line 564 
564                  char *type;                  char *type;
565                  int sse[3];                  int sse[3];
566    
567                  if (input_num >= ARG_MAXFRAMENR) {                  if (input_num >= ARG_MAXFRAMENR && ARG_MAXFRAMENR > 0) {
568                          result = 1;                          result = 1;
569                  }                  }
570    
# Line 754  Line 770 
770          clock_t clk;          clock_t clk;
771    
772          clk = clock();          clk = clock();
773          return (clk * 1000 / CLOCKS_PER_SEC);          return (clk * 1000.0 / CLOCKS_PER_SEC);
774  #endif  #endif
775  }  }
776    
# Line 1105  Line 1121 
1121          }          }
1122  #endif  #endif
1123    
1124          /* No fancy thread tests */          xvid_enc_create.num_threads = ARG_THREADS;
         xvid_enc_create.num_threads = 0;  
1125    
1126          /* Frame rate - Do some quick float fps = fincr/fbase hack */          /* Frame rate - Do some quick float fps = fincr/fbase hack */
1127          if ((ARG_FRAMERATE - (int) ARG_FRAMERATE) < SMALL_EPS) {          if ((ARG_FRAMERATE - (int) ARG_FRAMERATE) < SMALL_EPS) {

Legend:
Removed from v.1645  
changed lines
  Added in v.1683

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