[svn] / trunk / xvidcore / examples / xvid_decraw.c Repository:
ViewVC logotype

Diff of /trunk/xvidcore/examples/xvid_decraw.c

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

revision 1880, Tue Jan 5 09:25:19 2010 UTC revision 1881, Fri Jan 8 10:03:09 2010 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.25 2010-01-05 09:25:19 Isibaar Exp $   * $Id: xvid_decraw.c,v 1.26 2010-01-08 10:03:09 Isibaar Exp $
24   *   *
25   ****************************************************************************/   ****************************************************************************/
26    
# Line 88  Line 88 
88                                          xvid_dec_stats_t *xvid_dec_stats);                                          xvid_dec_stats_t *xvid_dec_stats);
89  static int dec_stop();  static int dec_stop();
90  static void usage();  static void usage();
91  static int write_image(char *prefix, unsigned char *image);  static int write_image(char *prefix, unsigned char *image, int filenr);
92  static int write_pnm(char *filename, unsigned char *image);  static int write_pnm(char *filename, unsigned char *image);
93  static int write_tga(char *filename, unsigned char *image);  static int write_tga(char *filename, unsigned char *image);
94  static int write_yuv(char *filename, unsigned char *image);  static int write_yuv(char *filename, unsigned char *image);
# Line 375  Line 375 
375    
376                  /* Save output frame if required */                  /* Save output frame if required */
377                  if (ARG_SAVEDECOUTPUT) {                  if (ARG_SAVEDECOUTPUT) {
                         if (FORMAT == USE_YUV) {  
378                                  sprintf(filename, "%sdec", filepath);                                  sprintf(filename, "%sdec", filepath);
379                          }  
380                          else {                          if(write_image(filename, out_buffer, filenr)) {
                                 sprintf(filename, "%sdec%05d", filepath, filenr);  
                         }  
                         if(write_image(filename, out_buffer)) {  
381                                  fprintf(stderr,                                  fprintf(stderr,
382                                                  "Error writing decoded frame %s\n",                                                  "Error writing decoded frame %s\n",
383                                                  filename);                                                  filename);
# Line 428  Line 424 
424    
425                  /* Save output frame if required */                  /* Save output frame if required */
426                  if (ARG_SAVEDECOUTPUT) {                  if (ARG_SAVEDECOUTPUT) {
                         if (FORMAT == USE_YUV) {  
427                                  sprintf(filename, "%sdec", filepath);                                  sprintf(filename, "%sdec", filepath);
428                          }  
429                          else {                          if(write_image(filename, out_buffer, filenr)) {
                                 sprintf(filename, "%sdec%05d", filepath, filenr);  
                         }  
                         if(write_image(filename, out_buffer)) {  
430                                  fprintf(stderr,                                  fprintf(stderr,
431                                                  "Error writing decoded frame %s\n",                                                  "Error writing decoded frame %s\n",
432                                                  filename);                                                  filename);
# Line 520  Line 512 
512   *              output functions   *              output functions
513   ****************************************************************************/   ****************************************************************************/
514    
515  static int write_image(char *prefix, unsigned char *image)  static int write_image(char *prefix, unsigned char *image, int filenr)
516  {  {
517          char filename[1024];          char filename[1024];
518          char *ext;          char *ext;
# Line 539  Line 531 
531                  exit(-1);                  exit(-1);
532          }          }
533    
534            if (FORMAT == USE_YUV) {
535          sprintf(filename, "%s.%s", prefix, ext);          sprintf(filename, "%s.%s", prefix, ext);
536    
537                    if (!filenr) {
538                            FILE *fp = fopen(filename, "wb");
539                            fclose(fp);
540                    }
541            } else
542                    sprintf(filename, "%s%05d.%s", prefix, filenr, ext);
543    
544          if (FORMAT == USE_PNM) {          if (FORMAT == USE_PNM) {
545                  ret = write_pnm(filename, image);                  ret = write_pnm(filename, image);
546          } else if (FORMAT == USE_YUV) {          } else if (FORMAT == USE_YUV) {
# Line 682  Line 682 
682                  return -1;                  return -1;
683          }          }
684    
685          if (BPP == 1) {          fwrite(image, 1, 3*XDIM*YDIM/2, f);
                 int i;  
   
                 fwrite(image, 1, XDIM*YDIM, f);  
   
                 for (i=0; i<YDIM/2;i++) {  
                         fwrite(image+XDIM*YDIM + i*XDIM/2, 1, XDIM/2, f);  
                         fwrite(image+5*XDIM*YDIM/4 + i*XDIM/2, 1, XDIM/2, f);  
                 }  
         }  
686    
687          fclose(f);          fclose(f);
688    

Legend:
Removed from v.1880  
changed lines
  Added in v.1881

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