MP1 EVR Presenter/dshowhelper community development (4 Viewers)

tourettes

Retired Team Member
  • Premium Supporter
  • January 7, 2005
    17,301
    4,800
    As I show you work fine on the monitor running at 75 HZ. and is disabled with the 50HZ. Hmdi plasma (the important one !)

    It is not disabled in 50Hz mode (1:2). It is just EVR presenter from MP that overrides the raster position in the ::paint().
     

    Owlsroost

    Retired Team Member
  • Premium Supporter
  • October 28, 2008
    5,539
    5,038
    Cambridge
    Home Country
    United Kingdom United Kingdom
    To Owlsroost

    I think you aren't currently running in the opposite direction that you should be if you are trying to fix the ReClock incompatibility issue we are seeing. Your current approach is to ignore the steering commands that the passanger tells and then the passager gets confused when it sees the results (with a delay) where the car is heading into.

    The raster offset that you are working now is not compatible with ReClock's philosophy but it is most likely a good way to make the non-ReClock situations a bit more robust (as some users have already reported).

    Thanks for all the explanations :)

    I'm not trying to fix the 'ReClock vsync correction not working' problem (I don't use ReClock vsync correction myself because I've never managed to find a vsync 'sweet spot' that works for all material and codecs - e.g. if I find a good setting for 1:2 H.264 it messes up 1:1 HD MPEG-2 - and vv).

    I set out to try and fix/alleviate some of the 'bursts of judder' problems I was seeing, and also make sure (as a side issue) that the code accomodated the 'render clock' changes that ReClock makes e.g. the +/-4% PAL speedup/speedown - without breaking any vsync correction the dshowhelper tries to do internally.

    I've worked in the video/audio hardware design field for years, so I fully appreciate that video/audio synchronisation and vsync alignment in Windows is a much bigger mess than the MP dshowhelper can hope to fix :)

    Tony
     

    mrmojo666

    MP Donator
  • Premium Supporter
  • January 24, 2006
    603
    182
    Turin
    Home Country
    Italy Italy
    EVR presenter schedules the frame to be presented at time Y and this is got from the information that EVR mixer tells the frame presentation time to be and then EVR presenter queries the reference clock when such "imaginary" time is on the wall time (the PC clock in this case).

    Hi tourettes,
    before you told me you don't need the HPET because Mp have to manage to work with two video and audio clocks......... now you wrote the EVR is using Pc clock as reference clock.....

    in addiction to that, you wrote: Windows is not a real time OS, so the timers aren't always firing on the exact moment when they should ........ reading Hpet definition seems that very very precise in firing at the exact moment...... as you can read there :

    http://www.microsoft.com/whdc/system/sysinternals/mm-timer.mspx

    "To get tolerable multimedia performance on a system with current timing hardware, developers have had to develop tricks and techniques, such as large playback buffers and busy waiting, which sacrifice performance and quality to hide the shortcomings of the timing hardware. Because of these tricks and techniques, multimedia applications on a general purpose system with the current timing hardware will never be able to achieve the high quality performance and high level of responsiveness that consumers demand from dedicated units."

    So please would you take a look to this article and think about it ?

    As i told you i'm not an expert, but when i read those kind of articles they seem talking about our sync problems.

    bye
     

    mrmojo666

    MP Donator
  • Premium Supporter
  • January 24, 2006
    603
    182
    Turin
    Home Country
    Italy Italy
    As i told you i'm not an expert, but when i read those kind of articles they seem talking about our sync problems.

    HPET will be used automatically by MP / EVR presenter if you are running Vista / Windows 7 and have HPET support in HW + enabled in bios.

    Thank you for the explanation, i swear i won't bugging you anymore ;)
     

    tourettes

    Retired Team Member
  • Premium Supporter
  • January 7, 2005
    17,301
    4,800
    Thanks for all the explanations :)

    Thanks for reading (I didn't even proof read the content yet, so there might be even some big brain farts included...).

    I'm not trying to fix the 'ReClock vsync correction not working' problem (I don't use ReClock vsync correction myself because I've never managed to find a vsync 'sweet spot' that works for all material and codecs - e.g. if I find a good setting for 1:2 H.264 it messes up 1:1 HD MPEG-2 - and vv).

    That issue would be solved the my "future proposal", where video renderer is able to guide the reference clock.

    I set out to try and fix/alleviate some of the 'bursts of judder' problems I was seeing, and also make sure (as a side issue) that the code accomodated the 'render clock' changes that ReClock makes e.g. the +/-4% PAL speedup/speedown - without breaking any vsync correction the dshowhelper tries to do internally.

    Those bursts might be coming form the wrong real fps detection code. One easy way to trigger such burst is to play DVD at 32x speed. At first it is smooth,but after maybe 5 seconds it goes havec (most likely the history data in the fps detection gets filled with the skipped frames etc which completely throws off the MPC-HC code that I borrowed. I guess it now just fires back that we haven't implemented custom EVR mixer that would allow the real fps to be gathered).

    I've worked in the video/audio hardware design field for years, so I fully appreciate that video/audio synchronisation and vsync alignment in Windows is a much bigger mess than the MP dshowhelper can hope to fix :)

    It is completely fixable if we either have a reference clock that we can adjust from renderer side or when GPU manufacturers provide HW that has single clock chip.

    Now, with your merits I would even propose a team member status :) After all you would be the only one in our team that really has been working with A/V industry... I would be interested into hear about some more info from your background.

    Note to users/testers:

    ReClock is not compatible with the MP1.1.0 RC2 when it comes to 1:2 material playback. Also it is not perfect when 1:1 or other types are considered, both these are fixable if someone has time...

    Owlsroost's DLL is even less compatible with the ReClock. So, when testing his DLL, it would be nice to test without ReClock, since otherwise there is just two algorithms that are going to fight with each other (in some cases it will work, in some it wont).
     

    red5goahead

    MP Donator
  • Premium Supporter
  • November 24, 2007
    695
    144
    Italy, North West
    Home Country
    Italy Italy
    I'm not trying to fix the 'ReClock vsync correction not working' problem (I don't use ReClock vsync correction myself because I've never managed to find a vsync 'sweet spot' that works for all material and codecs - e.g. if I find a good setting for 1:2 H.264 it messes up 1:1 HD MPEG-2 - and vv).
    I set out to try and fix/alleviate some of the 'bursts of judder' problems I was seeing, and also make sure (as a side issue) that the code accomodated the 'render clock' changes that ReClock makes e.g. the +/-4% PAL speedup/speedown - without breaking any vsync correction the dshowhelper tries to do internally.

    Absolutely correct, you're on the right way for the purpose and the solution even.
    The reclock vsynch correction must become useless also in PAL speedup/speedown situation. :D
     

    tourettes

    Retired Team Member
  • Premium Supporter
  • January 7, 2005
    17,301
    4,800
    I'm not trying to fix the 'ReClock vsync correction not working' problem (I don't use ReClock vsync correction myself because I've never managed to find a vsync 'sweet spot' that works for all material and codecs - e.g. if I find a good setting for 1:2 H.264 it messes up 1:1 HD MPEG-2 - and vv).
    I set out to try and fix/alleviate some of the 'bursts of judder' problems I was seeing, and also make sure (as a side issue) that the code accomodated the 'render clock' changes that ReClock makes e.g. the +/-4% PAL speedup/speedown - without breaking any vsync correction the dshowhelper tries to do internally.

    Absolutely correct, you're on the right way for the purpose and the solution even.
    The reclock vsynch correction must become useless also in PAL speedup/speedown situation. :D

    About the "future proposal", it might be already not required to have any modifications in ReClock (the external interface for advicing...). If ReClock is able to resample audio correctly, based on the frame rate that it monitors it should be already working after Owlsroost provides the rester offset correction (for 1:1 as well).
     

    Jong

    Portal Member
    April 21, 2010
    13
    13
    Home Country
    United Kingdom United Kingdom
    Now, I don't know what ReClock expects, does it expect the paint to be started on the spot that it is monitoring (and how it is even monitoring the raster position when paint happens, since all that should be visible outside the EVR presenter is the v-sync when the frame is drawn... only James knows... :)) or is it the end position (or even something in between :)).
    Yes, I agree terminology can be confusing!!

    To try to answer your question on Reclock, the position of the Reclock vsync marker appears to correspond with the end of paint (plus presumably a scheduling delay). In MPC-HC EVR sync, for example, it is quite noticeable that the Reclock vsync marker is a few ms further down the frame than the green line on the OSD (start paint). It is also noticeable that as you reduce the work the OSD has to do (each press of <ctrl-J> gives a different OSD, some with minimal info) the difference between the EVR sync green line and the Reclock marker closes. Also, if you use a "normal renderer" which double-buffers the Reclock vsync marker is "pinned" just below the start of the frame. In my discussions with ar-jar we understand this to be because when double-buffering "end paint" does not return until after the flip. It is this that stops Reclock controlling what it terms "vsync", i.e. raster offset of "end paint" relative to vsync, with conventional EVR and VMR9. D3D mode introduces additional buffering that means Reclock sees end of paint as soon as the frame is ready to be flipped. Aero seems to do the same (assuming of course there is no "clever" vsync code in the renderer itself), making rendering, from the player perspective, asynchronous to actual vsync, as with Overlay, and allowing Reclock vsync correction to work.

    As you have probably figured, Reclock does not have tight control over the point paint starts, it measures the average point it finished over recent frames and if that falls outside of its target it starts to play with the reference clock to pull things back in line. So Reclock does not really know about "Y" or target it specifically, it just makes sure that on average paint completes well away from any danger.

    not as glitch resistant as possible

    X is result of two things 1) Windows is not a real time OS, so the timers aren't always firing on the exact moment when they should 2) some extra work on CPU / HD could delay code execution after timer has fired. Since we have the Mr. X modifying our results (ReClock doesn't see the X, but EVR presenter will see it) it might rarely happen that we aren't presenting the frame on correct v-sync even when the EVR presenter could fix that.
    You are right, of course, this is not foolproof. But I am not sure that anything Reclock would trip up on would be fixable with the EVR Presenter. Reclock is not actively triggering the start of paint and finding execution happens too late for vsync. It merely makes sure the previous frame is close to its target, let's things happen as fast as they can, and hopes the next one will be ready in time. Maybe this sounds worse!! But I think, in reality, it means that any delay which leads to the next frame not being presented until too late would equally affect the EVR Presenter, but maybe I have missed something? Maybe there are rare occasions when this might be true.

    In practice, if the Reclock vsync marker is set to complete paint around half way through a frame (making sure it is not started until after vsync, or judder occurs) this leaves quite a lot of time for any delayed execution. With XP I used to see spike downward in the green line in EVR sync of as much as 6 or 7ms (C2D 2.7Ghz). However, on W7 I can honestly say I have never seen the green line spike down (although not to say it does not happen). Either way, a Reclock vsync target around 40% of the screen height, with a green line @about 16.5ms @50Hz leaves plenty of headroom (~7ms on XP). It does seem some presenters are much more sensitive to timing than others. I found it took a bit of work to get the right position for TMT3. It seems to need frames presented in a pretty narrow window (maybe 25% of the screen) for smooth playback. Fortunately, this position is compatible with other players that are less sensitive.

    Slow to recover from seeking / channel changes

    Since ReClock is working only based on the "feedback loop", it is taking a lot of time for it to recover from a seek or channel changes. Users can see this by multiple second that are juddering after seeking / changing channel (live tv has also one general issue, solving it would require a time machine... but lets talk about that in some other thread or universe since having a slight buffer will sort it out.)

    Not optimal audio quality because of constant resampling

    First, it wont ever be possible to get bit perfect audio playback when you are targeting to a judder free video (unless GPU manufacturers start to provide GPUs that have one crystal to rule them all... meaning that there would be only one time source for the video and audio clocks).

    But... it would be possible to reduce the need for audio resampling when the driver would see how close we are to the border of presentation window. Driver would instruct the passanger to speed up or slow down only when we are to close to the border.
    I agree with these points. I am still trying to get James to improve the first. It cannot be eliminated completely but it could be better. Audio resampling has become much better though recently with improved code and faster PCs, allowing higher quality modes to be practical. I honestly think for the vast majority it is inaudible. For purists though it will never be bit perfect. Of course if you are using Reclock for 24p->25p, 25p->24p or even 29.97->30fps that is not possible anyway. It is also worth noting that unless the player is bitstreaming or supports WASAPI Windows Mixer messes with and resamples the audio anyway. Reclock does have the advantage it can bypass Windows Mixer completely and ensure only one, high quality resampling takes place .

    Optimal way for the future?

    If the driver would just able to tell where the car is going it would help the passanger to give better driving instructions for the driver himself!

    ar-jar (vertical sync) has been experimenting with video renderer instructing the reference clock. This would be the ultimate solution for rendering. Now, if we only had a change to

    1) do the fine tuning of the frame presentation in EVR presenter (making sure that presentation window is hit)
    2) tell reference clock to speed up or slow down when presentation window limits are reached

    This would require only small change from ReClock. It should implement a IReClock interface that has two methods:

    SetVSyncMode(enum mode) - toggling between current behavior of ReClock and advice mode, where ReClock would listen to the EVR presenter's (or any other presenter's) advices should the clock run faster / slower / or at 1.0 speed
    Advice(double) - this would tell ReClock to modify the reference clock to run at different speed (1.01x for example).

    That way the Mr. X can be killed and video rendering is a bit more close to the perfect.
    This is a good idea. It may be worth trying to open a discussion with James. Even better if you could get ar-jar to join you. It would be better if it were a wider open community request, rather than just a MP one. Also, James is probably trying to crack just the same issue for the mythical(!) "Slyplayer". He may have already done something similar (then I don't know if he would want to open it up) or you may have thought of something he has not. Of course if you do this make sure that you do not turn off Reclock's correction until you are in the middle of your presentation window, or better at the opposite extreme if you can predict the direction of drift. Reclock currently still stops correction as soon as the edges of its target zone are hit. In practice this means correction is continual after a while as drift is normally in one direction. It keeps drifting just out of the target to get nudged only just back into it. It then falls out of it again pretty quickly.

    Off-topic question for tourettes!

    Have you considered trying to implement EVR onto an overlay surface as seems to be done my commercial Blu-ray players in disc mode. TMT3 also uses it for DVD playback. It does nothing for this judder problem (except Reclock vsync works fine with it), but it does mean that YCbCr is passed over HDMI unmolested - no conversion to/from RGB. Tests over at AVS Forum show the YCbCr values to be almost perfectly to spec (as measured at the other end of the HDMI cable). A significant improvement in colour quality over current solutions.
     

    tourettes

    Retired Team Member
  • Premium Supporter
  • January 7, 2005
    17,301
    4,800
    Off-topic question for tourettes!

    Have you considered trying to implement EVR onto an overlay surface as seems to be done my commercial Blu-ray players in disc mode. TMT3 also uses it for DVD playback. It does nothing for this judder problem (except Reclock vsync works fine with it), but it does mean that YCbCr is passed over HDMI unmolested - no conversion to/from RGB. Tests over at AVS Forum show the YCbCr values to be almost perfectly to spec (as measured at the other end of the HDMI cable). A significant improvement in colour quality over current solutions.

    I guess you are talking about the new Windows 7 "overlay" more (not the same as in XP / Vista). Hardware Overlay Support (Windows)

    Looks like it is having quite many restrictions and limitations even from driver support -> Exploring hardware overlay support in Windows 7 - virtualdub.org

    As long as there is some juddering I consider it much bigger issue, much more annoying than slight color space issue. Especially when I don't have enough free money to buy proper tv and beamer :)
     

    Users who are viewing this thread

    Top Bottom