Subpixel rendering
From Wikipedia, the free encyclopedia
Subpixel rendering is a way to increase the apparent resolution of a computer's liquid crystal display (LCD) by rendering pixels to take into account the screen type's physical properties. It takes advantage of the fact that each pixel on a color LCD is actually composed of individual red, green, and blue subpixel stripes to anti-alias text with greater detail.
Contents |
[edit] Background
A single pixel on a color LCD is made of three colored elements—ordered (on various displays) either as blue, green, and red (BGR), or as red, green, and blue (RGB). These pixel components, sometimes called sub-pixels, appear as a single color to the human eye because of blurring by the optics and spatial integration by nerve cells in the eye. The components are easily visible, however, when viewed with a small magnifying glass, such as a loupe.
Over a certain resolution threshold the colors in the sub-pixels are not visible, but the relative intensity of the components shifts the apparent position or orientation of a line. Methods that take this interaction between the display technology and the human visual system into account are called subpixel rendering algorithms. The resolution at which colored sub-pixels go unnoticed differs, however, with each user—some users are distracted by the colored "fringes" resulting from sub-pixel rendering.
Subpixel rendering is better suited to some display technologies than others. The technology is well-suited to LCDs and other technologies where each logical pixel corresponds directly to three independent colored sub-pixels, but less so for CRTs. In a CRT the light from the pixel components often spread across pixels, and the outputs of adjacent pixels are not perfectly independent. If a designer knew precisely a great deal about the display's electron beams and aperture grille, subpixel rendering might have some advantage. But the properties of the CRT components, coupled with the alignment variations that are part of the production process, make subpixel rendering less effective for these displays. The technique should have good application to organic light emitting diodes and other display technologies that organize pixels the same way as LCDs.
[edit] History
Originally invented by IBM in 1988[1], subpixel rendering was first brought to public attention by Microsoft in Windows XP as ClearType, though Apple implemented a similar technology in Mac OS 9[citation needed]. Neither operating system activated the system by default. It was not turned on by default in Mac OS until the first version of Mac OS X. Microsoft did not make it a default until Windows Vista.
[edit] Subpixel Rendering and the Apple II
It is sometimes claimed (e.g. by Steve Gibson) that the Apple II supported an early form of subpixel rendering in its high-resolution (280x192) graphics mode. However, the method Gibson describes can also be viewed as a limitation of the way the machine generates color, rather than as a technique intentionally exploited by programmers to increase resolution.
The bytes that comprise the Apple II high-resolution screen buffer contain seven visible bits (each corresponding directly to a pixel) and a flag bit used to select between purple/green or blue/orange color sets. Each pixel, since it is represented by a single bit, is either on or off; there are no bits within the pixel itself for specifying color or brightness. Color is instead determined by horizontal position: pixels with even horizontal coordinates are always purple (or blue, if the flag bit is set), and odd pixels are always green (or orange). Two lit pixels next to each other are always white, regardless of whether the pair is even/odd or odd/even, and irrespective of the value of the flag bit.
In Gibson's example, then, the programmer is not necessarily placing purple and green pixels to increase the perceived resolution of a white line; he may also be seen as simply drawing a line two pixels wide so as to make it appear white, and this latter mental model is arguably the one that most programmers of the time used. If a diagonal line were only one pixel wide, it would appear alternately purple and green as it meandered down the screen between even and odd horizontal coordinates. While the quote from Apple II inventor Steve Wozniak on Gibson's page seems to imply that Apple II graphics programmers routinely used subpixel rendering, it is difficult to make a case that many of them thought of what they were doing in such terms.
The flag bit in each byte affects color by shifting pixels half a pixel-width to the right. This half-pixel shift was exploited by some graphics software, such as HRCG (High-Resolution Character Generator), an Apple utility that displayed text using the high-resolution graphics mode, to smooth diagonals. (Many Apple II users had monochrome displays, or turned down the saturation on their color displays when running software that expected a monochrome display, so this technique was useful.) Although it did not provide a way to address subpixels individually, it did allow positioning of pixels at fractional pixel locations and can thus be considered a form of subpixel rendering. However, this technique is not related to LCD subpixel rendering as described in this article.
[edit] Addressability vs. resolution
With subpixel rendering technology, the number of points that may be independently addressed to reconstruct the image is increased. When the green subpixels are reconstructing the shoulders, the red subpixels are reconstructing near the peaks and vice versa. For text fonts, increasing the addressability allows the font designer to use spatial frequencies and phases that would have created noticeable distortions had it been whole pixel rendered. The improvement is most noted on italic fonts which exhibit different phases on each row. This reduction in moiré distortion is the primary benefit of subpixel rendered fonts on the conventional RGB Stripe panel.
Although subpixel rendering increases the number of reconstruction points on the display this does not always mean that higher resolution, higher spatial frequencies, more lines and spaces, may be displayed on a given arrangement of color subpixels. A phenomenon occurs as the spatial frequency is increased past the whole pixel Nyquist limit from the Nyquist–Shannon sampling theorem. Chromatic aliasing (color fringes) may appear with higher spatial frequencies in a given orientation on the color subpixel arrangement.
For example, consider an RGB Stripe Panel:
RGBRGBRGBRGBRGBRGB RGBRGBRGBRGBRGBRGB RGBRGBRGBRGBRGBRGB RGBRGBRGBRGBRGBRGB RGBRGBRGBRGBRGBRGB
Shown below is an example of black and white lines at the Nyquist limit, but at a slanting angle, taking advantage of Subpixel rendering to use a different phase each row:
RGB___RGB___RGB___ _GBR___GBR___GBR__ __BRG___BRG___BRG_ ___RGB___RGB___RGB ____GBR___GBR___GB
Shown below is an example of chromatic aliasing when the traditional whole pixel Nyquist limit is exceeded:
RG__GB__BR__RG__GB RG__GB__BR__RG__GB RG__GB__BR__RG__GB RG__GB__BR__RG__GB RG__GB__BR__RG__GB
This case shows the result of attempting to place vertical black&white lines at four subpixels per cycle on the RGB Stripe architecture. One can visually see that the lines, instead of being white, are colored. Starting from the left, the first line is red combined with green to produce a yellow-colored line. The second line is green combined with blue to produce a pastel cyan-colored line. The third line is blue combined with red to produce a magenta-colored line. The colors then repeat: yellow, cyan, and magenta. This demonstrates that a spatial frequency of one cycle per four subpixels is too high. Attempts to go to a yet higher spatial frequency, such as one cycle per three subpixels, would result in a single solid color.
Shown below is an example of how a simple change to the arrangement of color subpixels may allow a higher limit in the horizontal direction:
RBGRBGRBGRBGRBGRBG GBRGBRGBRGBRGBRGBR RBGRBGRBGRBGRBGRBG GBRGBRGBRGBRGBRGBR RBGRBGRBGRBGRBGRBG GBRGBRGBRGBRGBRGBR
In this case, the red and green order are interchanged every row to create a red & green checkerboard pattern with blue stripes. This layout is one of the PenTile Matrix family of layouts. When displaying the same number of black white lines, the blue subpixels are set at half brightness "b":
Rb_Rb_Rb_Rb_Rb_Rb_ Gb_Gb_Gb_Gb_Gb_Gb_ Rb_Rb_Rb_Rb_Rb_Rb_ Gb_Gb_Gb_Gb_Gb_Gb_ Rb_Rb_Rb_Rb_Rb_Rb_ Gb_Gb_Gb_Gb_Gb_Gb_
Notice that every column that turns on comprises red and green subpixels at full brightness and blue subpixels at half value to balance it to white. Now, one may display black and white lines at up to one cycle per three subpixels without chromatic aliasing, twice that of the RGB Stripe architecture. Thus, not all layouts are created equal. Each particular layout may have a different “visual resolution” defined as the highest number of black and white lines that may be simultaneously rendered without visible chromatic aliasing.
[edit] Patents
Microsoft has several patents in the United States on subpixel rendering technology. This has caused FreeType, the library used most current software on the X Window System, to disable this functionality by default.[2] Apple are able to use it in Mac OS X due to a patent cross-licensing agreement.[3]
[edit] Examples
Photos were taken with an Intel Qx3 Microscope at 60x power on a ViewSonic VG191 display. Note that the display has RGB pixels. Displays exist in all four patterns horizontal RGB/BGR and vertical RGB/BGR but horizontal RGB is the most common. In addition, several color subpixel patterns have been developed specifically to take advantage of subpixel rendering. The best known of these is the PenTile Matrix family of patterns.
Note that FreeType with the subpixel rendering functionality shown in these examples cannot be distributed in the United States due to the patents mentioned above.
Lower case e subpixel rendered with FreeType |
|||
[edit] See also
[edit] References
- ^ U.S. Patent #5341153 - "Method of and apparatus for displaying a multicolor image"
- ^ David Turner (2007-06-01). "ClearType Patents, FreeType and the Unix Desktop: an explanation". http://david.freetype.org/cleartype-patents.html. Retrieved on 2009-04-09..
- ^ "LCD Rendering Patches". 2006-09-24. http://lists.gnu.org/archive/html/freetype/2006-09/msg00064.html. Retrieved on 2009-04-09.
- Clairvoyante, Inc., Developers of the PenTile Matrix
- David Turner on patent status of subpixel text rendering
[edit] External links
- Sub-Pixel Font Rendering Technology: History and Explanation by Steve Gibson, includes free downloadable Windows demo.
- SubLCD, a free non patented subpixel method.
- Pixel Borrowing, ClearType and Antialiasing
- Texts Rasterization Exposures Article from the Anti-Grain Geometry Project.