[mythtv] YV12 problem

Peter Bennett pb.mythtv at gmail.com
Wed Dec 12 23:54:32 UTC 2018



On 12/12/18 5:49 PM, Jean-Yves Avenard wrote:
> 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.
>
Jya - some quick notes on what i have been up to -

I have added MythTV code to decode using mediacodec via FFmpeg, also new 
code to support vaapi with deinterlacing (called vaapi2 in MythTV) and I 
am working on nvdec. However, I need to implement direct output from 
decoder to video. Currently for all of those I have added it is decoding 
to memory and then using the existing MythTV OpenGL to render. This is 
not fast enough for 4K video. I will have to learn how to do the direct 
output from decode to OpenGL.

One problem with mediacodec decoding is that in most devices it does not 
do deinterlacing and it does not pass MythTV the indicator to say video 
is interlaced. This forces me to use software decoding for mpeg2 so that 
we can detect the interlace and use the OpenGL deinterlacer.

On some devices (e.g. fire stick g2), the MythTV OpenGL implementation 
is not fast enough to display 30 fps, so we are dropping frames. I 
believe that the OpenGL processing we use is too much, causing the 
slowdown. I believe we need a lightweight OpenGL render that renders the 
images without all the filters we normally use. The decoding part of it 
seems to be fast enough, audio and video sync nicely, just the video is 
jerky becuase of the dropped frames.

I need to spend some time learning OpenGL so that I can figure this all out.

Any help or advice would be welcome.

Peter


More information about the mythtv-dev mailing list