[svn] / branches / release-1_1-branch / xvidcore / examples / xvid_decraw.c Repository:
ViewVC logotype

Diff of /branches/release-1_1-branch/xvidcore/examples/xvid_decraw.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

trunk/xvidcore/examples/xvid_decraw.c revision 1547, Sat Sep 4 14:16:24 2004 UTC branches/release-1_1-branch/xvidcore/examples/xvid_decraw.c revision 1715, Mon Jul 10 15:21:49 2006 UTC
# Line 20  Line 20 
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.2.1 2006-07-10 15:19:41 Isibaar Exp $
24   *   *
25   ****************************************************************************/   ****************************************************************************/
26    
# Line 73  Line 73 
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   ****************************************************************************/   ****************************************************************************/
# Line 265  Line 267 
267                          mp4_ptr = mp4_buffer;                          mp4_ptr = mp4_buffer;
268    
269                          /* read new data */                          /* read new data */
270              if(feof(in_file))              if(!feof(in_file)) {
                                 break;  
271    
272                          useful_bytes += fread(mp4_buffer + already_in_buffer,                          useful_bytes += fread(mp4_buffer + already_in_buffer,
273                                                                    1, BUFFER_SIZE - already_in_buffer,                                                                    1, BUFFER_SIZE - already_in_buffer,
274                                                                    in_file);                                                                    in_file);
275                            }
276                  }                  }
277    
278    
# Line 333  Line 334 
334                          if (display_buffer_bytes) {                          if (display_buffer_bytes) {
335                                  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);
336                          }                          }
337                  } while (xvid_dec_stats.type <= 0 && useful_bytes > 0);                  } while (xvid_dec_stats.type <= 0 && useful_bytes > MIN_USEFUL_BYTES);
338    
339                  /* 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
340                   * This means we went too far */                   * This means we went too far */
# Line 378  Line 379 
379    
380                  filenr++;                  filenr++;
381    
382          } while (useful_bytes>0 || !feof(in_file));          } while (useful_bytes>MIN_USEFUL_BYTES || !feof(in_file));
383    
384          useful_bytes = 0; /* Empty buffer */          useful_bytes = 0; /* Empty buffer */
385    
# Line 495  Line 496 
496  #else  #else
497          clock_t clk;          clock_t clk;
498          clk = clock();          clk = clock();
499          return(clk * 1000 / CLOCKS_PER_SEC);          return(clk * 1000.0 / CLOCKS_PER_SEC);
500  #endif  #endif
501  }  }
502    
# Line 574  Line 575 
575  #else  #else
576          {          {
577                  int i;                  int i;
578                  for (i=0; i<width*height*BPP;i+=BPP) {                  for (i=0; i<XDIM*YDIM*BPP;i+=BPP) {
579                          if (BPP == 1) {                          if (BPP == 1) {
580                                  fputc(image+i, f);                                  fputc(*(image+i), f);
581                          } else if (BPP == 2) {                          } else if (BPP == 2) {
582                                  fputc(image+i+1, f);                                  fputc(*(image+i+1), f);
583                                  fputc(image+i+0, f);                                  fputc(*(image+i+0), f);
584                          } else if (BPP == 3) {                          } else if (BPP == 3) {
585                                  fputc(image+i+2, f);                                  fputc(*(image+i+2), f);
586                                  fputc(image+i+1, f);                                  fputc(*(image+i+1), f);
587                                  fputc(image+i+0, f);                                  fputc(*(image+i+0), f);
588                          } else if (BPP == 4) {                          } else if (BPP == 4) {
589                                  fputc(image+i+3, f);                                  fputc(*(image+i+3), f);
590                                  fputc(image+i+2, f);                                  fputc(*(image+i+2), f);
591                                  fputc(image+i+1, f);                                  fputc(*(image+i+1), f);
592                                  fputc(image+i+0, f);                                  fputc(*(image+i+0), f);
593                          }                          }
594                  }                  }
595          }          }

Legend:
Removed from v.1547  
changed lines
  Added in v.1715

No admin address has been configured
ViewVC Help
Powered by ViewVC 1.0.4