[MPlayer-users] pgm output and qdv BGR32 codec

Hakan Ardo hakan at debian.org
Sun Jun 9 20:22:02 CEST 2002


Hi,
I have three quite different issues:

- The pgm generates images with the Y,U and V planes concatinated, which is
  quite strange. What you would expect is a grayscale version of the video, eg
  the Y plane only. I have attahced a patch that fixes this. The old version
  of concatinng is still there as "-vc pgm:UV".

- The qdv codes seems to generate bad data when it is generating BGR 32-bit
  output. It seems like some stride is wrong. It works fine in BGR24 mode
  thogh.

- Would it be hard to add an option specifying that the player should play a
  spcified number of seconds and the exit? That way it would be possible to
  get hold of a 10 frames from the middle of the file using something like:

    mplayer -ss 2.4 -ps 0.4 -vo pgm

Note that I'm not on this list, so please CC.

-- 
Hakan Ardo <hakan at debian.org>, http://master.debian.org/~hakan/
-------------- next part --------------
*** vo_pgm.c.org	Sun Jun  9 20:05:16 2002
--- vo_pgm.c	Sun Jun  9 19:14:02 2002
***************
*** 41,54 ****
  
  char vo_pgm_filename[24];
  
  static uint32_t
  config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t fullscreen, char *title, uint32_t format,const vo_tune_info_t *info)
  {
      image_height = height;
      image_width = width;
!     image=malloc(width*height*3/2);
! 
!     snprintf (header, 1024, "P5\n\n%d %d\n255\n", width, height*3/2);
  
      return 0;
  }
--- 41,61 ----
  
  char vo_pgm_filename[24];
  
+ int copy_uv_images;
+ 
  static uint32_t
  config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t fullscreen, char *title, uint32_t format,const vo_tune_info_t *info)
  {
      image_height = height;
      image_width = width;
!     
!     if (copy_uv_images) {
!       image=malloc(width*height*3/2);
!       snprintf (header, 1024, "P5\n\n%d %d\n255\n", width, height*3/2);
!     } else {
!       image=malloc(width*height);
!       snprintf (header, 1024, "P5\n\n%d %d\n255\n", width, height);
!     }
  
      return 0;
  }
***************
*** 71,77 ****
  
      f = fopen (vo_pgm_filename, "wb");  if (f == NULL) return;
      fwrite (header, strlen (header), 1, f);
!     fwrite (image, image_width, image_height*3/2, f);
      fclose (f);
  
      return;
--- 78,89 ----
  
      f = fopen (vo_pgm_filename, "wb");  if (f == NULL) return;
      fwrite (header, strlen (header), 1, f);
!     
!     if (copy_uv_images) {
!       fwrite (image, image_width, image_height*3/2, f);
!     } else {
!       fwrite (image, image_width, image_height, f);
!     }
      fclose (f);
  
      return;
***************
*** 88,107 ****
          src+=stride[0];
          dst+=image_width;
      }
! {
!     // copy U+V:
!     uint8_t *src1=srcimg[1];
!     uint8_t *src2=srcimg[2];
!     uint8_t *dst=image+image_width*image_height+image_width*(y/2)+(x/2);
!     for(i=0;i<h/2;i++){
          memcpy(dst,src1,w/2);
          memcpy(dst+image_width/2,src2,w/2);
          src1+=stride[1];
          src2+=stride[2];
          dst+=image_width;
      }
- 
- }
      
      return 0;
  }
--- 100,120 ----
          src+=stride[0];
          dst+=image_width;
      }
! 
!     if (copy_uv_images) {
!       // copy U+V:
!       uint8_t *src1=srcimg[1];
!       uint8_t *src2=srcimg[2];
!       uint8_t *dst=image+image_width*image_height+image_width*(y/2)+(x/2);
!       for(i=0;i<h/2;i++){
          memcpy(dst,src1,w/2);
          memcpy(dst+image_width/2,src2,w/2);
          src1+=stride[1];
          src2+=stride[2];
          dst+=image_width;
+       }
+       
      }
      
      return 0;
  }
***************
*** 138,149 ****
  
  static uint32_t preinit(const char *arg)
  {
!     if(arg) 
!     {
! 	printf("vo_pgm: Unknown subdevice: %s\n",arg);
! 	return ENOSYS;
!     }
!     return 0;
  }
  
  static uint32_t control(uint32_t request, void *data, ...)
--- 151,166 ----
  
  static uint32_t preinit(const char *arg)
  {
!   copy_uv_images=0;
!   if (!arg) return 0;
! 
!   if (!strcmp(arg,"UV"))
!     copy_uv_images=1;
!   else {
!     printf("vo_pgm: Unknown subdevice: %s\n",arg);
!     return ENOSYS;
!   }
!   return 0;
  }
  
  static uint32_t control(uint32_t request, void *data, ...)


More information about the MPlayer-users mailing list