[Mplayer-users] YV12/I420 with DLL (VfW/DShow) codecs?

Jens Hoffmann hoffmajs at gmx.de
Mon Apr 16 09:32:50 CEST 2001


thats how i got the size:
in dll_init.c:

+ int planar;
...

 /* planar format */
   case IMGFMT_YV12:
   case IMGFMT_I420:
   case IMGFMT_IYUV:
-      sh_video->o_bih.biBitCount=12;
+      /* I420 are equal IYUV. YV12 is the same but with reversed U-V
order */
+      /* size is 8 bit Y-plane + 8 bit 2x2 UV planes */
+      sh_video->o_bih.biBitCount = 12;
+      sh_video->o_bih.biSizeImage  = sh_video->o_bih.biWidth *
sh_video->o_bih.biHeight;
+      sh_video->o_bih.biSizeImage += sh_video->o_bih.biSizeImage / 2;
+      planar = 1;
       break;
...
 
-  sh_video->o_bih.biSizeImage = sh_video->o_bih.biWidth *
sh_video->o_bih.biHeight * (sh_video->o_bih.biBitCount/8);
+  if (!planar) {
+      sh_video->o_bih.biSizeImage = sh_video->o_bih.biWidth *
sh_video->o_bih.biHeight * (sh_video->o_bih.biBitCount/8);
+  }


note that other planar formats have a different size calculation.

the vo_* draw_frame() needs probably an interface change :)
(or fix *src[], but i still would pass the size along, instead of
recalculating it..)

for xv and sdl an "draw_frame(uint8_t *src, int size)"
would be sufficient.
(then, one single
  memcpy(xvimage[0]->data, src, size); 
indipendent of yuv format is enough.)

but the yuv_to_rgb (e.g vo_x11) needs the index to the planes.
so i'd, say, make it something like
draw_frame(uint8_t *src, int size[2})

the size[0] is the 1.plane (or the complete bufferlength for non planar
formats)
and size[1] and size[2] are the lengths of the subsampled planes
(size[0]+size[1]+size[2] == o_bih.biSizeImage)

jens

_______________________________________________
Mplayer-users mailing list
Mplayer-users at lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/mplayer-users



More information about the MPlayer-users mailing list