20 |
* along with this program; if not, write to the Free Software |
* along with this program; if not, write to the Free Software |
21 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
22 |
* |
* |
23 |
* $Id: xvid_decraw.c,v 1.19 2004-09-04 14:16:24 edgomez Exp $ |
* $Id: xvid_decraw.c,v 1.22 2005-10-07 15:02:28 suxen_drol Exp $ |
24 |
* |
* |
25 |
****************************************************************************/ |
****************************************************************************/ |
26 |
|
|
73 |
|
|
74 |
static const int display_buffer_bytes = 0; |
static const int display_buffer_bytes = 0; |
75 |
|
|
76 |
|
#define MIN_USEFUL_BYTES 1 |
77 |
|
|
78 |
/***************************************************************************** |
/***************************************************************************** |
79 |
* Local prototypes |
* Local prototypes |
80 |
****************************************************************************/ |
****************************************************************************/ |
335 |
if (display_buffer_bytes) { |
if (display_buffer_bytes) { |
336 |
printf("Data chunk %d: %d bytes consumed, %d bytes in buffer\n", chunk++, used_bytes, useful_bytes); |
printf("Data chunk %d: %d bytes consumed, %d bytes in buffer\n", chunk++, used_bytes, useful_bytes); |
337 |
} |
} |
338 |
} while (xvid_dec_stats.type <= 0 && useful_bytes > 0); |
} while (xvid_dec_stats.type <= 0 && useful_bytes > MIN_USEFUL_BYTES); |
339 |
|
|
340 |
/* Check if there is a negative number of useful bytes left in buffer |
/* Check if there is a negative number of useful bytes left in buffer |
341 |
* This means we went too far */ |
* This means we went too far */ |
380 |
|
|
381 |
filenr++; |
filenr++; |
382 |
|
|
383 |
} while (useful_bytes>0 || !feof(in_file)); |
} while (useful_bytes>MIN_USEFUL_BYTES || !feof(in_file)); |
384 |
|
|
385 |
useful_bytes = 0; /* Empty buffer */ |
useful_bytes = 0; /* Empty buffer */ |
386 |
|
|
497 |
#else |
#else |
498 |
clock_t clk; |
clock_t clk; |
499 |
clk = clock(); |
clk = clock(); |
500 |
return(clk * 1000 / CLOCKS_PER_SEC); |
return(clk * 1000.0 / CLOCKS_PER_SEC); |
501 |
#endif |
#endif |
502 |
} |
} |
503 |
|
|
576 |
#else |
#else |
577 |
{ |
{ |
578 |
int i; |
int i; |
579 |
for (i=0; i<width*height*BPP;i+=BPP) { |
for (i=0; i<XDIM*YDIM*BPP;i+=BPP) { |
580 |
if (BPP == 1) { |
if (BPP == 1) { |
581 |
fputc(image+i, f); |
fputc(*(image+i), f); |
582 |
} else if (BPP == 2) { |
} else if (BPP == 2) { |
583 |
fputc(image+i+1, f); |
fputc(*(image+i+1), f); |
584 |
fputc(image+i+0, f); |
fputc(*(image+i+0), f); |
585 |
} else if (BPP == 3) { |
} else if (BPP == 3) { |
586 |
fputc(image+i+2, f); |
fputc(*(image+i+2), f); |
587 |
fputc(image+i+1, f); |
fputc(*(image+i+1), f); |
588 |
fputc(image+i+0, f); |
fputc(*(image+i+0), f); |
589 |
} else if (BPP == 4) { |
} else if (BPP == 4) { |
590 |
fputc(image+i+3, f); |
fputc(*(image+i+3), f); |
591 |
fputc(image+i+2, f); |
fputc(*(image+i+2), f); |
592 |
fputc(image+i+1, f); |
fputc(*(image+i+1), f); |
593 |
fputc(image+i+0, f); |
fputc(*(image+i+0), f); |
594 |
} |
} |
595 |
} |
} |
596 |
} |
} |