56 |
#include <stdlib.h> |
#include <stdlib.h> |
57 |
#include <string.h> |
#include <string.h> |
58 |
#include <math.h> |
#include <math.h> |
59 |
#ifndef _MSC_VER |
#ifndef WIN32 |
60 |
#include <sys/time.h> |
#include <sys/time.h> |
61 |
#else |
#else |
62 |
#include <time.h> |
#include <time.h> |
229 |
* Main loop |
* Main loop |
230 |
****************************************************************************/ |
****************************************************************************/ |
231 |
|
|
232 |
|
totalsize = LONG_PACK('M','P','4','U'); |
233 |
|
mp4_ptr = (unsigned char *)&totalsize; |
234 |
|
if(*mp4_ptr == 'M') |
235 |
|
bigendian = 1; |
236 |
|
else |
237 |
|
bigendian = 0; |
238 |
|
|
239 |
if(ARG_STREAMTYPE) { |
if(ARG_STREAMTYPE) { |
240 |
|
|
241 |
unsigned char header[4]; |
unsigned char header[4]; |
245 |
goto release_all; |
goto release_all; |
246 |
fread(header, 4, 1, in_file); |
fread(header, 4, 1, in_file); |
247 |
|
|
248 |
if(header[0] != '2' || header[1] != 'M' || |
if(header[0] != 'M' || header[1] != 'P' || |
249 |
header[2] != 'O' || header[3] != 'G') { |
header[2] != '4' || header[3] != 'U') { |
250 |
fprintf(stderr, "Error, this not a mp4u container file\n"); |
fprintf(stderr, "Error, this not a mp4u container file\n"); |
251 |
goto release_all; |
goto release_all; |
252 |
} |
} |
253 |
|
|
254 |
} |
} |
255 |
|
else { |
256 |
totalsize = LONG_PACK('M','P','4','U'); |
fread(mp4_buffer, BUFFER_SIZE, 1, in_file); |
257 |
mp4_ptr = (unsigned char *)&totalsize; |
} |
|
if(*mp4_ptr == 'M') |
|
|
bigendian = 1; |
|
|
else |
|
|
bigendian = 0; |
|
258 |
|
|
259 |
totaldectime = 0; |
totaldectime = 0; |
260 |
totalsize = 0; |
totalsize = 0; |
277 |
break; |
break; |
278 |
fread(&mp4_size, sizeof(long), 1, in_file); |
fread(&mp4_size, sizeof(long), 1, in_file); |
279 |
|
|
280 |
if(bigendian) |
/* Mp4U container is big endian */ |
281 |
|
if(!bigendian) |
282 |
mp4_size = SWAP(mp4_size); |
mp4_size = SWAP(mp4_size); |
283 |
|
|
284 |
/* Read mp4_size_bytes */ |
/* Read mp4_size_bytes */ |
313 |
if(feof(in_file)) |
if(feof(in_file)) |
314 |
break; |
break; |
315 |
fread(mp4_buffer + rest, BUFFER_SIZE - rest, 1, in_file); |
fread(mp4_buffer + rest, BUFFER_SIZE - rest, 1, in_file); |
316 |
|
|
317 |
} |
} |
318 |
|
|
319 |
} |
} |
382 |
totaldectime /= filenr; |
totaldectime /= filenr; |
383 |
|
|
384 |
printf("Avg: dectime %5.2f ms, %5.2f fps, mp4 stream size =%d\n", |
printf("Avg: dectime %5.2f ms, %5.2f fps, mp4 stream size =%d\n", |
385 |
totaldectime, 1000/totaldectime, totalsize); |
totaldectime, 1000/totaldectime, (int)totalsize); |
386 |
|
|
387 |
/***************************************************************************** |
/***************************************************************************** |
388 |
* XviD PART Stop |
* XviD PART Stop |
389 |
/****************************************************************************/ |
****************************************************************************/ |
390 |
|
|
391 |
release_all: |
release_all: |
392 |
if (dec_handle) { |
if (dec_handle) { |
431 |
static double |
static double |
432 |
msecond() |
msecond() |
433 |
{ |
{ |
434 |
#ifndef _MSC_VER |
#ifndef WIN32 |
435 |
struct timeval tv; |
struct timeval tv; |
436 |
gettimeofday(&tv, 0); |
gettimeofday(&tv, 0); |
437 |
return tv.tv_sec*10e3 + tv.tv_usec * 1.0e-3; |
return (double)tv.tv_sec*1.0e3 + (double)tv.tv_usec*1.0e-3; |
438 |
#else |
#else |
439 |
clock_t clk; |
clock_t clk; |
440 |
clk = clock(); |
clk = clock(); |
442 |
#endif |
#endif |
443 |
} |
} |
444 |
|
|
|
|
|
445 |
/***************************************************************************** |
/***************************************************************************** |
446 |
* output functions |
* output functions |
447 |
****************************************************************************/ |
****************************************************************************/ |