Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: MythTV: Dev

DVD playback AV sync issues: all solved (?)

 

 

MythTV dev RSS feed   Index | Next | Previous | View Threaded


davmac at davmac

Jan 26, 2010, 12:32 AM

Post #1 of 22 (4142 views)
Permalink
DVD playback AV sync issues: all solved (?)

Hi,

I have finally gotten around to solving ticket #7067 completely
including for DVDs without menus. This was the last remaining case.

Anyone who was experience problems as described in #7067, I'd appreciate
if you could test the patch which is attached to the ticket. Please test
playback of DVDs, live TV, and any recordings to ensure there are no
regressions.

View patch:
http://svn.mythtv.org/trac/attachment/ticket/7067/mythtv.patch

Download patch:
http://svn.mythtv.org/trac/raw-attachment/ticket/7067/mythtv.patch


The patch is quite large, but it is mostly removing code; I have
simplified the interface between vsync and NuppelVideoPlayer. The
videosync/vsync object now has no knowledge of the video framerate and
instead gets the frame rate for each frame as part of the WaitForFrame
call (previously, the WaitForFrame took an "adjustment" parameter, the
parameter now represents the full delay including normal frame interval
and adjustment).

Thanks,

Davin

_______________________________________________
mythtv-dev mailing list
mythtv-dev [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev


davmac at davmac

Jan 28, 2010, 2:36 AM

Post #2 of 22 (4031 views)
Permalink
Re: DVD playback AV sync issues: all solved (?) [In reply to]

On 26/01/10 19:32, Davin McCall wrote:
> Anyone who was experience problems as described in #7067, I'd
> appreciate if you could test the patch which is attached to the
> ticket. Please test playback of DVDs, live TV, and any recordings to
> ensure there are no regressions.
>

I have updated the patch for recent changes to trunk.

New patch (view):
http://svn.mythtv.org/trac/attachment/ticket/7067/mythtv.2.patch

(download):
http://svn.mythtv.org/trac/raw-attachment/ticket/7067/mythtv.2.patch

Please review / test.

Davin

_______________________________________________
mythtv-dev mailing list
mythtv-dev [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev


taylor.ralph at gmail

Feb 1, 2010, 10:12 AM

Post #3 of 22 (3943 views)
Permalink
Re: DVD playback AV sync issues: all solved (?) [In reply to]

On Thu, Jan 28, 2010 at 5:36 AM, Davin McCall <davmac [at] davmac> wrote:
> On 26/01/10 19:32, Davin McCall wrote:
>>
>> Anyone who was experience problems as described in #7067, I'd appreciate
>> if you could test the patch which is attached to the ticket. Please test
>> playback of DVDs, live TV, and any recordings to ensure there are no
>> regressions.
>>
>
> I have updated the patch for recent changes to trunk.
>
> New patch (view):
> http://svn.mythtv.org/trac/attachment/ticket/7067/mythtv.2.patch
>
> (download):
> http://svn.mythtv.org/trac/raw-attachment/ticket/7067/mythtv.2.patch
>
> Please review / test.
>
> Davin
>

Now that it's committed I have a couple questions:

1) could you please explain why KeepPhase() was removed? The comments
would leave someone to believe it is necessary for HW vsync methods.
I'm hoping you know cause I don't. ;)

2) why did you remove the +/- 1.5 frame allowance before making av adjustments?

And thanks again for looking into this stuff it's greatly appreciated.

Regards.

--
Taylor
_______________________________________________
mythtv-dev mailing list
mythtv-dev [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev


taylor.ralph at gmail

Feb 1, 2010, 10:22 AM

Post #4 of 22 (3930 views)
Permalink
Re: DVD playback AV sync issues: all solved (?) [In reply to]

On Mon, Feb 1, 2010 at 1:12 PM, Taylor Ralph <taylor.ralph [at] gmail> wrote:
> On Thu, Jan 28, 2010 at 5:36 AM, Davin McCall <davmac [at] davmac> wrote:
>> On 26/01/10 19:32, Davin McCall wrote:
>>>
>>> Anyone who was experience problems as described in #7067, I'd appreciate
>>> if you could test the patch which is attached to the ticket. Please test
>>> playback of DVDs, live TV, and any recordings to ensure there are no
>>> regressions.
>>>
>>
>> I have updated the patch for recent changes to trunk.
>>
>> New patch (view):
>> http://svn.mythtv.org/trac/attachment/ticket/7067/mythtv.2.patch
>>
>> (download):
>> http://svn.mythtv.org/trac/raw-attachment/ticket/7067/mythtv.2.patch
>>
>> Please review / test.
>>
>> Davin
>>
>
> Now that it's committed I have a couple questions:
>
> 1) could you please explain why KeepPhase() was removed? The comments
> would leave someone to believe it is necessary for HW vsync methods.
> I'm hoping you know cause I don't. ;)
>

Here is a 5 1/2 year old discussion about KeepPhase (Straddle problem):

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

Regards.

--
Taylor
_______________________________________________
mythtv-dev mailing list
mythtv-dev [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev


davmac at davmac

Feb 1, 2010, 11:39 PM

Post #5 of 22 (3916 views)
Permalink
Re: DVD playback AV sync issues: all solved (?) [In reply to]

On 02/02/10 05:12, Taylor Ralph wrote:
> Now that it's committed I have a couple questions:
>
> 1) could you please explain why KeepPhase() was removed? The comments
> would leave someone to believe it is necessary for HW vsync methods.
> I'm hoping you know cause I don't. ;)
>

Probably I should have left it in for the moment, but, mainly: Because
it seems broken.

The comment for the method says "Keep our nexttrigger from drifting too
close to the exact retrace." However the code says:

244 void VideoSync::KeepPhase()
245 {
246 // cerr << m_delay << endl;
247 if (m_delay < -(m_refresh_interval/2))
248 OffsetTimeval(m_nexttrigger, 200);
249 else if (m_delay > -500)
250 OffsetTimeval(m_nexttrigger, -2000);
251 }

This is executed after actually performing the delay, which in theory
leaves m_delay at anything in the range (-m_refresh_interval, 0].

The method is called "KeepPhase()" and yet it specifically alters or
adjusts the phase (phase being the distance between the frame interval
boundary and the refresh interval boundary). It "keeps" phase only if
the frame interval is, or is very nearly, an interger multiple of the
refresh interval. That's not guaranteed.

Let me explain the so-called straddle problem, as I understand it. The
term "straddle" refers to the fact that the frame boundary might fall
either side of a particular refresh boundary. If the frame rate is an
exact multiple of the refresh rate (or very close to it) then you might
see the problem. Despite crazy theories (in the discussion thread which
you pointed out) about it being some kind of hardware issue*, the real
problem is that you can get "short frames" followed by "long frames" in
quick succession.

Eg. if frame interval = 3 * refresh interval +/- small random factors
in the refresh (due to the hardware). In one frame we might only
complete two refresh intervals (a short frame), leaving a large
remainder (m_delay only slightly less than 0). Now, if the next few
refresh intervals are just a teeny bit short, we might find that
remainder is enough to get a whole extra refresh interval in, so we end
up waiting four refresh intervals (the normal three, plus one that we
squeezed out of the large remainder from the previous frame). If this
happens repeatedly you'd probably notice it as a visual problem
(particularly if the "short" frame is only 1 refresh interval, or even 0
refresh intervals...).

So, the KeepPhase method continually tries to shift the notional frame
boundary towards the middle of the refresh interval, to prevent it
straddling the refresh boundary. The code above actually succeeds in
this regard.

Note however, if there is a slight continual drift then this eventually
brings AV sync out. Consider the case where frame interval is (some
multiple of the refresh interval + 2000 microseconds). If m_delay ever
falls into the > -500 range, then KeepPhase() will actually keep
phase... by bringing the AV sync out by 2 milliseconds every frame. Ok,
it's an artificial scenario, but the point is that "keeping phase" is
the wrong way to solve the straddle problem.

The right way is to regulate the refresh intervals per frame... that is,
if you did three refresh intervals for the last frame, but the current
calculation shows two refresh intervals are needed - with a large
remainder - then just do three again. Likewise if you get four with a
small remainder, just do three. (likewise, if you did 2 last time but
calculate 4 this time, just do 3). I.e. don't stuff around with the AV sync!

Having said all that, I probably should have left KeepPhase() in for
this round.


* (Hardware might cause it, by having inconsistent refresh intervals;
but that's a bit different to what was suggested.)


> 2) why did you remove the +/- 1.5 frame allowance before making av adjustments?
>

That one, I think, was a mistake, however: It doesn't really matter if
the audio timecode reading is accurate. The problem is, I guess, that it
might not be, and that you then end up needlessly adjusting AV sync back
and forth. (Note that setting the avsync adjustment to the average delay
/ 2 cushions the effect. If you upped the divisor enough you probably
wouldn't need the frame "allowance" because you'd be adjusting by a much
smaller amount - by less than a refresh interval for instance. Only once
the sync was out by more than the allowance would you start to see
significant adjustment anyway).

In fact: it's ultimately better to go with that approach, because if you
have an "allowance" then the AV sync potentially bounces around the
allowance edge. (you slowly get more and more out of sync until you hit
the allowance, then you are sharply reigned in by the adjustment, until
you get back within the allowance... and so on).

The patch has been reverted now, anyway; I may re-do it with KeepPhase
and the frame allowance left in. But please, discuss. I would have liked
to get more feedback/questions *before* the dang patch was applied.

Davin

_______________________________________________
mythtv-dev mailing list
mythtv-dev [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev


taylor.ralph at gmail

Feb 2, 2010, 12:53 PM

Post #6 of 22 (3883 views)
Permalink
Re: DVD playback AV sync issues: all solved (?) [In reply to]

Davin,

On Tue, Feb 2, 2010 at 2:39 AM, Davin McCall <davmac [at] davmac> wrote:
> On 02/02/10 05:12, Taylor Ralph wrote:
>>
>> Now that it's committed I have a couple questions:
>>
>> 1) could you please explain why KeepPhase() was removed? The comments
>> would leave someone to believe it is necessary for HW vsync methods.
>> I'm hoping you know cause I don't. ;)
>>
>
> Probably I should have left it in for the moment, but, mainly: Because it
> seems broken.
>
> The comment for the method says "Keep our nexttrigger from drifting too
> close to the exact retrace." However the code says:
>
> 244         void VideoSync::KeepPhase()
> 245         {
> 246             // cerr << m_delay << endl;
> 247             if (m_delay < -(m_refresh_interval/2))
> 248                 OffsetTimeval(m_nexttrigger, 200);
> 249             else if (m_delay > -500)
> 250                 OffsetTimeval(m_nexttrigger, -2000);
> 251         }
>
> This is executed after actually performing the delay, which in theory leaves
> m_delay at anything in the range (-m_refresh_interval, 0].
>
> The method is called "KeepPhase()" and yet it specifically alters or adjusts
> the phase (phase being the distance between the frame interval boundary and
> the refresh interval boundary). It "keeps" phase only if the frame interval
> is, or is very nearly, an interger multiple of the refresh interval. That's
> not guaranteed.
>
> Let me explain the so-called straddle problem, as I understand it. The term
> "straddle" refers to the fact that the frame boundary might fall either side
> of a particular refresh boundary. If the frame rate is an exact multiple of
> the refresh rate (or very close to it) then you might see the problem.
> Despite crazy theories (in the discussion thread which you pointed out)
> about it being some kind of hardware issue*, the real problem is that you
> can get "short frames" followed by "long frames" in quick succession.
>
> Eg. if frame interval = 3 * refresh interval  +/- small random factors in
> the refresh (due to the hardware). In one frame we might only complete two
> refresh intervals (a short frame), leaving a large remainder (m_delay only
> slightly less than 0). Now, if the next few refresh intervals are just a
> teeny bit short, we might find that remainder is enough to get a whole extra
> refresh interval in, so we end up waiting four refresh intervals (the normal
> three, plus one that we squeezed out of the large remainder from the
> previous frame). If this happens repeatedly you'd probably notice it as a
> visual problem (particularly if the "short" frame is only 1 refresh
> interval, or even 0 refresh intervals...).
>
> So, the KeepPhase method continually tries to shift the notional frame
> boundary towards the middle of the refresh interval, to prevent it
> straddling the refresh boundary. The code above actually succeeds in this
> regard.
>
> Note however, if there is a slight continual drift then this eventually
> brings AV sync out. Consider the case where frame interval is (some multiple
> of the refresh interval + 2000 microseconds). If m_delay ever falls into the
>> -500 range, then KeepPhase() will actually keep phase... by bringing the
> AV sync out by 2 milliseconds every frame. Ok, it's an artificial scenario,
> but the point is that "keeping phase" is the wrong way to solve the straddle
> problem.
>
> The right way is to regulate the refresh intervals per frame... that is, if
> you did three refresh intervals for the last frame, but the current
> calculation shows two refresh intervals are needed - with a large remainder
> - then just do three again. Likewise if you get four with a small remainder,
> just do three. (likewise, if you did 2 last time but calculate 4 this time,
> just do 3). I.e. don't stuff around with the AV sync!
>
> Having said all that, I probably should have left KeepPhase() in for this
> round.
>
>
> * (Hardware might cause it, by having inconsistent refresh intervals; but
> that's a bit different to what was suggested.)
>

Sounds reasonable but I'll have to think about it more deeply when I
have some time. So we need to keep in for now but it can be improved
after the release.

>
>> 2) why did you remove the +/- 1.5 frame allowance before making av
>> adjustments?
>>
>
> That one, I think, was a mistake, however: It doesn't really matter if the
> audio timecode reading is accurate. The problem is, I guess, that it might
> not be, and that you then end up needlessly adjusting AV sync back and
> forth. (Note that setting the avsync adjustment to the average delay / 2
> cushions the effect. If you upped the divisor enough you probably wouldn't
> need the frame "allowance" because you'd be adjusting by a much smaller
> amount - by less than a refresh interval for instance. Only once the sync
> was out by more than the allowance would you start to see significant
> adjustment anyway).
>
> In fact: it's ultimately better to go with that approach, because if you
> have an "allowance" then the AV sync potentially bounces around the
> allowance edge. (you slowly get more and more out of sync until you hit the
> allowance, then you are sharply reigned in by the adjustment, until you get
> back within the allowance... and so on).
>

Yes, I guess the goal is to smooth out the reaction so we don't need
to make such large adjustments. However, from my experience, with most
content the drift is quite small and these adjustments are only needed
once every few seconds at most.

> The patch has been reverted now, anyway; I may re-do it with KeepPhase and
> the frame allowance left in. But please, discuss. I would have liked to get
> more feedback/questions *before* the dang patch was applied.

Actually, I'm sure a lot of people would be very thankful if you
provided a new patch without these 2 items included. Since it's a bug
fix it still has time to be included with the release and worst case
back-ported after the release when it's had some time to soak in
trunk. Then after the release the other two issues can be looked at
hopefully in separate patches to ease integration. If you can provide
something for the current problem I'll review it ASAP this time.

Thanks for the detailed analysis and for digging into this.

--
Taylor
_______________________________________________
mythtv-dev mailing list
mythtv-dev [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev


skamithi at gmail

Feb 3, 2010, 6:38 AM

Post #7 of 22 (3854 views)
Permalink
Re: DVD playback AV sync issues: all solved (?) [In reply to]

> The patch has been reverted now, anyway; I may re-do it with KeepPhase and
> the frame allowance left in. But please, discuss. I would have liked to get
> more feedback/questions *before* the dang patch was applied.
>
> Davin
>
>
Patch works well for me. I tested it extensively on my test dvds (one of
which had av sync problem now gone). Didn't affect any of my recordings and
burnt videos. Live tv works fine too. I get the general idea of your changes
and I hope that other devs get time to review it and comment. i hope it'll
be one of the first things tackled after the next release is done.
thanks again for your work on this issue.


>
> _______________________________________________
> mythtv-dev mailing list
> mythtv-dev [at] mythtv
> http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev
>


danielk at cuymedia

Feb 4, 2010, 11:04 AM

Post #8 of 22 (3793 views)
Permalink
Re: DVD playback AV sync issues: all solved (?) [In reply to]

On Tue, 2010-02-02 at 18:39 +1100, Davin McCall wrote:
> The patch has been reverted now, anyway; I may re-do it with KeepPhase
> and the frame allowance left in. But please, discuss. I would have liked
> to get more feedback/questions *before* the dang patch was applied.

Davin, can you produce a set patches with each of the different parts
separated out so they can be tested separately? I'll have some time to
look at this in a couple weeks. Can you also test each change on video
with lots of zooms and pans at different time-stretch levels? I did a
quick test with and without the change and jumpyness with the patch
applied was immediately visible.

-- Daniel

_______________________________________________
mythtv-dev mailing list
mythtv-dev [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev


davmac at davmac

Feb 4, 2010, 7:30 PM

Post #9 of 22 (3780 views)
Permalink
Re: DVD playback AV sync issues: all solved (?) [In reply to]

On 05/02/10 06:04, Daniel Kristjansson wrote:
> On Tue, 2010-02-02 at 18:39 +1100, Davin McCall wrote:
>
>> The patch has been reverted now, anyway; I may re-do it with KeepPhase
>> and the frame allowance left in. But please, discuss. I would have liked
>> to get more feedback/questions *before* the dang patch was applied.
>>
> Davin, can you produce a set patches with each of the different parts
> separated out so they can be tested separately?

I've separated out the main part, i.e. removed the changes that Taylor
questioned, now available as:

(To view)
http://svn.mythtv.org/trac/attachment/ticket/7067/mythtv.3.patch

(To download)
http://svn.mythtv.org/trac/raw-attachment/ticket/7067/mythtv.3.patch

I'm having trouble testing it, since my box won't play anything since
r23304 (which I'll look into when I get time), but it compiles fine; I
won't ask anyone else to test it unless they really want to :)

As for the other changes, I'll worry about them once I can actually use
myth again.

Davin

_______________________________________________
mythtv-dev mailing list
mythtv-dev [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev


taylor.ralph at gmail

Feb 4, 2010, 9:52 PM

Post #10 of 22 (3767 views)
Permalink
Re: DVD playback AV sync issues: all solved (?) [In reply to]

On Thu, Feb 4, 2010 at 10:30 PM, Davin McCall <davmac [at] davmac> wrote:
> On 05/02/10 06:04, Daniel Kristjansson wrote:
>>
>> On Tue, 2010-02-02 at 18:39 +1100, Davin McCall wrote:
>>
>>>
>>> The patch has been reverted now, anyway; I may re-do it with KeepPhase
>>> and the frame allowance left in. But please, discuss. I would have liked
>>> to get more feedback/questions *before* the dang patch was applied.
>>>
>>
>> Davin, can you produce a set patches with each of the different parts
>> separated out so they can be tested separately?
>
> I've separated out the main part, i.e. removed the changes that Taylor
> questioned, now available as:
>
> (To view)
> http://svn.mythtv.org/trac/attachment/ticket/7067/mythtv.3.patch
>
> (To download)
> http://svn.mythtv.org/trac/raw-attachment/ticket/7067/mythtv.3.patch
>
> I'm having trouble testing it, since my box won't play anything since r23304
> (which I'll look into when I get time), but it compiles fine; I won't ask
> anyone else to test it unless they really want to :)
>
> As for the other changes, I'll worry about them once I can actually use myth
> again.
>
> Davin
>

I just found one issue so far. You've got the m_can_double comparison
backwards which causes 2x deinterlacing to be disabled.

Other than that it looks good. It definitely simplifies the code and
gets rid of all the SetFrameInterval calls scattered everywhere. I've
got it applied to my trunk system and also adapted it to my
0.22-fixes. So far so good. I'll give it a few days to soak and report
back.

Thanks for the quick turn around!

Regards.

--
Taylor
_______________________________________________
mythtv-dev mailing list
mythtv-dev [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev


davmac at davmac

Feb 4, 2010, 11:35 PM

Post #11 of 22 (3764 views)
Permalink
Re: DVD playback AV sync issues: all solved (?) [In reply to]

On 05/02/10 16:52, Taylor Ralph wrote:
> I just found one issue so far. You've got the m_can_double comparison
> backwards which causes 2x deinterlacing to be disabled.
>
>

Hmm

m_can_double = (frame_interval / 2 >
videosync->getRefreshInterval() * 1.005);

My head might not be screwed on right today, but: I don't think this is
backwards ... it's checking the frame interval when halved is greater
than the refresh interval. Or in other words, the frame rate when
doubled is lower than the refresh rate.

Davin

_______________________________________________
mythtv-dev mailing list
mythtv-dev [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev


taylor.ralph at gmail

Feb 5, 2010, 7:12 AM

Post #12 of 22 (3739 views)
Permalink
Re: DVD playback AV sync issues: all solved (?) [In reply to]

On Fri, Feb 5, 2010 at 2:35 AM, Davin McCall <davmac [at] davmac> wrote:
> On 05/02/10 16:52, Taylor Ralph wrote:
>>
>> I just found one issue so far. You've got the m_can_double comparison
>> backwards which causes 2x deinterlacing to be disabled.
>>
>>
>
> Hmm
>
>            m_can_double = (frame_interval / 2 >
> videosync->getRefreshInterval() * 1.005);
>
> My head might not be screwed on right today, but: I don't think this is
> backwards ... it's checking the frame interval when halved is greater than
> the refresh interval. Or in other words, the frame rate when doubled is
> lower than the refresh rate.
>
> Davin

Err, it was the tolerance put on the wrong side. That's what caused my
29.97i recordings to not be deinterlaced on my 60 fps display.

Since (1/29.97)/2 < 1/60 * 1.005 which calculates to 16.68 < 16.75
which causes m_can_double to be false.

So you actually have the tolerance on the wrong side.

So it should be

int tolerance = getRefreshInterval() * 1.005;
m_can_double = ((frame_interval / 2) + tolerance) >
videosync->getRefreshInterval();

which should make it equivalent to the prior code. The tolerance
should ease the requirement not make it more demanding.

Regards.

--
Taylor
_______________________________________________
mythtv-dev mailing list
mythtv-dev [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev


taylor.ralph at gmail

Feb 5, 2010, 7:16 AM

Post #13 of 22 (3735 views)
Permalink
Re: DVD playback AV sync issues: all solved (?) [In reply to]

On Fri, Feb 5, 2010 at 10:12 AM, Taylor Ralph <taylor.ralph [at] gmail> wrote:
> On Fri, Feb 5, 2010 at 2:35 AM, Davin McCall <davmac [at] davmac> wrote:
>> On 05/02/10 16:52, Taylor Ralph wrote:
>>>
>>> I just found one issue so far. You've got the m_can_double comparison
>>> backwards which causes 2x deinterlacing to be disabled.
>>>
>>>
>>
>> Hmm
>>
>>            m_can_double = (frame_interval / 2 >
>> videosync->getRefreshInterval() * 1.005);
>>
>> My head might not be screwed on right today, but: I don't think this is
>> backwards ... it's checking the frame interval when halved is greater than
>> the refresh interval. Or in other words, the frame rate when doubled is
>> lower than the refresh rate.
>>
>> Davin
>
> Err, it was the tolerance put on the wrong side. That's what caused my
> 29.97i recordings to not be deinterlaced on my 60 fps display.
>
> Since (1/29.97)/2 < 1/60 * 1.005 which calculates to 16.68 < 16.75
> which causes m_can_double to be false.
>
> So you actually have the tolerance on the wrong side.
>
> So it should be
>
>    int tolerance = getRefreshInterval() * 1.005;
>    m_can_double = ((frame_interval / 2) + tolerance) >
> videosync->getRefreshInterval();
>
> which should make it equivalent to the prior code. The tolerance
> should ease the requirement not make it more demanding.
>

Err, typo. The tolerance calculation should be:

tolerance = getRefreshInterval() * 0.005;

Or, I guess you could go back to your original line and change 1.005 to 0.995;

--
Taylor
_______________________________________________
mythtv-dev mailing list
mythtv-dev [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev


lists at glidos

Feb 5, 2010, 7:30 AM

Post #14 of 22 (3733 views)
Permalink
Re: DVD playback AV sync issues: all solved (?) [In reply to]

Davin McCall wrote:
> On 05/02/10 16:52, Taylor Ralph wrote:
>> I just found one issue so far. You've got the m_can_double comparison
>> backwards which causes 2x deinterlacing to be disabled.
>>
>>
>
> Hmm
>
> m_can_double = (frame_interval / 2 >
> videosync->getRefreshInterval() * 1.005);

Is this a good test to have in any case. Wouldn't it be good
to, say, be able to use double rate when playing an interlaced
30fps movie on a 50Hz display?

Cheers,
Paul.

_______________________________________________
mythtv-dev mailing list
mythtv-dev [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev


bill at bbqninja

Feb 5, 2010, 2:19 PM

Post #15 of 22 (3705 views)
Permalink
Re: DVD playback AV sync issues: all solved (?) [In reply to]

On Sat, Feb 6, 2010 at 2:30 AM, Paul Gardiner <lists [at] glidos> wrote:
> Davin McCall wrote:
>>
>> On 05/02/10 16:52, Taylor Ralph wrote:
>>>
>>> I just found one issue so far. You've got the m_can_double comparison
>>> backwards which causes 2x deinterlacing to be disabled.
>>>
>>>
>>
>> Hmm
>>
>>            m_can_double = (frame_interval / 2 >
>> videosync->getRefreshInterval() * 1.005);
>
> Is this a good test to have in any case. Wouldn't it be good
> to, say, be able to use double rate when playing an interlaced
> 30fps movie on a 50Hz display?


It would be good were it possible. As it is you'd have huge
degridation due to dropped frames.
_______________________________________________
mythtv-dev mailing list
mythtv-dev [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev


lists at glidos

Feb 6, 2010, 12:12 AM

Post #16 of 22 (3673 views)
Permalink
Re: DVD playback AV sync issues: all solved (?) [In reply to]

Bill Williamson wrote:
> On Sat, Feb 6, 2010 at 2:30 AM, Paul Gardiner <lists [at] glidos> wrote:
>> Davin McCall wrote:
>>> On 05/02/10 16:52, Taylor Ralph wrote:
>>>> I just found one issue so far. You've got the m_can_double comparison
>>>> backwards which causes 2x deinterlacing to be disabled.
>>>>
>>>>
>>> Hmm
>>>
>>> m_can_double = (frame_interval / 2 >
>>> videosync->getRefreshInterval() * 1.005);
>> Is this a good test to have in any case. Wouldn't it be good
>> to, say, be able to use double rate when playing an interlaced
>> 30fps movie on a 50Hz display?
>
>
> It would be good were it possible. As it is you'd have huge
> degridation due to dropped frames.

But the frames you would see, would be better placed temporally
than the 30fps without doubling. Isn't that true? Neither 30fps
or 60fps will look perfect on a 50Hz display, but I would have
thought that 60fps would look slightly better.

Paul.

_______________________________________________
mythtv-dev mailing list
mythtv-dev [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev


davmac at davmac

Feb 10, 2010, 4:21 AM

Post #17 of 22 (3253 views)
Permalink
Re: DVD playback AV sync issues: all solved (?) [In reply to]

On 06/02/10 02:12, Taylor Ralph wrote:
> On Fri, Feb 5, 2010 at 2:35 AM, Davin McCall<davmac [at] davmac> wrote:
>
>> On 05/02/10 16:52, Taylor Ralph wrote:
>>
>>> I just found one issue so far. You've got the m_can_double comparison
>>> backwards which causes 2x deinterlacing to be disabled.
>>>
>>>
>>>
>> Hmm
>>
>> m_can_double = (frame_interval / 2>
>> videosync->getRefreshInterval() * 1.005);
>>
>> My head might not be screwed on right today, but: I don't think this is
>> backwards ... it's checking the frame interval when halved is greater than
>> the refresh interval. Or in other words, the frame rate when doubled is
>> lower than the refresh rate.
>>
>> Davin
>>
> Err, it was the tolerance put on the wrong side. That's what caused my
> 29.97i recordings to not be deinterlaced on my 60 fps display.
>
> Since (1/29.97)/2< 1/60 * 1.005 which calculates to 16.68< 16.75
> which causes m_can_double to be false.
>
> So you actually have the tolerance on the wrong side.
>

Ah, so I have. Patch updated:

http://svn.mythtv.org/trac/attachment/ticket/7067/mythtv.4.patch

download:
http://svn.mythtv.org/trac/raw-attachment/ticket/7067/mythtv.4.patch

Davin

_______________________________________________
mythtv-dev mailing list
mythtv-dev [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev


taylor.ralph at gmail

Feb 10, 2010, 6:54 AM

Post #18 of 22 (3247 views)
Permalink
Re: DVD playback AV sync issues: all solved (?) [In reply to]

>>
>> Err, it was the tolerance put on the wrong side. That's what caused my
>> 29.97i recordings to not be deinterlaced on my 60 fps display.
>>
>> Since (1/29.97)/2<  1/60 * 1.005 which calculates to 16.68<  16.75
>> which causes m_can_double to be false.
>>
>> So you actually have the tolerance on the wrong side.
>>
>
> Ah, so I have. Patch updated:
>
> http://svn.mythtv.org/trac/attachment/ticket/7067/mythtv.4.patch
>
> download:
> http://svn.mythtv.org/trac/raw-attachment/ticket/7067/mythtv.4.patch
>
> Davin
>

Your new patch just updates m_can_double in one place. There is
another place m_can_double is calculated further down.

And for your info. The patch with m_can_double updated has been
working great for several days now.

Regards.

--
Taylor
_______________________________________________
mythtv-dev mailing list
mythtv-dev [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev


stichnot at gmail

Feb 10, 2010, 9:23 AM

Post #19 of 22 (3233 views)
Permalink
Re: DVD playback AV sync issues: all solved (?) [In reply to]

On Wed, Feb 10, 2010 at 4:21 AM, Davin McCall <davmac [at] davmac> wrote:
> On 06/02/10 02:12, Taylor Ralph wrote:
>>
>> On Fri, Feb 5, 2010 at 2:35 AM, Davin McCall<davmac [at] davmac>  wrote:
>>
>>>
>>> On 05/02/10 16:52, Taylor Ralph wrote:
>>>
>>>>
>>>> I just found one issue so far. You've got the m_can_double comparison
>>>> backwards which causes 2x deinterlacing to be disabled.
>>>>
>>>>
>>>>
>>>
>>> Hmm
>>>
>>>            m_can_double = (frame_interval / 2>
>>> videosync->getRefreshInterval() * 1.005);
>>>
>>> My head might not be screwed on right today, but: I don't think this is
>>> backwards ... it's checking the frame interval when halved is greater
>>> than
>>> the refresh interval. Or in other words, the frame rate when doubled is
>>> lower than the refresh rate.
>>>
>>> Davin
>>>
>>
>> Err, it was the tolerance put on the wrong side. That's what caused my
>> 29.97i recordings to not be deinterlaced on my 60 fps display.
>>
>> Since (1/29.97)/2<  1/60 * 1.005 which calculates to 16.68<  16.75
>> which causes m_can_double to be false.
>>
>> So you actually have the tolerance on the wrong side.
>>
>
> Ah, so I have. Patch updated:
>
> http://svn.mythtv.org/trac/attachment/ticket/7067/mythtv.4.patch
>
> download:
> http://svn.mythtv.org/trac/raw-attachment/ticket/7067/mythtv.4.patch
>
> Davin

Hi,

Some of my NBC OTA recordings have stuttering and jerkiness when using
trunk and playing back using the VDPAU Normal profile. The older
mythtv.2.patch fixed it, but the problem has returned with the
mythtv.4.patch. I uploaded a 1-minute clip and logs to demonstrate.

heroes_test2.mpg, 100MB
https://docs.google.com/leaf?id=0BxETmfuHvGPQZDRmY2M5NjMtZDM3OC00ZGY1LTg4NGItMmU1YzY5NTIzODQ4&hl=en

heroes_test2.patch2.log
https://docs.google.com/leaf?id=0BxETmfuHvGPQNzYwZDNjZDAtMjQxZS00YjRlLWEyYTktNTZkMGVmODkzNmRi&hl=en
This is the output of "mythavtest -v important,general,playback,extra"
with mythtv.2.patch applied. (Ignore the GetNumSetting log messages,
this is something I'm working on.)

heroes_test2.patch4.log
https://docs.google.com/leaf?id=0BxETmfuHvGPQZDVjYmRhNzAtOGI4NS00ZjVmLTgyNzUtZGZiNWZlYTYwNTE1&hl=en
This is the output with mythtv.4.patch applied.

$ mythfrontend --version
Please include all output in bug reports.
MythTV Version : 23506M
MythTV Branch : trunk
Network Protocol : 56
Library API : 0.23.20100131-1
QT Version : 4.5.2
Options compiled in:
linux release using_oss using_alsa using_backend using_dvb
using_fribidi using_frontend using_hdhomerun using_hdpvr using_iptv
using_ivtv using_joystick_menu using_lirc using_mheg
using_opengl_video using_opengl_vsync using_qtwebkit using_v4l
using_x11 using_xrandr using_xv using_bindings_perl
using_bindings_python using_opengl using_vdpau using_ffmpeg_threads
using_live using_mheg


Jim
_______________________________________________
mythtv-dev mailing list
mythtv-dev [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev


taylor.ralph at gmail

Feb 10, 2010, 9:56 AM

Post #20 of 22 (3237 views)
Permalink
Re: DVD playback AV sync issues: all solved (?) [In reply to]

On Wed, Feb 10, 2010 at 12:23 PM, Jim Stichnoth <stichnot [at] gmail> wrote:
>
> Hi,
>
> Some of my NBC OTA recordings have stuttering and jerkiness when using
> trunk and playing back using the VDPAU Normal profile.  The older
> mythtv.2.patch fixed it, but the problem has returned with the
> mythtv.4.patch.  I uploaded a 1-minute clip and logs to demonstrate.
>
> heroes_test2.mpg, 100MB
> https://docs.google.com/leaf?id=0BxETmfuHvGPQZDRmY2M5NjMtZDM3OC00ZGY1LTg4NGItMmU1YzY5NTIzODQ4&hl=en
>
> heroes_test2.patch2.log
> https://docs.google.com/leaf?id=0BxETmfuHvGPQNzYwZDNjZDAtMjQxZS00YjRlLWEyYTktNTZkMGVmODkzNmRi&hl=en
> This is the output of "mythavtest -v important,general,playback,extra"
> with mythtv.2.patch applied.  (Ignore the GetNumSetting log messages,
> this is something I'm working on.)
>
> heroes_test2.patch4.log
> https://docs.google.com/leaf?id=0BxETmfuHvGPQZDVjYmRhNzAtOGI4NS00ZjVmLTgyNzUtZGZiNWZlYTYwNTE1&hl=en
> This is the output with mythtv.4.patch applied.
>
> $ mythfrontend --version
> Please include all output in bug reports.
> MythTV Version   : 23506M
> MythTV Branch    : trunk
> Network Protocol : 56
> Library API      : 0.23.20100131-1
> QT Version       : 4.5.2
> Options compiled in:
>  linux release using_oss using_alsa using_backend using_dvb
> using_fribidi using_frontend using_hdhomerun using_hdpvr using_iptv
> using_ivtv using_joystick_menu using_lirc using_mheg
> using_opengl_video using_opengl_vsync using_qtwebkit using_v4l
> using_x11 using_xrandr using_xv using_bindings_perl
> using_bindings_python using_opengl using_vdpau using_ffmpeg_threads
> using_live using_mheg
>
>
> Jim

The reason your setup worked fine with patch2 is that a bug existed in
the patch which prevented a 2x deinterlacer from running. In patch4 it
was corrected to allow the 2x deinterlacing (although it still needs
to fixed in one other place). I've confirmed in your logs that with
patch2 you are using Temporal 1x and with patch4 you are using
Temporal 2x. Your problem is with using Temporal 2x. I would assume
the ION has the power to handle Temporal 2X on MPEG 1080i so I'll take
your sample and try and reproduce.

Regards.

--
Taylor
_______________________________________________
mythtv-dev mailing list
mythtv-dev [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev


stichnot at gmail

Feb 10, 2010, 10:14 AM

Post #21 of 22 (3239 views)
Permalink
Re: DVD playback AV sync issues: all solved (?) [In reply to]

On Wed, Feb 10, 2010 at 9:56 AM, Taylor Ralph <taylor.ralph [at] gmail> wrote:
> The reason your setup worked fine with patch2 is that a bug existed in
> the patch which prevented a 2x deinterlacer from running. In patch4 it
> was corrected to allow the 2x deinterlacing (although it still needs
> to fixed in one other place). I've confirmed in your logs that with
> patch2 you are using Temporal 1x and with patch4 you are using
> Temporal 2x. Your problem is with using Temporal 2x. I would assume
> the ION has the power to handle Temporal 2X on MPEG 1080i so I'll take
> your sample and try and reproduce.

That makes sense. Thanks for looking into it. I'm also happy to
switch to a 1x deinterlacer if needed.

Jim
_______________________________________________
mythtv-dev mailing list
mythtv-dev [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev


davmac at davmac

Feb 10, 2010, 2:05 PM

Post #22 of 22 (3226 views)
Permalink
Re: DVD playback AV sync issues: all solved (?) [In reply to]

> Your new patch just updates m_can_double in one place. There is
> another place m_can_double is calculated further down.
>
>

Seems it's one of those days. Next try:

http://svn.mythtv.org/trac/attachment/ticket/7067/mythtv.6.patch

Download:
http://svn.mythtv.org/trac/raw-attachment/ticket/7067/mythtv.6.patch


> And for your info. The patch with m_can_double updated has been
> working great for several days now.
>
>

That's great! Thanks,

Davin

_______________________________________________
mythtv-dev mailing list
mythtv-dev [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev

MythTV dev RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.