Match refreshrate with input framerate to reduce judder
Match refreshrate with input framerate to reduce judder
Match refresh rate with input framerate to reduce judder and nVidia xrandr support
Published as http://svn.mythtv.org/trac/ticket/5643#comment:5
Patch can be found there:
http://www.avenard.org/files/media/mythtv/adjust_rate.patch
Originally written by Henrik Sorensen, this patch make Mythtv attempts to automatically set the display refresh rate to match the video frame rate. This allows to greatly reduce judder
I then modified this patch to properly handle Nvidia's xrandr unique refresh rate as well as non-integer refresh rates (like 23.976Hz).
Nvidia drivers by default with DynamicTwinView will generate a unique refresh rate for all the various resolutions and screen.
So the refresh rate returned by the xrandr API doesn't match the effective refresh rate..
For example, on my system xrandr would return:
1920x1080 50.0* 51.0 52.0 53.0 54.0 55.0
56.0 57.0 58.0 59.0 60.0 61.0 62.0 63.0
64.0 65.0 66.0
1680x1050 67.0 68.0
1440x900 69.0
1400x1050 70.0 71.0
1360x768 72.0 73.0
1280x1024 74.0 75.0 76.0
Note that all refresh rates start at 50 and keeps increasing by one.
where 1920x1080 50Hz would be 50Hz
1920x1080 51Hz would be 60Hz
1920x1080 52Hz would be 24Hz etc...
As such, mythtv configuration UI in setting custom TV playback video mode will report values that are pretty much useless.
It also prevents MythTV to correctly determining which refresh rate should be used say if the video is encoded at 24fps when the xrandr effective rate to be used is say 52.
Another issues is that MythTV interface to control the refresh rates are using short.
In the US, 24p is really 23.976Hz ; while in PAL countries it would be exactly 24Hz.
Most 24p TV would handle both framerates ; however as this refresh rate is so close to 24 .. X11 will only allow you to use on or the other. Not both at the same time.
This patch also adds support for using non integer framerates; like 23.976Hz or 59.94Hz.
Call me anal, but there is a difference with all those rates ; and so far MythTV couldn't use them.
As the rate used by mythtv and XRANDR are integers ; those rates weren't supported before.
In MythTV setup -> Appearance, check Separate Video modes for GUI and TV playback.
If for the rate you use "Any" this is when MythTV will try to match the TV refresh rate with the video one.
A new field has been added at the bottom of this configuration screen:
Custom screen rate definition file.
Here you enter the path to a text file containing the description of the video rate.
The format of the file is as follow:
width,height,real_rate,xrandr_rate
like this:
#50 - "1920x1080@50"
#51 - "1920x1080@60"
#52 - "1920x1080@24"
#53 - "1920x1080@23.976"
#54 - "1920x1080@50i"
#55 - "1920x1080@60i"
#56 - "1920x1080@59.94"
#57 - "1920x1080@59.94i"
#1920x1080 mode:
1920,1080,50,50
1920,1080,60,51
1920,1080,24,52
1920,1080,23.976,53
1920,1080,59.94,56
Any lines not following the format width,height,real_rate,xrandr_rate will be ignored
In the example above, this will tell mythtv that to use a 60Hz refresh rate, the 51 xrandr rate should be used.
Note that it handles floating point rates like 1920x1080 @ 23.976Hz.
If a given resolution is defined in this definition file, it will replace the rates automatically calculated by X11.
MythTV setup screen will also use and display the real rate (24, 50, 60 etc..) rather than the rate returned by xrandr (50,51,52 etc)...
I'm sure there should be a way to determine what the real refresh rate is from the xrandr ; but I haven't found how yet.
Monday, 16 February 2009