rawles / edit.tf

An in-browser editor for teletext frames.
http://edit.tf/
GNU General Public License v3.0
91 stars 19 forks source link

Teletext Aspect Ratio #59

Open pjfdirect opened 7 years ago

pjfdirect commented 7 years ago

Proposal

Restrict the width controls to 1.2 (default) and a setting for widescreen TV stretch.

Proper width setting means that photos for tracing and other preliminary art can be accurately prepared without distortion. Although some wide TVs do stretch the image so having the widescreen setting can illustrate that stretch. But in general, 1.2 is 'the proper width.'

Brief details

An unscaled teletext pixel is 1px wide, with a total row width of 480px. Here are some total row widths in the wild, after scaling: 1.19 -> 572px (laser disc) 1.2 -> 576px (LCD TVs, Edit-TF) 1.22 -> 585.6px (SAA5050 chip in CRT TVs)

In addition to being the 'proper' value, 1.2 renders well in modern hardware, particularly when drawing block and smooth mosaics.

Full details

Thanks to a load of help from @rawles, Peter Kwan and Alistair Cree, the SAA5050 pixel aspect ratio has been calculated as 1.22 to 1.

Our starting point is the general teletext spec of 5x9 glyphs sat in 6x10 character cells, resolution doubled to 12x20.

l1 spec b

40 cells times 25 rows and we've got a 480x500 image. Looks too narrow below but that's just the data expressed as square pixels. The proper teletex aspect ratio will yield the right width.

l2 basic c

PAL video is displayed at 768 square pixels per line. Teletext is displayed at a subset of that width, keeping roughly to video's 'title safe' area.

Nowadays the SAA5050 teletext chip is historically quintessential, versus the diverse decoder landscape of the 20th century.

PAL draws each of its lines in 52.6 millionths of a second (μS). The SAA5050 oscillates at 6 million times a second (MHz). To get 'teletext pixels' per line, multiply the first figure by the second and then double it, per the first illustration. The result is 631.2, with the middle 480 used visibly.

Dividing 768 by 631.2 reveals that teletext pixels should be displayed 1.22 times wider than square pixels. The 480px wide display above widens out to 585.6. Below it's mocked up by tweaking the browser's web inspector:

l3 stretched c

52.6μS 6MHz 2 = 631.2 768 / 631.2 = 1.22 480 * 1.22 = 585.6 Rendered Teletext: 585.6 x 500, which looks a -bit- stretched, if I'm honest.

At exactly 1.2 pixels per pixel, we get a display matching this video screenshot from Ceefax's final day. Amid the the widescreen canvas and the BBC2 logo is a 576px-wide frame of teletext. (it appears a bit less wide because of invisible codes in the first column of each line)

l4 final 22-10-12 bbc two

Although the page overall is stretched out by the factor of 1.2, the decoder used here hassn't stretched the text much, instead leaving space between the letters. Here is the page re-created the editor, where both graphics and text are stretched by 1.2.

SimonGoodwin commented 7 months ago

Lovely explanation and pragmatic fix. I’m writing a chapter about Teletext modes on the Pi0 inside the new ZX Spectrum Next. 🤓

HDMI seems to map Teletext resolution better than BBC Micro 1280x1024 factors, at least in the UK.

I assume 50 Hertz. Did others? 😉