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.22 2005-10-07 15:02:28 suxen_drol Exp $ |
* $Id: xvid_encraw.c,v 1.24 2006-02-24 10:39:23 syskin Exp $ |
25 |
* |
* |
26 |
****************************************************************************/ |
****************************************************************************/ |
27 |
|
|
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; |
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) |
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])) { |
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 |
} |
} |
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) { |
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); |
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; |
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 |
|
|
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) { |