EnTech Taiwan EnTech Taiwan
March 24, 2017, 10:00:38 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1] 2 3 ... 5
  Print  
Author Topic: Possible to get more precise pixel clock info?  (Read 67666 times)
Anonymous
Guest
« on: December 27, 2004, 08:50:32 AM »

Hello Rik Wang!

First let me thank you for the excellent product and support you are giving.

Now to my problem:
I want to get a timing, that is most suitable for video playback from my PC to a CRT-projector. You might know the ReClock filter, that helps to correct some designflaws of the PC architecture. But to not get problems with the sound (that is connected through S/PDIF to an external AC3-Amp in my case), you have to get a HFreq out of the graphics card that is highly in sync with the sound card.

So I have written some script to calculate all possible timings for a given resolution (by altering pixel clock, HTotal and VTotal) and compare the resulting H-frequencies to find some timings that are worth a test. I don't need to know the exact frequency of a given timing, but I need to know if the resulting HFreq is a bit higher or lower than another timing. The problem is, that the pixel clock information from powerstrip only has some limited decimal places. I would need a higher accuracy, because the rounding error of the pixel clock would make the result of the calculation much to faulty.

As far as I understand it:
The pixel clock is produced through a PLL. So there must be some constant divider(s) that will produce the resulting pixel clock frequencies. Even if the result is far from the real world frequency, the relative difference between two frequencies (that is a product of the theoretical PLL-calculation) is all that I need.

Is it possible to get the needed information, so I can calculate every possible (theoretical) pixel clock frequency of the card? In my case it's an ATI Radeon 9600.

Thanks in advance for a reply and greets from germany.
Bitmonster
Logged
Rik Wang
Administrator
*****
Posts: 8833


« Reply #1 on: December 27, 2004, 04:33:24 PM »

PowerStrip already gives you all the possible values, and while it is possible to specify them with more mathematical precision, it can't be done with the current PowerStrip and it wouldn't help with any real-world problems anyway.  Have a look at this thread to see the effect of heat only on a typical reference clock. It is kind of like asking whether a car can be driven at exactly 100.0000050 km per hour, or whether the speedometer can provide more precise readings.

(Before you ask, it can't be done with the current program because it would involve recoding for dozens of controllers, and then regression testing each of them - and their variants.)
Logged

Bitmonster

Posts: 74


« Reply #2 on: December 28, 2004, 07:58:24 AM »

The thread you mention is quite interesting, expecially the thread qubit mentions there.
http://entechtaiwan.net/forums/viewtopic.php?t=1356&postdays=0&postorder=asc&start=15
This nearly seems to be the solution to my problem. If I understand it right, I only need to know the range for M and the base frequency (which is 27.000 MHz in my case). Or is the calculation for a Radeon 9600 completly different?

A more "mathematical" precision would indeed help much for my "real-world problem". Actually I would like to go down to the PLL integer dividers (as no higher precision could be found than this).

I already know the effect of temperature and age to crystal oszillators, but for the "ReClock sound card matching problem" these effects doesn't have much influence, since here we are only interested in the mathematical difference between two values. I'm (and some others) are not interested in an absolute and real frequency. I'm not planing to get 50,0000000 Hz out of my card. I want to get a frequency that is better paired to the frequency of my sound card and I will never know (and I don't need to know) what the real value of this frequency will be. It doesn't matter if the real frequency will actually be near the mathematical values or not. All I need is to find a way how to lower or rise the resulting HFreq in more fine steps. And this can already be done by altering the pixel clock and the porches. It's only a matter of eliminating many tests by knowing the "mathematical" value of the pixel clock as many calculated timings might overlap each other.

For example:
Powerstrip might report a pixel clock of 111.289 MHz. Actually I have to take into account, that the pixel clock could then be in a range of 111.2885 to 111.2895 MHz. If I now calculate the VFreq (for HTotal=1336 and VTotal=833), I have a resulting range of 99,9997 Hz to 100,0006 Hz for the VFreq.

From the observation of the dropped or repeated AC3 frames I then may find, that I have to rise the HFreq, so I calculate a new timing with a pixel clock of 113.350 MHz. So I get a rounding range from 113.3495 to 113.3505. The resulting VFreq range is then (with HTotal=1384 and VTotal=819) 99.9999 Hz to 100.0008 Hz.

As you can see, the resulting ranges overlap, so I don't know which of both timings will be higher or lower than the other.
Logged

Bitmonster
Rik Wang
Administrator
*****
Posts: 8833


« Reply #3 on: December 28, 2004, 08:39:03 AM »

Each card *is* different, of course, which is why changes to the program require a massive amount of regression testing.

But have a look at the xfree86 source code for the Radeon... It sounds like you just need to write something that produces mathematical results that accord with how Reclock goes about calculating values - or the other way round (Reclock, after al, is just another piece of software, not an independent measuring stick...)
Logged

Bitmonster

Posts: 74


« Reply #4 on: December 28, 2004, 11:30:14 AM »

Thanks, I will try to find the xfree86 Radeon source. My first thought was, that the PLL setup of most cards are quite comparable and mostly only the base crystal and the M-range would differ.

It doesn't matter what value ReClock calculates here (eventhough they are a good hint for the first steps). All information that is needed from ReClock is, if the current VFreq is to high or to low for bringing sound and video clocks to a better ganging. And this information (to high or to low but not the absolute amount) ReClock gives with absolute precision. With a long run test you can even determine the degree how good we have achieved the goal with absolute precision.

To say it with your car example:
We don't want to drive at exactly 100.0000050 km per hour, but we want to drive at the same speed as another car (the sound card) that is next to us. So we don't need to know which speed we want to achieve, but we can simply see if we have to push the gas pedal or release it. In a real car this is quite easy, because we have an analog pedal and even an untrained eye sees if we need to drive faster or slower. But for the PC setup it's more complicated, because we have to feed a bunch of numbers (pixel clock, HTotal, VTotal) to our "PC car gas pedal" to get a new speed. But the mathematic behind this process says (if we do it with enough precision), that we can archive a speed that is lower or higher than the current with intent and very fine graduation. And the eye to see if we get near to the right speed is ReClock in this case.

So all goes down to a binary decision: we need to drive faster or slower. All the absolute values in this process are meaningless in the end. They are only mathematically needed for the calculation of a new "gas pedal level" that is worth a try.
Logged

Bitmonster
Rik Wang
Administrator
*****
Posts: 8833


« Reply #5 on: December 28, 2004, 03:37:44 PM »

As with the earlier thread, this would presuppose that you have considerable control over the horizontal scan frequency, which few devices permit (I'm thinking of your typical HDTV, plasma or LCD).

Since the audio "device" (presumably a speaker) is infinitely more flexible than the display device (presumably a HDTV), would it not be better to adjust the audio to match the video, rather than the other way around?
Logged

Bitmonster

Posts: 74


« Reply #6 on: December 28, 2004, 04:00:44 PM »

Since I use a multisync CRT-projector, I'm very flexible with the video timings. Smiley

A sound card has no option to adjust it's clock. The sampling frequency is fixed to 48 kHz or 44.1 kHz for example. So to adjust the sound stream would involve a resampling of the sound (and ReClock already does this for the analog outputs of a sound card). But here I (and most HTPC-users with projectors also do) use an external AC3-Amp over an S/PDIF-connection. Resampling an AC3 or DTS stream would also mean to recompress them with an unacceptable sound quality degression. And since it is not possible to adjust the sound card sampling-frequency, the adjusting of the video card is the only option to prevent lost or repeated AC3/DTS frames.

Would be nice, if manufacturers would someday get aware of this problem and will sell cards with more flexible sync options (by the use of VCXOs for example). And this for both the video and sound card. The problem gets even worse (actually there is no solution till now), if you have to sync to an completely independent clocked source (like TV).

BTW:
I have found the radeon driver source from xfree86. It seems not to be as easy as with the GF2MX that qubit used. I have to analyse the sources in more detail, but it seems, that some basic PLL values (like the feedback dividers) are read out of the cards BIOS. I will try to make a script with some default values to see if I can guess the rest.
Logged

Bitmonster
Rik Wang
Administrator
*****
Posts: 8833


« Reply #7 on: December 28, 2004, 05:15:46 PM »

So you want to output 48.0000kHz - is that it?
Logged

Bitmonster

Posts: 74


« Reply #8 on: December 28, 2004, 05:32:36 PM »

Quote from: "Rik Wang"
So you want to output 48.0000kHz - is that it?

What do you mean with that?

As a HFreq? No.

I have to use 48 kHz samplerate for the sound card. Yes.
But I don't need it to be (and the samplerate is never) exactly 48.0000 kHz. And it's not possible to modify it (without hardware modification).

If you want to say so:
I need a VFreq that has the same error factor (from a theoretical value as 50.0000 Hz) as the sondcards samplerate differ from the theoretical 48.0000 kHz.
If these errors match, ReClock does not need to repeat or drop AC3-frames and that is the goal.
And since this is so, I can take it the other way round and find out if I need a slightly higher VFreq (if i get repeated AC3-frames) or a lower VFreq (if I get dropped AC3-frames). And the amount that I need to correct it can be calculated through the time it takes till one AC3-Frame is dropped or repeated.
If this time goes over 3 hours, I get happy. Smiley
Best value so far ever was 8:30 hours with an 1024x576 resolution. But I need some more resolutions and don't want to spend weeks to test thousends of timings.
Logged

Bitmonster
Rik Wang
Administrator
*****
Posts: 8833


« Reply #9 on: December 28, 2004, 08:31:04 PM »

I was thinking about the auto/mph analogy. You said you want car #1 (video) to run at the same speed as car #2 (audio). The speed of car #2  cannot be changed, so you want to change the speed of car #1. The numeric accuracy of the speeds themselves are not important (but they would need, presumably, to be equally accurate or inaccurate).

I am just trying to see - continuing with the metaphor - if I can help you get to the speed you want car #1 to run at, since I know the car well and know its capabilities. :)
Logged

Bitmonster

Posts: 74


« Reply #10 on: December 28, 2004, 09:23:25 PM »

Quote from: "Rik Wang"
I was thinking about the auto/mph analogy. You said you want car #1 (video) to run at the same speed as car #2 (audio). The speed of car #2  cannot be changed, so you want to change the speed of car #1. The numeric accuracy of the speeds themselves are not important (but they would need, presumably, to be equally accurate or inaccurate).

Yeah, I think you got it. Wink

Quote from: "Rik Wang"
I am just trying to see - continuing with the metaphor - if I can help you get to the speed you want car #1 to run at, since I know the car well and know its capabilities. Smiley

That's why I have targeted this thread at you. Smiley
If somebody in the windows world knows much about how to manipulate the registers of a lot of video cards, then he might most presumably named Rick Wang.

The problem is well described in the ReadMe of ReClock (this ReadMe is only included in the stable release). The last part of the ReadMe is especially about the use of Powerstrip to reduce the problem:
Quote
----------------------------------------------------------------------------------------------------------------------------------------
How to optimize SPDIF output
----------------------------------------------------------------------------------------------------------------------------------------

As said before, SPDIF mode re synchronize the sound with the video part by dropping or repeating AC3 frames which can be unpleasant to the ear.
What can we do for this? First of all, try to play media files that do not need to be “reclocked” by a wide margin. For example, forcing a 24 fps file to play at 25 fps, will result in massive drop of 4% of samples which is too much and should be avoided.

Now, please follow these guidelines:
- if you want to play a file at 23.976 fps (NTSC progressive DVD) or 24 fps, put your monitor or projector at 48 Hz or 72 Hz, or 120 Hz
- if you want to play a file at 25 fps (PAL DVD), put your monitor or projector at 50 Hz or 75 Hz or 100 Hz
- if you want to play a file at 29.970 fps or 30 fps, put your monitor or projector at 60 Hz, or 120 Hz
- if you don’t fall into one of these categories, use the media adaptation called “refresh rate / x” with “x” giving the least speed difference for the file. For example if you want to play a progressive NTSC DVD (23.976 fps) on a NTSC TV (60hz), you should choose “refresh rate / 2.5” that will reclock the movie at 24 fps.

Now you have setup properly you media adaptation, there is something we can do to improve things a little bit. We can fine tune the hardware refresh rate of your video card to make it closer to the clock of you audio card, and this will minimize the number of audio drops and repeats. To do this, you need a tool called Powerstrip which is available on www.entechtaiwan.com.

The procedure is a bit tricky and should be tried by people that know what this stuff mean Smiley

Step 1: setup your hardware properly, and choose the video refresh rate on your video card

Step 2: launch configuration application, and hit “Cleanup manual frame rates database”

Step 3: launch your favourite player and start playback of your media with AC3, set media adaptation as needed. Now wait for the ppm indicator to stabilize to a very low value (under 10 ppm)

Step 4: stop playback, and start it again for 30 minutes. After that, you can see in the properties panel a count of AC3 frames dropped or repeated.
Now make this little computation:
E = “number of sample repeated” – “number of sample dropped”
RATE = ( (1000 x 60 x 30) + (E x 32) ) /  (1000 x 60 x 30)

Step 5: quit your player

Step 6: launch Powerstrip and go to “Display profiles” -> “Configure” -> “Advanced timing options” and check “Ultra fine geometry”. Now have a look on the refresh rate indicated by Powerstrip. Multiply
this number with the RATE value you computed before, and modify it with the new value

Step 7: launch configuration application, and hit “Cleanup manual frame rates database”

Step 8: go back to step 3, and repeat the tests, until you find and optimal “refresh rate” value in Powerstrip

PS: as an alternate method, instead of recomputed each time the refresh rate with the RATE value, you can increase it by little steps if E > 0 or decrease it if E < 0.


So I want to take it only some steps beyond this, by also altering the VTotal and HTotal to get even better timings. And the experience shows, that this way really sufficient results can be achieved.
Logged

Bitmonster
Rik Wang
Administrator
*****
Posts: 8833


« Reply #11 on: December 29, 2004, 05:47:34 PM »

I understand, but what I need to know is the RATE desired, as computed at step #4 OR the refresh rate computed at step #6, as well as the resolution or at least the aspect ratio desired.

Out of interest, I'm curious to know why you feel the need for far, far greater precision than Reclock's own instructions. The example given in the docs is of forcing a 24fps film to play at 25fps. In terms of refresh rates, that would means using 75.000000Hz instead of 72.000000Hz - that's a huge difference or 3Hz, which would make sense to anyone (as would, say, running 24fps at 60Hz or 85Hz).
Logged

Bitmonster

Posts: 74


« Reply #12 on: December 30, 2004, 07:34:56 AM »

Quote from: "Rik Wang"
I understand, but what I need to know is the RATE desired, as computed at step #4 OR the refresh rate computed at step #6, as well as the resolution or at least the aspect ratio desired.

And you need to know the porches range the display is able to handle. That's why this involves some experiments with the setup and some experience of the user.

I don't know how PowerStrip works. Does it already has some deep knowledge about the PLL setup of the cards it handles and therefor would by theoretically be able to calculate all theoretical pixel clock frequencies of the current card?

Quote from: "Rik Wang"
Out of interest, I'm curious to know why you feel the need for far, far greater precision than Reclock's own instructions.

Every single missing or repeated AC3-packet is unpleasing hearable, when it happens in an awkward moment. To say it with the car example: It's like your car runs 99.9999% of the time normal. But you have a device in your car that is supposed to prevent a rear-end collision accident with the car in front of you. So since you missed to drive with the right speed, this device will slam on the breaks in 0.0001% of your driving time. And you nearly fly through the windscreen everytime this happens. So even if this happens only once while your trip (the film), you don't want this to happen.

Quote from: "Rik Wang"
The example given in the docs is of forcing a 24fps film to play at 25fps. In terms of refresh rates, that would means using 75.000000Hz instead of 72.000000Hz - that's a huge difference or 3Hz, which would make sense to anyone (as would, say, running 24fps at 60Hz or 85Hz).

Do you mean the examples given in the instructions I quoted or somewhere else in the ReadMe?

Of course you can play a 24fps film at 25fps, if you resample the sound. But this is only possible for the analog setup and many HT-users rate such approach as unsatisfactory, because they don't want to get the sound resampled and instead use their external AC3-equipment. That's why they only play a 25fps (PAL) DVD at 50Hz, a 24fps (NTSC progressive ) DVD at 48Hz and a 30fps DVD at 60 Hz. So they want to play them with no difference.

Forcing a 24fps film to 25fps would only be desired, if your video device is not flexible with the VFreq. A TV-Out for example is such device, as it is only able to output 50Hz or 60Hz.

Theoretical ReClock is also able to revert the PAL-SpeedUp by forcing a 25fps DVD to 24fps, but this not possible for the S/PDIF-setup (and that this should be avoided is also mentioned in the part of the ReadMe I quoted).
Logged

Bitmonster
Bitmonster

Posts: 74


« Reply #13 on: December 30, 2004, 08:29:43 AM »

BTW: I completely interchanged the term VFreq with HFreq in this thread.  :?

Of course I mean VFreq everywhere I have mentioned HFreq in this thread and vice versa. I was a little confused from the translation as it seems.
Logged

Bitmonster
Bitmonster

Posts: 74


« Reply #14 on: December 30, 2004, 08:32:29 AM »

EDIT: I have edited the awkward error with VFreq and HFreq everywhere.
Only the first post I could not edit.

So now it reads everywhere VFreq when I mean VFreq.  Smiley
Logged

Bitmonster
Pages: [1] 2 3 ... 5
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.15 | SMF © 2006-2008, Simple Machines Valid XHTML 1.0! Valid CSS!