Blargg's NTSC Libraries
|Home | News | Info | Code | Misc | Contact|
These libraries perform NTSC video signal processing on an image, giving a result similar to that of the game console connected to a TV and unlike that of a simple palette-based image. Standard controls like color tint and contrast can be adjusted, as well as many low-level parameters like gamma, sharpness, and color bleed. Presets are included for composite, S-video, RGB, and monochrome video quality. Image sharpness can be cranked up to match a usual pixellated image, while still having use of all the other image controls (lower-right image in examples below). See the examples pages for many images. Libraries are available for the following systems listed below (e-mail me if you want a new system added):
The libraries are written in portable C and licensed under the GNU Lesser General Public License (LGPL). They should work well even with older compilers and have been compiled on the following platforms: Windows, Linux, and Mac OS. An archive of previous releases is available in case the latest version doesn't work. Post to the discussion forum for help or to give feedback.
All filters use an optimized algorithm that does all math-intensive calculation during initialization, leaving just a minimal integer-only 14-point RGB convolution and clamping to be performed for each input pixel during filtering. Running the filter at 60 frames per second uses 8% CPU on a 2.0 GHz Athlon PC and 40% CPU on a 400 MHz PowerMac G3, making it suitable for use on almost any system. The pixel output format can be set to 15/16/24/32-bit RGB. For cases where the standard blitter function is insufficient, an interface is included for writing a custom blitter, allowing an optimized implementation for a particular platform, customized pixel format, scanline effects like interpolated line doubling, etc. Each library includes an SDL-based demo that loads a BMP image and displays it with interactive control of filter parameters.
NES NTSC video filter. Pixel artifacts (left images) and color mixing (upper right) play an important role in NES graphics. Contrast with RGB (lower right). Accepts pixels in native 6-bit NES palette format, or a 9-bit format that includes the three color emphasis bits from PPU register $2001. Can also output an RGB palette for use in a regular blitter, and accept a custom input RGB palette that bypasses some of the NTSC color circuitry. If your emulator can only output RGB pixels and not native NES palette colors, use snes_ntsc.
nes_ntsc-0.2.2.zip (C or C++)
Super NES NTSC video filter. The main benefit is color mixing (upper right), as composite video artifacts (left images) are less noticeable than on the NES. Contrast with RGB (lower right). Accepts pixels in 16-bit RGB or 15-bit BGR (native SNES format).
snes_ntsc-0.2.2.zip (C or C++)
Sega Master System NTSC video filter. Reproduces the significant artifacts on the vertical edges of some colors (upper left), and the general color mixing (upper right). Contrast with RGB (lower right). Accepts pixels in 16-bit RGB or 12-bit BGR (native Game Gear palette format). Can also output an RGB palette for use in a regular blitter.
sms_ntsc-0.2.3.zip (C or C++)