[mythtv] VAAPI rewrite

David Engel david at istwok.net
Mon Sep 3 19:08:48 UTC 2018


On Sun, Sep 02, 2018 at 03:56:37PM -0500, David Engel wrote:
> On Sun, Sep 02, 2018 at 04:13:03PM -0400, Peter Bennett wrote:
> > VAAPI rewite (VAAPI2) is almost complete.
> > 
> > I have implemented the fallback deinterlacer for speedup as is done with the
> > existing deinterlacers.  Time Stretch is working for vaapi2 as well as it
> > works for others. I believe there is some problem with the "predict drop"
> > when your frame rate approaches 2x the screen refresh rate. Playback gets
> > into  a speedup, slowdown repeating cycle. This also happens with other
> > deinterlacers in the existing code from before I added the vaapi2, and can
> > be seen by setting your screen refresh rate to 30 then playing a video at 2x
> > speedup.
> > 
> > The existing code switches to the fallback deinterlacer if playback speed is
> > less than 0.99 or greater than 1.01. I can understand switching when speed
> > is greater than 1, but I don't know why it switches to fallback for a
> > reduced speed. Anybody know why this is and whether I should fix it to only
> > switch when speed is greater than 1 or maybe when speed is greater than,
> > say, 1.2 ?
> 
> You'd need to ask Daniel Kristjansson or check the git log from when
> that was added.  My guess is that, at the time, it provided smoother
> playback.  I'm pretty sure the frame drop prediction hadn't been added
> yet.
> 
> > VAAPI2 is ready for testing if anybody is interested (grab the latest patch
> > on https://code.mythtv.org/trac/ticket/13311). It still needs some cleanup
> > of comments, fixing conditional compile so that it will compile correctly
> > with vaapi2 disabled, and testing on other environments (raspberry pi,
> > shield, vdpau).
> 
> Building now.  Will try to test later tonight.  If not then, then
> tomorrow.

Nice work, Peter.  I've noticed a couple of things others haven't
reported yet.

First, all of the VA deinterlacers are enabled in the OSD.  I thought
when the post processing was added VAAPI that not all deinterlacers
were supported on all hardware.  Maybe things have changed in recent
years and I could be wrong.

Second, I'm seeing strange issues with skip and ff/rew like when the
the mediacodec, 2x deinterlacing was first being added.  I think this
might be realted to the first issue -- for example, a 2x deinterlacer
is requested, but isn't actually being used and the frame timing is
getting messed up.  I need to do some more testing to figure out
what's going on.

On the strange observation front, mpeg2 can't time stretch beyond
around 1.4x without getting choppy, but h.264 can time stretch at or
near 2x.

David

> > At this stage vaapi and vaapi2 are both available for selection. You should
> > be able to compile with --disable-vaapi and only have the vaapi2. These two
> > do not use common code. I did not use any of the existing vaapi code because
> > I could not understand what it was doing.
> 
> I told a coworker just two days ago that the standard practice with
> unintelligible code is to rewrite it.  I've been there many times
> myself.  He then told me it was his own code that he couldn't
> understand. :)
> 
> David
> 
> > The new design caters for decoder-based deinterlacers, and these are handled
> > in MythCodecContext and subclasses for each decoder type (currently only
> > vaapi2). If there are other decoder based deinterlacers. Also this framework
> > makes it possible to add ffmpeg filters, of which there are many.
> > 
> > For example there are these deinterlacers available which maybe could be
> > used with software decode and may be better than the ones we have in code:
> > 
> >  ... kerndeint         V->V       Apply kernel deinterlacing to the input.
> >  ... mcdeint           V->V       Apply motion compensating deinterlacing.
> >  T.. nnedi             V->V       Apply neural network edge directed
> > interpolation intra-only deinterlacer.
> >  TS. w3fdif            V->V       Apply Martin Weston three field
> > deinterlace.
> > 
> > Peter
> > 
> > 
> 
> > _______________________________________________
> > mythtv-dev mailing list
> > mythtv-dev at mythtv.org
> > http://lists.mythtv.org/mailman/listinfo/mythtv-dev
> > http://wiki.mythtv.org/Mailing_List_etiquette
> > MythTV Forums: https://forum.mythtv.org
> 
> 
> -- 
> David Engel
> david at istwok.net

-- 
David Engel
david at istwok.net


More information about the mythtv-dev mailing list