[mythtv-users] New deinterlacer for perfect image quality when using an interlaced display, mode that matches the source

Tom Dexter digitalaudiorock at gmail.com
Fri Mar 27 13:42:54 UTC 2009


On Fri, Mar 27, 2009 at 6:14 AM, Paul Gardiner <lists at glidos.net> wrote:
> Tom Dexter wrote:
>>
>> On Thu, Mar 26, 2009 at 8:26 AM, Paul Gardiner <lists at glidos.net> wrote:
>>>
>>> I've just created a patch that provides a deinterlacer for perfect image
>>> quality and motion smoothness when using an interlaced display mode that
>>> exactly matches the video source. See Ticket #6391. The deinterlacer
>>> comes
>>> up in the menus as "Interlaced x2". It is also known as field order.
>>>
>>
>> Very very cool stuff Paul.  I was reading about this on your thread on
>> the dev list.
>>
>> I've been running 0.21-fixes version 18314 under Gentoo patched with
>> that 2903 patch to allow Bob x2.  I watch all U.S. OTA DTV on a rear
>> projection CRT (Hitachi 51F500), so my issues have been mainly with
>> 1080i content.  In my case the 2903 patch and Bob have worked well,
>> though never quite as good as with no deinterlacing (when it happened
>> to be in sync, which certainly wasn't often enough to put up with).
>>
>> ...
>
>>
>>
>> In any case I got it to work and I'm only having one issue (not the
>> fault of your code...more on that below).  I have to say that this is
>> the first time I've seen my myth system play 1080i content and have it
>> look just as good as my Samsung HD receiver.  From my testing so far,
>> this appears to be exactly what I've been hoping for since building
>> the system two years ago, and may be just as good as actually having
>> nVidia fix their 1080i ouput (which may never happen).
>
> Great news. I wondered whether it could work with 1080i. Sounds like
> you've been in a similar position to me, having other equipment that
> could give slightly better image quality, and never quite being able
> to give up on making mythtv do as well.
>
> The bit about nVidia confuses me a bit. I've obviously not understood
> what the problem they have with 1080i because I was expecting it to
> prevent use of the fieldorder patch; I thought it caused line doubling
> when using XV rendering. What is that actual problem? Is it just the
> problem of getting two vsyncs per frame?
>

To tell you the truth, most of the technical stuff regarding video is
way out of my league.  I'm not sure what nVidia is doing wrong.  All I
really know is that apparently very old nVidia drivers kept 1080i
video sync perfectly with no deinterlacing at all.  Any newer ones
(any that I've been able to run) look great temporarily but
periodically drift out of sync.

>> The issue I'm running into is due to the fact that two of my 1080i
>> stations...NBC and CBS...have the unexplainable practice of mixing
>> progressive and interlaced frames.  This causes the constant
>> re-enabling of interlacing every 1/2 second or so:
>>
>> 2009-03-26 14:08:04.288 Using deinterlace method
>> fieldorderdoubleprocessdeint
>> 2009-03-26 14:08:07.491 NVP: progressive frame seen after 91 interlaced
>>  frames
>> 2009-03-26 14:08:07.558 Enabled deinterlacing
>> 2009-03-26 14:08:07.808 NVP: interlaced frame seen after 9 progressive
>> frames
>> 2009-03-26 14:08:07.808 Enabled deinterlacing
>> 2009-03-26 14:08:08.094 NVP: progressive frame seen after 10 interlaced
>>  frames
>> 2009-03-26 14:08:08.163 Enabled deinterlacing
>> 2009-03-26 14:08:09.274 NVP: interlaced frame seen after 29 progressive
>> frames
>> 2009-03-26 14:08:09.274 Enabled deinterlacing
>> 2009-03-26 14:08:09.458 NVP: progressive frame seen after 7 interlaced
>>  frames
>> 2009-03-26 14:08:09.524 Enabled deinterlacing
>> 2009-03-26 14:08:10.791 NVP: interlaced frame seen after 33 progressive
>> frames
>> 2009-03-26 14:08:10.791 Enabled deinterlacing
>> 2009-03-26 14:08:11.091 NVP: progressive frame seen after 10 interlaced
>>  frames
>> 2009-03-26 14:08:11.158 Enabled deinterlacing
>>
>> ...etc...etc.  This issue (especially with NBC) has come up on the
>> list before.  It doesn't seem to cause visible issues with Bob x2 for
>> some reason.
>>
>> However, as long as this occurs using fieldorderdoubleprocessdeint I
>> run into various problems including occasional tearing.  However, if
>> immediately after starting playback, I pause and then go into the
>> playback menu and change the video scan from "Detect" to "Interlaced
>> (Normal)" your deinterlacer seems to work flawlessly...at least from
>> what I've seen so far.  Forcing that setting has actually been the
>> recommended work-around when this issue has been raised here before.
>>
>> Definitely cool beyond belief though.  I'm going to look into seeing
>> if I can find a way to patch playback so that, as soon as
>> deinterlacing gets enabled after seeing any progressive frames (which
>> doesn't seem to ever happen on any of my actual 720p channels), it
>> simply leaves deinterlacing on.  In my case that would take care of
>> it.
>
> That sounds like an ideal patch. Hope you can get that working. Will
> also be handy for me when I eventually go HD here.
>
> The other thing I wonder about is whether we can get 2903 committed.
> Perhaps it could be made a configuration option with default being off.
> I haven't yet figured out how one adds new config options though.
>
> Cheers,
>        Paul.

I discovered that a patch was discussed on the dev list.  I replied here:

http://www.gossamer-threads.com/lists/mythtv/dev/376752#376752

For my own purposes I found a quick hack (not sure if it would affect
other things like DVD playback which I don't use the internal player
for).  In libs/libmythtv/NuppelVideoPlayer.cpp, at the very end of
NuppelVideoPlayer::AutoDeint() I changed the line:

m_scan_locked  = false;

...to...

m_scan_locked = (m_scan_tracker > min_count);

...that is, if we've detected interlaced frames and switched to
interlaced, lock it that way (just like setting it in the menu). It
appears to work great in my circumstance...and the new deinterlacer is
working just great.  It really does look crystal clear like I've never
seen in mythtv...at least not consistently.  Really great.

By the way...I noticed that the new deinterlacer uses a bit more CPU
that Bob x2 (though certainly acceptably low).  Would you think that's
to be expected?

Thanks again.  Great work!
Tom


More information about the mythtv-users mailing list