66 |
static int CSP = XVID_CSP_I420; |
static int CSP = XVID_CSP_I420; |
67 |
static int BPP = 1; |
static int BPP = 1; |
68 |
static int FORMAT = USE_PNM; |
static int FORMAT = USE_PNM; |
69 |
|
static int POSTPROC = 0; |
70 |
|
|
71 |
static char filepath[256] = "./"; |
static char filepath[256] = "./"; |
72 |
static void *dec_handle = NULL; |
static void *dec_handle = NULL; |
123 |
long totalsize; |
long totalsize; |
124 |
int status; |
int status; |
125 |
|
|
126 |
int use_assembler = 0; |
int use_assembler = 1; |
127 |
int debug_level = 0; |
int debug_level = 0; |
128 |
|
|
129 |
char filename[256]; |
char filename[256]; |
133 |
int i; |
int i; |
134 |
|
|
135 |
printf("xvid_decraw - raw mpeg4 bitstream decoder "); |
printf("xvid_decraw - raw mpeg4 bitstream decoder "); |
136 |
printf("written by Christoph Lampert 2002-2003\n\n"); |
printf("written by Christoph Lampert\n\n"); |
137 |
|
|
138 |
/***************************************************************************** |
/***************************************************************************** |
139 |
* Command line parsing |
* Command line parsing |
141 |
|
|
142 |
for (i=1; i< argc; i++) { |
for (i=1; i< argc; i++) { |
143 |
|
|
144 |
if (strcmp("-asm", argv[i]) == 0 ) { |
if (strcmp("-noasm", argv[i]) == 0 ) { |
145 |
use_assembler = 1; |
use_assembler = 0; |
146 |
} else if (strcmp("-debug", argv[i]) == 0 && i < argc - 1 ) { |
} else if (strcmp("-debug", argv[i]) == 0 && i < argc - 1 ) { |
147 |
i++; |
i++; |
148 |
if (sscanf(argv[i], "0x%x", &debug_level) != 1) { |
if (sscanf(argv[i], "0x%x", &debug_level) != 1) { |
173 |
CSP = XVID_CSP_I420; |
CSP = XVID_CSP_I420; |
174 |
BPP = 1; |
BPP = 1; |
175 |
} |
} |
176 |
|
} else if (strcmp("-postproc", argv[i]) == 0 && i < argc - 1 ) { |
177 |
|
i++; |
178 |
|
POSTPROC = atoi(argv[i]); |
179 |
|
if (POSTPROC < 0) POSTPROC = 0; |
180 |
|
if (POSTPROC > 2) POSTPROC = 2; |
181 |
} else if (strcmp("-f", argv[i]) == 0 && i < argc -1) { |
} else if (strcmp("-f", argv[i]) == 0 && i < argc -1) { |
182 |
i++; |
i++; |
183 |
if (strcmp(argv[i], "tga") == 0) { |
if (strcmp(argv[i], "tga") == 0) { |
237 |
goto free_all_memory; |
goto free_all_memory; |
238 |
|
|
239 |
/***************************************************************************** |
/***************************************************************************** |
240 |
* XviD PART Start |
* Xvid PART Start |
241 |
****************************************************************************/ |
****************************************************************************/ |
242 |
|
|
243 |
status = dec_init(use_assembler, debug_level); |
status = dec_init(use_assembler, debug_level); |
457 |
} |
} |
458 |
|
|
459 |
/***************************************************************************** |
/***************************************************************************** |
460 |
* XviD PART Stop |
* Xvid PART Stop |
461 |
****************************************************************************/ |
****************************************************************************/ |
462 |
|
|
463 |
release_all: |
release_all: |
483 |
|
|
484 |
fprintf(stderr, "Usage : xvid_decraw [OPTIONS]\n"); |
fprintf(stderr, "Usage : xvid_decraw [OPTIONS]\n"); |
485 |
fprintf(stderr, "Options :\n"); |
fprintf(stderr, "Options :\n"); |
486 |
fprintf(stderr, " -asm : use assembly optimizations (default=disabled)\n"); |
fprintf(stderr, " -noasm : don't use assembly optimizations (default=enabled)\n"); |
487 |
fprintf(stderr, " -debug : debug level (debug=0)\n"); |
fprintf(stderr, " -debug : debug level (debug=0)\n"); |
488 |
fprintf(stderr, " -i string : input filename (default=stdin)\n"); |
fprintf(stderr, " -i string : input filename (default=stdin)\n"); |
489 |
fprintf(stderr, " -d : save decoder output\n"); |
fprintf(stderr, " -d : save decoder output\n"); |
490 |
fprintf(stderr, " -c csp : choose colorspace output (rgb16, rgb24, rgb32, yv12, i420)\n"); |
fprintf(stderr, " -c csp : choose colorspace output (rgb16, rgb24, rgb32, yv12, i420)\n"); |
491 |
fprintf(stderr, " -f format : choose output file format (tga, pnm, pgm, yuv)\n"); |
fprintf(stderr, " -f format : choose output file format (tga, pnm, pgm, yuv)\n"); |
492 |
|
fprintf(stderr, " -postproc : postprocessing level (0=off, 1=deblock, 2=deblock+dering)\n"); |
493 |
fprintf(stderr, " -m : save mpeg4 raw stream to individual files\n"); |
fprintf(stderr, " -m : save mpeg4 raw stream to individual files\n"); |
494 |
fprintf(stderr, " -help : This help message\n"); |
fprintf(stderr, " -help : This help message\n"); |
495 |
fprintf(stderr, " (* means default)\n"); |
fprintf(stderr, " (* means default)\n"); |
714 |
memset(&xvid_dec_create, 0, sizeof(xvid_dec_create_t)); |
memset(&xvid_dec_create, 0, sizeof(xvid_dec_create_t)); |
715 |
|
|
716 |
/*------------------------------------------------------------------------ |
/*------------------------------------------------------------------------ |
717 |
* XviD core initialization |
* Xvid core initialization |
718 |
*----------------------------------------------------------------------*/ |
*----------------------------------------------------------------------*/ |
719 |
|
|
720 |
/* Version */ |
/* Version */ |
735 |
xvid_global(NULL, 0, &xvid_gbl_init, NULL); |
xvid_global(NULL, 0, &xvid_gbl_init, NULL); |
736 |
|
|
737 |
/*------------------------------------------------------------------------ |
/*------------------------------------------------------------------------ |
738 |
* XviD encoder initialization |
* Xvid decoder initialization |
739 |
*----------------------------------------------------------------------*/ |
*----------------------------------------------------------------------*/ |
740 |
|
|
741 |
/* Version */ |
/* Version */ |
776 |
xvid_dec_stats->version = XVID_VERSION; |
xvid_dec_stats->version = XVID_VERSION; |
777 |
|
|
778 |
/* No general flags to set */ |
/* No general flags to set */ |
779 |
|
if (POSTPROC == 1) |
780 |
|
xvid_dec_frame.general = XVID_DEBLOCKY | XVID_DEBLOCKUV; |
781 |
|
else if (POSTPROC==2) |
782 |
|
xvid_dec_frame.general = XVID_DEBLOCKY | XVID_DEBLOCKUV | XVID_DERINGY | XVID_DERINGUV; |
783 |
|
else |
784 |
xvid_dec_frame.general = 0; |
xvid_dec_frame.general = 0; |
785 |
|
|
786 |
/* Input stream */ |
/* Input stream */ |