FRC, the ultimate tearfree video solution
Hello to you all who are interested in high quality video playback on Linux! There is one very interesting project in development that allows perfect redraw synchronization when using AMD and Intel graphics hardware. I'm postin here to draw more attention to the project _and_ to make sure AMD hardware is not left behind. Main developer seems to work on Intel at the moment. Technical details follow.
Many of you probably know what causes tearing and unsmooth video playback, but I'm going to explain a bit anyway. The very problem is different screen refresh and video frame/field frequency and the problem that frame rate resampling is anything but simple or perfect. Current solutions are just to ignore it (by dropping or doubling frames) or do the resampling (NVidia Purevideo). The resampling works well if the source is already motion compressed, so motion vectors can be used for constructing frames at arbitrary times. For really high fidelity stuff the workload is very high as motion serach has to be done, just like mpeg compression, but in realtime. Even still, the quality suffers. More processing -> more errors.
Almost all of the above is unnecessary if screen and frame rates are the same. Television does just that. On PC hardware things get a bit tricky as apparently, is wasn't designed with such usage in mind. The project FRC or Frame Rate Control does those tricks purely in software and that makes it qute special. I've been trying to get some attention to the problem before and it may be of value to read a bit there too:
FRC, the _important_ part:
For testing the concepts I suggest a clip of _interlaced_ DV-video with plenty of motion and camera stutter or dvb grab of animated news tickers. Before heading to the FRC it is good idea to play a bit with "cvt" and "xrandr" commands to get proper display modes. You'll need 50 Hz capable monitor for European dvb or digitized PAL. Also cvt rounds framerates somewhat weirdly, but specifying a bit more will get you closer. Like "cvt 1600 1200 50.05" will get 50.01 Hz out. The error would result field jitter every 50/(50.01-50)=5000 fields so once per 100 seconds. Normally that close tolerance is not achievable bacause of the cheap clock crystals and no adjustment. Kaffeine has good controls for deinterlacing, so make sure you are using _one_ frame deinterlacers like linear blend. Otherwise motion is blurred away.
Last but not least I hope to see some developer comments here as this is definitely something to include to VA-API or some other video processing api specification. I remember Brigdman saying something like "frame locking is difficult to get working reliably" somewhere on phronix forums.
Last edited by vesa; 07-20-2009 at 09:46 AM.
Forgive my ignorance, but setting monitor refresh rate each time a movie is played is down right rude.
I think the idea is that the monitor refresh rate is set automatically to precisely match the playback stream.
As vesa says, this *is* the ultimate solution for high quality video as long as your display can work well at the stream's frame rate or a multiple of the frame rate. This gets real interesting when you combine it with a 120Hz display, which can run at an exact multiple of either 24 or 30 Hz frame rates.
I agree with you on this. Fortunately it is not necessay every time. In case of the progressive 24 fps material 50 or 60 Hz will work quite well. Only real video hifists would like 48 or 72 Hz ... Also FRC does the adjustment without full crtc reset (unlike real mode change), so there is no blank period to be seen.
Naturally it all boils down what's the purpose of the machine. I'm running my desktop at 50 Hz all the time because most of the material I work with is digitized PAL or 50 Hz DVB. Also I save a bit of memory bandwidth by using lower refresh. That's on itegrated display controller Q965 and the mb has very nice property of being fully synchroronous with all system clocks (video, audio, I/O...) phaselocked to main crystal reference. (Intel application notes are interesting, btw.) The only grief is bad power bypassing to ALC260 audio chip – maybe I'll fix it someday...
Even though FRC seems to be very SCART centric, it is really just one use of it.
Xtiming script gives better flexibility than cvt as it allows one to tweak sync times too. That way it is possible to get even frequencies without rounding errors. DVI connected LCD seem very tolerant to adjustments.
Some forgotten links follow:
The real test for deinterlacing. Remember that vsync works often only in full screen or in big window. Don't kow the reason though. Kaffeine with ScalerBob is the closest imitation of crt tv and
mplayer -vf yadif=1:1 -fs will get somewhat processed, but very good result.
Is there much use of frame rates over 30 ? My understanding was that 24, 25 and 30 pretty much covered all of the currently available DVD and BD disks (assuming 50i and 60i are displayed as 25p and 30p respectively). I know other formats are supported but AFAIK they aren't actually used much...
That's the gist of the problem. 50i and 60i _must_ be displayed as 50p and 60p on progressive displays to preserve the temporal resolution (fluid movement). I'm still subject to precensoring with links, so my 'official reply' is in the buffer... I'm delighted to see you here though. Any chances to push those patches forward? The author has had very much difficulties to get any discussion going on the relevant lists.
Originally Posted by bridgman
I thought tearing was typically caused by mid-frame display updates; i.e. a phase problem rather than a frequency problem. Is that not the case?
Yes it is. You fix tearing by synchronizing frame buffer updates with the display refresh rate, however that introduces a *new* set of artifacts since the display refresh rate is not quite the same as the frame rate in the video stream. Tear-free code ends up occasionally skipping or doubling frames, depending on whether the video stream frame rate is higher or lower than the display refresh rate, which results in some jitter.
As with tearing, some people can see this jitter while others can not, which results in some interesting threads on the A/V forums.
The way you deal with the skipping/doubling jitter that comes with regular tear-free code is by synchronizing the display refresh rate to the video stream rather than skipping/doubling frames to synchronize the video stream to the display.
Make sense ?
Last edited by bridgman; 07-20-2009 at 11:26 AM.
That's what I thought, but I was a bit confused by the claim of this being "the ultimate tearfree video solution" when it only seems to solve the frame doubling/skipping artifacts. Do those also show up as "tearing" somehow?
Tags for this Thread