[MPlayer-dev-eng] [PATCH] Fix inverted colours when capturing YV12 in V4L2 mode
Rich Felker
dalias at aerifal.cx
Fri Dec 16 20:55:30 CET 2005
On Fri, Dec 16, 2005 at 02:17:08PM -0500, Luc Gallant wrote:
> On 12/16/05, Jindrich Makovicka <makovick at kmlinux.fjfi.cvut.cz> wrote:
> > Luc Gallant wrote:
> > > Fixes: When capturing YV12 in V4L2 mode, the U and V planes are
> > > inverted. This is because code was copied from V4L1, and V4L1 had a
> > > problem with some pixel formats Also fixes some formatting switch case
> > > entries that were wrong. Details of the YV12 == YVU420 are available
> > > here: http://v4l2spec.bytesex.org/spec-single/v4l2.html (search YV12)
> > >
> > > How to test if it works: Open up a device that sends YV12 video in
> > > V4L2, and see if the colours are inverted.
> > >
> > > In my case, I used my loopback driver (which is known to work with the
> > > YV12 format) to ensure that the patch worked.
> > > Another way to test is to capture an I420 stream (most capture cards),
> > > and play it in YV12 format, and make sure the colours are INVERTED
> > > (since i420 is the opposite of YV12)
> >
> > What card are you using? I suppose it rather always produces YVU420,
> > even if it's asked to produce I420/YUV420. The current code works
> > without problems on my saa7134. The plane swapping is used since v4l1
> > because at least bt8x8 was unable to produce YV12/YVU420 natively.
> >
>
> I am using a virtual v4l2 driver that I created (ported from v4l1
> actually). I can send in whatever file type I want, and in this case I
> send in YV12/YVU420. When I send in that file type, the colours are
> inverted. When I send in I420/YUV420 and tell mplayer about this, it
> works fine...
>
> It is ok that the bt8x8 was unable to produce YV12/YVU420 natively. In
> my opinion, mplayer should try to set an image format, and if the
> driver responds with something that it doesn't have that image format,
> then too bad. In the way that mplayer is right now, if a device is
> actually sending in YV12, it will display inverted, and the user has
> to use -of swapuv or something like this.
>
> Like it says in the code in tvi_v4l2.c, "// YV12 uses
> VIDEO_PALETTE_YUV420P, but the planes are swapped", this goes back to
> V4L1 and the fact that back then YV12 == YUV420P, which is completely
> inverted. With V4L2, it is now correct.
>
> Let me know if there are any more issues or something I missed. Thanks.
I agree. MPlayer should not contain workarounds for bugs in the (very
shitty) bttv driver.
Rich
More information about the MPlayer-dev-eng
mailing list