timvideos / edid.tv

EDID Database Website
GNU General Public License v2.0
26 stars 7 forks source link

Correctly calculate the refresh rate of detailed timings #20

Closed pp3345 closed 5 years ago

pp3345 commented 5 years ago

From the first commit message:

Currently, we calculate the refresh rate of a detailed timing by dividing its pixel clock by 1000. This doesn't make any sense.

To get the refresh rate we must calculate the total number of pixels in one complete frame (active + blanking) and divide the pixel clock by that value. Thus, this is the correct formula:

RefreshRate = PixelClock / ((HActive + HBlank) * (VActive + VBlank))

As the pixel clock has steps of 10 kHz, this might result in ugly decimal values. It seems common to use rounding to two digits after the decimal point.