65 |
#include <math.h> // needed for log10 |
#include <math.h> // needed for log10 |
66 |
#include <sys/time.h> // only needed for gettimeofday |
#include <sys/time.h> // only needed for gettimeofday |
67 |
|
|
68 |
#include "xvid.h" /* comes with XviD */ |
#include "../src/xvid.h" /* comes with XviD */ |
69 |
|
|
70 |
int motion_presets[7] = { |
int motion_presets[7] = { |
71 |
0, // Q 0 |
0, // Q 0 |
262 |
#define FRAMERATE_INCR 1001 |
#define FRAMERATE_INCR 1001 |
263 |
|
|
264 |
|
|
265 |
int enc_init() |
int enc_init(int use_assembler) |
266 |
{ /* initialize encoder for first use, pass all needed parameters to the codec */ |
{ /* initialize encoder for first use, pass all needed parameters to the codec */ |
267 |
int xerr; |
int xerr; |
268 |
|
|
269 |
XVID_INIT_PARAM xinit; |
XVID_INIT_PARAM xinit; |
270 |
XVID_ENC_PARAM xparam; |
XVID_ENC_PARAM xparam; |
271 |
|
|
272 |
|
if(use_assembler) |
273 |
|
|
274 |
|
#ifdef ARCH_IA64 |
275 |
|
xinit.cpu_flags = XVID_CPU_FORCE | XVID_CPU_IA64; |
276 |
|
#else |
277 |
|
xinit.cpu_flags = 0; |
278 |
|
#endif |
279 |
|
|
280 |
|
else |
281 |
xinit.cpu_flags = XVID_CPU_FORCE; |
xinit.cpu_flags = XVID_CPU_FORCE; |
282 |
|
|
283 |
xvid_init(NULL, 0, &xinit, NULL); |
xvid_init(NULL, 0, &xinit, NULL); |
284 |
|
|
285 |
xparam.width = XDIM; |
xparam.width = XDIM; |
360 |
/* Routines for decoding: init encoder, frame step, release encoder */ |
/* Routines for decoding: init encoder, frame step, release encoder */ |
361 |
/*********************************************************************/ |
/*********************************************************************/ |
362 |
|
|
363 |
int dec_init() /* init decoder before first run */ |
int dec_init(int use_assembler) /* init decoder before first run */ |
364 |
{ |
{ |
365 |
int xerr; |
int xerr; |
366 |
|
|
367 |
XVID_INIT_PARAM xinit; |
XVID_INIT_PARAM xinit; |
368 |
XVID_DEC_PARAM xparam; |
XVID_DEC_PARAM xparam; |
369 |
|
|
370 |
|
if(use_assembler) |
371 |
|
|
372 |
|
#ifdef ARCH_IA64 |
373 |
|
xinit.cpu_flags = XVID_CPU_FORCE | XVID_CPU_IA64; |
374 |
|
#else |
375 |
xinit.cpu_flags = 0; |
xinit.cpu_flags = 0; |
376 |
|
#endif |
377 |
|
|
378 |
|
else |
379 |
|
xinit.cpu_flags = XVID_CPU_FORCE; |
380 |
|
|
381 |
xvid_init(NULL, 0, &xinit, NULL); |
xvid_init(NULL, 0, &xinit, NULL); |
382 |
xparam.width = XDIM; |
xparam.width = XDIM; |
383 |
xparam.height = YDIM; |
xparam.height = YDIM; |
433 |
|
|
434 |
int m4v_size; |
int m4v_size; |
435 |
int frame_type[ABS_MAXFRAMENR]; |
int frame_type[ABS_MAXFRAMENR]; |
436 |
int Iframes=0, Pframes=0, Bframes=0; |
int Iframes=0, Pframes=0, Bframes=0, use_assembler=0; |
437 |
double framepsnr[ABS_MAXFRAMENR]; |
double framepsnr[ABS_MAXFRAMENR]; |
438 |
|
|
439 |
double Ipsnr=0.,Imaxpsnr=0.,Iminpsnr=999.,Ivarpsnr=0.; |
double Ipsnr=0.,Imaxpsnr=0.,Iminpsnr=999.,Ivarpsnr=0.; |
449 |
{ |
{ |
450 |
pgmflag = 1; |
pgmflag = 1; |
451 |
|
|
452 |
|
if (argc==2 && !strcmp(argv[1],"-asm")) |
453 |
|
use_assembler = 1; |
454 |
if (argc>=3) |
if (argc>=3) |
455 |
{ XDIM = atoi(argv[1]); |
{ XDIM = atoi(argv[1]); |
456 |
YDIM = atoi(argv[2]); |
YDIM = atoi(argv[2]); |
527 |
/*********************************************************************/ |
/*********************************************************************/ |
528 |
|
|
529 |
|
|
530 |
status = enc_init(); |
status = enc_init(use_assembler); |
531 |
if (status) |
if (status) |
532 |
{ |
{ |
533 |
printf("Encore INIT problem, return value %d\n", status); |
printf("Encore INIT problem, return value %d\n", status); |
534 |
goto release_all; |
goto release_all; |
535 |
} |
} |
536 |
|
|
537 |
status = dec_init(); |
status = dec_init(use_assembler); |
538 |
if (status) |
if (status) |
539 |
{ |
{ |
540 |
printf("Decore INIT problem, return value %d\n", status); |
printf("Decore INIT problem, return value %d\n", status); |