View Page Source

Revision (current)
Last Updated by Zinfidel on 3/27/2022 12:57 AM
Back to Page

[https://i.imgur.com/QH7Eq9L.gif]

%%TOC%%

!!! tl;dr
* Analog TVs did not actually stretch their image to a 4:3 aspect ratio.
* The active area part of the signal that TVs displayed ''was'' in a 4:3 aspect ratio, and is bigger than the console's picture.
* When you convert the active area to square pixels, you will get dimensions that are not 4:3, and are different for each console.
* By putting square-pixel game footage in a simulated square-pixel active area, then distorting that to a 4:3 aspect ratio, you get an accurate picture.

!!! Overview
The goal of this page is to explain what is meant by the term "active area" specifically as it applies to its use in formatting and encoding video game footage. The connection between active area and pixel aspect ratio will be established, as well as techniques for using knowledge of a console's active area for accurately sizing emulator recordings. Gross misrepresentations of how analog signals appear will be presented in the pursuit of convenient visualizations to make the topic easier to convey, so it is highly recommended that you learn a little about analog TV first by checking out the recommended reading/viewing section.

!! Recommended Reading/Viewing
* [https://youtu.be/l4UgZBs7ZGo|Lines of Light: How Analog Television Works]

!! Why? How does this information help with encoding speedruns?
Understanding active area will help you understand a few cool tricks that you can use to stretch and resize your emulator video dump so that it will look like it would on a television, since it is not the same as the emulator's output (usually). You may have heard about how TVs would stretch the game image to a 4:3 ratio (this is a misconception); the information on this page will explain what's actually going on there and how to accurately emulate it.

''"Wait, the 256x224px video that my NES emulator gave me isn't how it's supposed to look?"'' Ignoring for now the deeply difficult question of how games were intended to look by the developers, old video game consoles designed to display on analog TVs did not display their framebuffers' square pixels as square on the TV - they were almost always stretched or squished horizontally a bit. The ratio of width to height of the ''dots'' on the TV is what is known as __P__ixel __A__spect __R__atio (PAR). This means that to ''accurately'' represent the game as it would appear on a television, you've got to distort the video's proportions a bit, and the amount is different for each console.

!! Oversimplifications, Misrepresentations, and Damned Lies
The purpose of this page is not to explain how analog television works any more than is needed to explain the active area. There are any number of good sources on the internet (check the recommended links sections for a few) that should be consulted for that. As a lot of the details of how analog TV works are quite complicated and actually make explaining the active area concept more difficult, there will be inaccurate or misleading information on this page because it makes explaining the necessary concepts more practical for the purposes of encoding speedruns. While all attempts will be made to make it clear when inaccurate information is being conveyed, I would be remiss in not laying out these details explicitly, so here is a list.
* Any time the term "NTSC" is used in this document, it could variously refer any one or combination of composite video, the NTSC standard, or the System M system. For the purposes of the information on this page, there isn't a practically useful difference between them, and it's pretty common to just refer to them all as "NTSC" anyway.
* Any mention of "dots" or (or "samples" when referring to a TV screen) having a certain shape or dimension is ignoring the complexity of color television sets' shadow masks and phosphor arrangements that drastically change what's on the screen at a ''micro'' level. At a ''macro'' level however, this complexity is unimportant.
* Speaking of shadow masks, when I talk about an electron beam, cathode rays, or an electron gun in a color television, I am actually talking about ''three'' of each. Again the complexities of how color television works aren't so important to the subject, and talking about a single "beam" entity makes it easier to convey. 
* I will frequently refer to television signals as if they were all progressively drawn, even though the reality of nearly all analog consoles is that they use interlaced signals. The complexities of fields, frames, and interlacing makes visualizing active area very difficult, and pretending we are dealing with progressive signals makes it simpler to explain. Interlacing has important impacts on this subject though, so where it is important, the effects of interlacing as it pertains to active area will be addressed.

!!! Going From Time to Pixels
# The parts of a TV signal that are responsible for actually drawing an image to the TV screen are individually called the "active time" or "active period" of the signal. Active area is defined as discontinuous periods of __time__ at its most basic level.
# If we relate the the active periods of the TV signal to the physical, 4:3 area on the screen that the cathode ray strikes during those times, you get a rectangle in physical space. Active area can be represented as rectangular __physical dimensions__ in space this way.
# Consoles put their pixels into the physical dimensions of the active area by varying the signal levels at a certain frequency, thereby sampling the active area into a grid of lines of samples. With an input device like a console, active area can be represented as a grid of __samples__. These samples are (usually) not squares - they will be little roundish rectangles.
# Modern display devices can't display samples of varying sizes, they display square pixels. If we take the lines of samples from the active area, and convert each sample into a square pixel, we ''resolve'' the active area into a grid of __square pixels__.
# The grid of pixels we get from the previous step won't be a 4:3 rectangle, even though the physical dimensions of the active area were, because we changed the size of the samples when converting them to square pixels. If we take our grid of pixels and scale the horizontal dimension so that the whole image now forms a 4:3 rectangle again, we will have converted our square pixels into __non-square pixels__. These non-square pixels will have a pixel aspect ratio that matches the aspect ratio of the samples, and thus the original image will be recovered.

!! Active area as time
A significant chunk of an NTSC signal contains no visual information. For each line, there is color burst information used to keep the chroma subcarrier synchronized, and front/back porch sections used to allow voltages to stabilize. These parts of the lines are not shown on the TV screen anywhere, and occur before the electron gun/beam is turned on again. There is also information in the signal outside of the time where a frame is being drawn. For instance, there is quite a bit of time in the signal allotted to allowing the electron beam to return to its starting position (VBLANK).

When you hear about an NTSC signal containing 525 lines, what that means is that there are 525 lines' worth of time for every frame. There is a part of the signal that lasts for 486 lines which can contain visual information, and the TV's active area lives on those lines. In each of those 486 lines, the part of the lines that actually contain visual information is the Active Area.

[https://i.imgur.com/FD9UCLC.png]

!! Active Area Visualized as Physical Space
Let's take the diagram from the previous section, isolate just one line, and add some color to it. The green part of the signal is the active area - the part that contains visual information to display on the line. The orange part is the rest of the signal that makes up the line, the part that isn't shown:

[https://i.imgur.com/jfQcdDp.png]

During much of the orange part of the signal above, the electron beam gets turned off (or to a very weak level actually) and starts its journey back to the left side of the screen. If we creatively apply some dimensionality to this one-dimensional signal by stacking the signal diagrams to represent the line signal's "positioning" on the screen, we get this:

[https://i.imgur.com/UmI7Hgc.png]

Finally, lets expand this art experiment to cover an entire virtual television, and also include all of the vertical blanking period, which is a huge chunk of the signal with no visual information at all (no green part):

[https://i.imgur.com/q4ziO5s.png]

If we pretend that the TV's electron beam could scan for the entirety of an NTSC signal, and visualize that as a rectangle of space in front of a TV, we get the orange + green rectangle in the image above. The electron beam in this example would instantly "teleport" from the bottom-right corner of the orange + green rectangle (end of frame), to the upper-left corner of the rectangle (beginning of next frame).

The part of the orange rectangle above the viewable area is mostly the __vertical blanking__ (VBLANK) time, where not much is happening in the signal because we have to wait for the TV's electron beam to reset. In this example we are pretending that this happens instantly, but in reality it takes time for the beam to get back to the top because the inductive forces that control the beam can not change instantly. The part of the rectangle to the left of the viewable area would be where the __horizontal blanking__ occurs, or HBLANK. See the diagram of the NTSC signal line above to see the various parts of HBLANK.

The green rectangle is the __Active Area__ of the signal. It is the physical space over which the TVs electron beam can actually draw an image, though depending on the construction and quality of the TV, not all of the space will be useable. In the graphic above, the TV's bezel would cover some of the useable space, a very common real-world scenario. Most consumer televisions also overscanned, which has the effect of "zooming in" or making the green rectangle larger, cutting away even more useable space.

You'll notice in the above image that the game's image does not fill the entire Active Area. In the idealized TV in the image, it perfectly displays the image in exactly the proportions that the NTSC signal specifies. But in reality, television sets were built within manufacturing tolerances, some looser than others. On cheaper TV sets, the quality of the image towards the edges of the TV glass would degrade quickly. This is due partially to the curve of the TV screen's glass, but also because cheaper components could not maintain quality near the edges of of the electron gun's operational limits. To combat this, manufacturers of these cheap sets would tune these TVs' parameters to "zoom in" the image so that the part of the image that was drawn poorly would be outside of the viewing area of the television set. This is what is commonly known as __overscan__. This is the reason a lot of people remember their video games taking up the entire TV screen - their TVs were zoomed in!

!! Active Area Visualized as Samples

[https://i.imgur.com/ct7yDUn.png]
// TODO
* pixel clock * 52.6 (but more commonly 52.148) = active samples per line
* Width of sample is relative to height, which was determined by labs. Mention this, what was determined to produce square, then lead to next calc
* Width of sample has to do with speed of raster beam, which changes depending on size of TV so that it is commensurate with beam height
* Relate sample rate to square pixel rate (12.27 or 135/11) to get AR of sample.
* Point out that 8/7 SAR in __coincidentally__ the same as PAR for NES
* Show blank border area and relate to NES holding signal low during that period.