# [mythtv-users] Custom Modeline

Cory Papenfuss papenfuss at juneau.me.vt.edu
Tue Jun 22 08:20:12 EDT 2004

```On Tue, 22 Jun 2004, Iain Waugh wrote:

>> Total horiz line is 910/14.318e6 = 63.556us => 15.73 kHz (sound familiar?)
>
> Not immediately obvious, but see below.

Quite true, but anyone doing this would most likely know that there's a
difference and what it would be.

>
>> Total vert frame is 525/15.73e3 = 33.36ms => 29.97 Hz (sound familiar?)
>
> NTSC = 60Hz (interlaced) = 30Hz ~= 29.97Hz

The 30->29.97 is a (very clever) artifact of going to color.  To keep
the two color channels in quadrature from clobbering each other in the
frequency domain, they had to offset the scan rate ever so slightly.  When
modulated on the video carrier, the inherently sampled spectrum of the horiz
interlaced sweeps fit nicely in between each other.  Very friggin' clever... I
knew exactly how it worked once.

>
> For the rest of the world, the frequencies differ.
>
> http://www.alkenmrs.com/video/standards.html
>
> Previous cut/paste modelines didn't work.  I'm calculating a PAL modeline of
> my own now...

Although you can generate anything you want (provided your vid card
supports it), I've noticed that 4x the video carrier (3.579545 MHz NTSC) is a
*very* popular frequency to have as a base frequency on video cards.  That's
why I'm using 14.318 MHz dotclock.  14.318/910 is exactly 15.73kHz.  For PAL,
(some PAL formats at least... excuse my ignorance on what the "standard
standard PAL is), the video carrier is 4.433618 MHz.  That doesn't go nicely
into the 15.625 kHz horiz frequency (roughly 916 dots at 14.318 MHz).  I'd take
a look through the X logs and see what you video card can/does do:
(II) NV(1): Clock range:  12.00 to 350.00 MHz
You might even look on the card to see if you can program one directly.
4*Vc=17.734 MHz... there might be a crystal for that on there.

I've also noticed that programming the dotclock doesn't necessarily
result in exactly what you ask for.  I've tried to get 14.318, and gotten 14.3
and 14.4 before on different vid cards.  That's not a problem if you're cooking
up a modeline that's going through a tvout anyway, it's still being "scanline
converted."  For my application, I needed it *exact*, so the 14.318 has enough
significant digits to accomplish that.  I also brewed up an ultra-high
resolution by doubling everything horizonal (28.636MHz, 1440x480)... talk about
crisp!  Running through s-vid I put up a test pattern and saw 600 lines of
resolution on the projection TV.  If you're doing this via the SCART direct,
you'll be able to take advantage of it too.  Running through a TVOUT on a vid
card means you're stuck with whatever tradeoffs they decided to put into the
card.

>
> Cheers,
>
> Iain
>

No, Cheers,
-Cory

:)
```