19 |
* along with this program; if not, write to the Free Software |
* along with this program; if not, write to the Free Software |
20 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
21 |
* |
* |
22 |
* $Id: xvid_encraw.c,v 1.11.2.7 2003-03-15 16:41:32 suxen_drol Exp $ |
* $Id: xvid_encraw.c,v 1.11.2.8 2003-03-16 12:04:13 suxen_drol Exp $ |
23 |
* |
* |
24 |
****************************************************************************/ |
****************************************************************************/ |
25 |
|
|
87 |
|
|
88 |
static int ARG_STATS = 0; |
static int ARG_STATS = 0; |
89 |
static int ARG_DUMP = 0; |
static int ARG_DUMP = 0; |
90 |
|
static int ARG_LUMIMASKING = 0; |
91 |
static int ARG_BITRATE = 900; |
static int ARG_BITRATE = 900; |
92 |
static int ARG_QUANTI = 0; |
static int ARG_QUANTI = 0; |
93 |
static int ARG_QUALITY = 5; |
static int ARG_QUALITY = 5; |
239 |
else if (strcmp("-dump", argv[i]) == 0) { |
else if (strcmp("-dump", argv[i]) == 0) { |
240 |
ARG_DUMP = 1; |
ARG_DUMP = 1; |
241 |
} |
} |
242 |
|
else if (strcmp("-lumimasking", argv[i]) == 0) { |
243 |
|
ARG_LUMIMASKING = 1; |
244 |
|
} |
245 |
else if (strcmp("-t", argv[i]) == 0 && i < argc - 1 ) { |
else if (strcmp("-t", argv[i]) == 0 && i < argc - 1 ) { |
246 |
i++; |
i++; |
247 |
ARG_INPUTTYPE = atoi(argv[i]); |
ARG_INPUTTYPE = atoi(argv[i]); |
484 |
* Calculate totals and averages for output, print results |
* Calculate totals and averages for output, print results |
485 |
****************************************************************************/ |
****************************************************************************/ |
486 |
|
|
487 |
|
printf("Tot: enctime(ms) =%7.2f, length(bytes) = %7d\n", |
488 |
|
totalenctime, (int)totalsize); |
489 |
|
|
490 |
if (input_num > 0) { |
if (input_num > 0) { |
491 |
totalsize /= input_num; |
totalsize /= input_num; |
492 |
totalenctime /= input_num; |
totalenctime /= input_num; |
666 |
switch(opt) |
switch(opt) |
667 |
{ |
{ |
668 |
case XVID_PLG_INFO : |
case XVID_PLG_INFO : |
669 |
|
{ |
670 |
|
xvid_plg_info_t * info = (xvid_plg_info_t*)param1; |
671 |
|
info->flags = XVID_REQDQUANTS; |
672 |
|
return 0; |
673 |
|
} |
674 |
|
|
675 |
case XVID_PLG_CREATE : |
case XVID_PLG_CREATE : |
676 |
case XVID_PLG_DESTROY : |
case XVID_PLG_DESTROY : |
677 |
case XVID_PLG_BEFORE : |
case XVID_PLG_BEFORE : |
680 |
case XVID_PLG_AFTER : |
case XVID_PLG_AFTER : |
681 |
{ |
{ |
682 |
xvid_plg_data_t * data = (xvid_plg_data_t*)param1; |
xvid_plg_data_t * data = (xvid_plg_data_t*)param1; |
683 |
printf("type=%i, quant=%i, length=%i\n", data->type, data->quant, data->length); |
int i,j; |
684 |
|
|
685 |
|
printf("---[ frame: %5i quant: %2i length: %6i ]---\n", data->frame_num, data->quant, data->length); |
686 |
|
for (j=0; j<data->mb_height; j++) { |
687 |
|
for (i = 0; i<data->mb_width; i++) |
688 |
|
printf("%2i ", data->dquant[j*data->dquant_stride + i]); |
689 |
|
printf("\n"); |
690 |
|
} |
691 |
|
|
692 |
return 0; |
return 0; |
693 |
} |
} |
694 |
} |
} |
704 |
{ |
{ |
705 |
int xerr; |
int xerr; |
706 |
|
|
707 |
xvid_enc_plugin_t plugins[1]; |
xvid_enc_plugin_t plugins[2]; |
708 |
|
|
709 |
xvid_gbl_init_t xvid_gbl_init; |
xvid_gbl_init_t xvid_gbl_init; |
710 |
xvid_enc_create_t xvid_enc_create; |
xvid_enc_create_t xvid_enc_create; |
750 |
|
|
751 |
xvid_enc_create.plugins = plugins; |
xvid_enc_create.plugins = plugins; |
752 |
xvid_enc_create.num_plugins = 0; |
xvid_enc_create.num_plugins = 0; |
753 |
|
|
754 |
|
if (ARG_LUMIMASKING) { |
755 |
|
plugins[xvid_enc_create.num_plugins].func = xvid_plugin_lumimasking; |
756 |
|
plugins[xvid_enc_create.num_plugins].param = NULL; |
757 |
|
xvid_enc_create.num_plugins++; |
758 |
|
} |
759 |
|
|
760 |
if (ARG_DUMP) { |
if (ARG_DUMP) { |
761 |
plugins[xvid_enc_create.num_plugins].func = xvid_plugin_dump; |
plugins[xvid_enc_create.num_plugins].func = xvid_plugin_dump; |
762 |
plugins[xvid_enc_create.num_plugins].param = NULL; |
plugins[xvid_enc_create.num_plugins].param = NULL; |
763 |
xvid_enc_create.num_plugins++; |
xvid_enc_create.num_plugins++; |
764 |
} |
} |
765 |
|
|
766 |
|
/* plugins[xvid_enc_create.num_plugins].func = rawenc_debug; |
767 |
|
plugins[xvid_enc_create.num_plugins].param = NULL; |
768 |
|
xvid_enc_create.num_plugins++; */ |
769 |
|
|
770 |
/* No fancy thread tests */ |
/* No fancy thread tests */ |
771 |
xvid_enc_create.num_threads = 0; |
xvid_enc_create.num_threads = 0; |
772 |
|
|
859 |
|
|
860 |
/* Force the right quantizer */ |
/* Force the right quantizer */ |
861 |
xvid_enc_frame.quant = ARG_QUANTI; |
xvid_enc_frame.quant = ARG_QUANTI; |
|
xvid_enc_frame.bquant = 0; |
|
862 |
|
|
863 |
/* Set up motion estimation flags */ |
/* Set up motion estimation flags */ |
864 |
xvid_enc_frame.motion = motion_presets[ARG_QUALITY]; |
xvid_enc_frame.motion = motion_presets[ARG_QUALITY]; |