[mythtv] YV12 problem

David Engel david at istwok.net
Thu Dec 13 03:27:25 UTC 2018

On Wed, Dec 12, 2018 at 11:49:27PM +0100, Jean-Yves Avenard wrote:
> Hi
> On Wed, 12 Dec 2018 at 5:02 pm, David Engel <david at istwok.net> wrote:
> > On Wed, Dec 12, 2018 at 08:55:22AM +0100, Jean-Yves Avenard wrote:
> > > From: David Engel <david at istwok.net>
> > > Sent: Wednesday, 12 December 2018 07:26
> > > To: Peter Bennett
> > > Cc: Development of MythTV
> > > Subject: Re: [mythtv] YV12 problem
> > >
> > >
> > > > If somebody can come up with better code that supports these android
> > devices
> > > > without the jaggies, we can then remove that faulty YV12 code.
> > > >
> > >
> > > If you remove yv12 support software decoder won't work any longer.
> > > Now in the TV world that's probably fine, but do we really want not to
> > play those files?
> >
> > Please explain.  Without more context and being mostly ignorant of
> > pixel format implilcations (though, I'm trying to correct that), I
> > don't know what to make of this statement
> TV broadcasts use exclusively mpeg2, h264 and h265.
> Most embedded system like the fire2 have a hardware decoder for those.
> So what you get out of the decoder will be a GPU based nv12 image.
> For other codecs like say vp8, vp9, av1: you have to use a software decoder
> and they will output yuv420 (if 8 bits).
> I was just saying earlier that dropping yuv420, means you'll have to do a
> conversion to nv12 right outside the decoder, so an extra memory allocation
> and unnecessary copy.
> All when converting any nv12 shader to do yv12 is trivial; you could even
> use the same code for both.

I'm confused again.  I thought we were talking about yv12 but you're
talking mostly about nv12.  I know there are a plethora of pixel
formats but it's still mostly Greek alphabet soup to me until I get
further up to speed.  If the hardware decoders generate nv12, how does
yv12 fit in?  Is it a format that has to be converted to on the way to
output or something else?

> BTW, the default browser by default on the fire2 is Firefox :)
> Story goes that Bezos contacted our director personally asking if we could
> port it in 2 weeks. The challenge was accepted.

:) That's very humorous to me.  Look at the domain name in my email
address.  It's short for "is two weeks okay?"  It was the answer we in
engineering were expected to give where I used to (and again now) work
when the owner/boss asked us how long it would take us to do anything.

[From another reply but it fits better here.]

> You touch on a question I was going to ask.  That is why does kernel
> deinterlacing need an entirely new shader program for yv12 while
> linear blend doesn't seem to need a new one?

The data between the two is the same, just stored differently. It depends
on what backend it uses for storage, but really the difference should 1 or
2 arithmetic operation different in how to access the pixel data.

I think that's kind of what I figured.  The pixel format is already
known for the textures and handled appropriately, right?  The
algorithm of which pixels from which lines/testures to mix with other
pixels remains the same.

David Engel
david at istwok.net

More information about the mythtv-dev mailing list