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.14 2004-04-02 21:29:21 edgomez Exp $ |
* $Id: xvid_encraw.c,v 1.18 2005-07-05 20:39:52 chl Exp $ |
25 |
* |
* |
26 |
****************************************************************************/ |
****************************************************************************/ |
27 |
|
|
151 |
static int ARG_PACKED = 0; |
static int ARG_PACKED = 0; |
152 |
static int ARG_DEBUG = 0; |
static int ARG_DEBUG = 0; |
153 |
static int ARG_VOPDEBUG = 0; |
static int ARG_VOPDEBUG = 0; |
154 |
|
static int ARG_GREYSCALE = 0; |
155 |
static int ARG_GMC = 0; |
static int ARG_GMC = 0; |
156 |
|
static int ARG_INTERLACING = 0; |
157 |
static int ARG_QPEL = 0; |
static int ARG_QPEL = 0; |
158 |
static int ARG_CLOSED_GOP = 0; |
static int ARG_CLOSED_GOP = 0; |
159 |
|
|
239 |
int stats_type; |
int stats_type; |
240 |
int stats_quant; |
int stats_quant; |
241 |
int stats_length; |
int stats_length; |
242 |
int use_assembler = 0; |
int use_assembler = 1; // this default changed! |
243 |
|
|
244 |
int input_num; |
int input_num; |
245 |
int output_num; |
int output_num; |
266 |
|
|
267 |
if (strcmp("-asm", argv[i]) == 0) { |
if (strcmp("-asm", argv[i]) == 0) { |
268 |
use_assembler = 1; |
use_assembler = 1; |
269 |
|
} else if (strcmp("-noasm", argv[i]) == 0) { |
270 |
|
use_assembler = 0; |
271 |
} else if (strcmp("-w", argv[i]) == 0 && i < argc - 1) { |
} else if (strcmp("-w", argv[i]) == 0 && i < argc - 1) { |
272 |
i++; |
i++; |
273 |
XDIM = atoi(argv[i]); |
XDIM = atoi(argv[i]); |
347 |
ARG_OUTPUTFILE = argv[i]; |
ARG_OUTPUTFILE = argv[i]; |
348 |
} else if (strcmp("-vop_debug", argv[i]) == 0) { |
} else if (strcmp("-vop_debug", argv[i]) == 0) { |
349 |
ARG_VOPDEBUG = 1; |
ARG_VOPDEBUG = 1; |
350 |
} else if (strcmp("-qpel", argv[i]) == 0) { |
} |
351 |
|
else if (strcmp("-grey", argv[i]) == 0) { |
352 |
|
ARG_GREYSCALE = 1; |
353 |
|
} |
354 |
|
else if (strcmp("-qpel", argv[i]) == 0) { |
355 |
ARG_QPEL = 1; |
ARG_QPEL = 1; |
356 |
} else if (strcmp("-gmc", argv[i]) == 0) { |
} else if (strcmp("-gmc", argv[i]) == 0) { |
357 |
ARG_GMC = 1; |
ARG_GMC = 1; |
358 |
|
} else if (strcmp("-interlaced", argv[i]) == 0) { |
359 |
|
ARG_INTERLACING = 1; |
360 |
} else if (strcmp("-closed_gop", argv[i]) == 0) { |
} else if (strcmp("-closed_gop", argv[i]) == 0) { |
361 |
ARG_CLOSED_GOP = 1; |
ARG_CLOSED_GOP = 1; |
362 |
} else if (strcmp("-help", argv[i])) { |
} else if (strcmp("-help", argv[i])) { |
703 |
fprintf(stderr, "\n"); |
fprintf(stderr, "\n"); |
704 |
fprintf(stderr, "Other options\n"); |
fprintf(stderr, "Other options\n"); |
705 |
fprintf(stderr, " -asm : use assembly optmized code\n"); |
fprintf(stderr, " -asm : use assembly optmized code\n"); |
706 |
|
fprintf(stderr, " -noasm : do not use assembly optmized code\n"); |
707 |
fprintf(stderr, " -quality integer: quality ([0..%d])\n", ME_ELEMENTS - 1); |
fprintf(stderr, " -quality integer: quality ([0..%d])\n", ME_ELEMENTS - 1); |
708 |
fprintf(stderr, " -qpel : use quarter pixel ME\n"); |
fprintf(stderr, " -qpel : use quarter pixel ME\n"); |
709 |
fprintf(stderr, " -gmc : use global motion compensation\n"); |
fprintf(stderr, " -gmc : use global motion compensation\n"); |
710 |
|
fprintf(stderr, " -interlaced : use interlaced encoding (this is NOT a deinterlacer!)\n"); |
711 |
fprintf(stderr, " -packed : packed mode\n"); |
fprintf(stderr, " -packed : packed mode\n"); |
712 |
fprintf(stderr, " -closed_gop : closed GOP mode\n"); |
fprintf(stderr, " -closed_gop : closed GOP mode\n"); |
713 |
|
fprintf(stderr, " -grey : grey scale coding (chroma is discarded)\n"); |
714 |
fprintf(stderr, " -lumimasking : use lumimasking algorithm\n"); |
fprintf(stderr, " -lumimasking : use lumimasking algorithm\n"); |
715 |
fprintf(stderr, " -stats : print stats about encoded frames\n"); |
fprintf(stderr, " -stats : print stats about encoded frames\n"); |
716 |
fprintf(stderr, " -debug : activates xvidcore internal debugging output\n"); |
fprintf(stderr, " -debug : activates xvidcore internal debugging output\n"); |
963 |
rc2pass2.filename = ARG_PASS2; |
rc2pass2.filename = ARG_PASS2; |
964 |
rc2pass2.bitrate = ARG_BITRATE; |
rc2pass2.bitrate = ARG_BITRATE; |
965 |
|
|
966 |
|
/* An example of activating VBV could look like this |
967 |
|
rc2pass2.vbv_size = 3145728; |
968 |
|
rc2pass2.vbv_initial = 2359296; |
969 |
|
rc2pass2.vbv_maxrate = 4000000; |
970 |
|
rc2pass2.vbv_peakrate = 10000000; |
971 |
|
*/ |
972 |
|
|
973 |
plugins[xvid_enc_create.num_plugins].func = xvid_plugin_2pass2; |
plugins[xvid_enc_create.num_plugins].func = xvid_plugin_2pass2; |
974 |
plugins[xvid_enc_create.num_plugins].param = &rc2pass2; |
plugins[xvid_enc_create.num_plugins].param = &rc2pass2; |
975 |
xvid_enc_create.num_plugins++; |
xvid_enc_create.num_plugins++; |
1111 |
xvid_enc_frame.vol_flags |= XVID_VOL_QUARTERPEL; |
xvid_enc_frame.vol_flags |= XVID_VOL_QUARTERPEL; |
1112 |
if (ARG_GMC) |
if (ARG_GMC) |
1113 |
xvid_enc_frame.vol_flags |= XVID_VOL_GMC; |
xvid_enc_frame.vol_flags |= XVID_VOL_GMC; |
1114 |
|
if (ARG_INTERLACING) |
1115 |
|
xvid_enc_frame.vol_flags |= XVID_VOL_INTERLACING; |
1116 |
|
|
1117 |
/* Set up core's general features */ |
/* Set up core's general features */ |
1118 |
xvid_enc_frame.vop_flags = vop_presets[ARG_QUALITY]; |
xvid_enc_frame.vop_flags = vop_presets[ARG_QUALITY]; |
1121 |
xvid_enc_frame.vop_flags |= XVID_VOP_DEBUG; |
xvid_enc_frame.vop_flags |= XVID_VOP_DEBUG; |
1122 |
} |
} |
1123 |
|
|
1124 |
|
if (ARG_GREYSCALE) { |
1125 |
|
xvid_enc_frame.vop_flags |= XVID_VOP_GREYSCALE; |
1126 |
|
} |
1127 |
|
|
1128 |
/* Frame type -- let core decide for us */ |
/* Frame type -- let core decide for us */ |
1129 |
xvid_enc_frame.type = XVID_TYPE_AUTO; |
xvid_enc_frame.type = XVID_TYPE_AUTO; |
1130 |
|
|