PAL video: Difference between revisions
(→Scanline Timing: remove confusing comment about background rendering - PAL always draws things the same way regardless of whether rendering is enabled) |
m (Missing "notes" column name) |
||
Line 71: | Line 71: | ||
{| class="wikitable" | {| class="wikitable" | ||
! ■ || name || start || duration || row | ! ■ || name || start || duration || row || notes | ||
|- | |- | ||
| style="color:#00ffff" | ■ || horizontal sync || 277 || 25 || 240-269 | | style="color:#00ffff" | ■ || horizontal sync || 277 || 25 || 240-269 |
Revision as of 08:33, 14 April 2023
The 2C07 PPU in the PAL NES and the 6538 PPU in PAL famiclones generate composite PAL video in much the same way that the 2C02 generates NTSC video: as a square wave between "high" and "low" levels, offset by 0 to 5.5 master clock cycles from the phase of color burst.
PAL NES video has several key differences from NTSC NES video:
- Phase Alternating Line
- The phase of the V subcarrier inverts between each scanline and the next. The color burst is ideally at 135 degrees relative to the UV plane, not 180. This allows the TV to detect the phase of the V subcarrier by comparing the phase of color burst to that of the previous line. The PAL NES outputs a somewhat nonstandard 120 degree color burst.
- Higher color subcarrier frequency
- Pixels are 5 master clock cycles long (5/6 of a pixel), rather than 4 (4/6), increasing the chroma resolution slightly.
- 50 Hz
- Each field contains 312 lines, not 262, producing vertical underscan and a pixel aspect ratio close to 1.386:1, which is wider than 1.143:1 of NTSC.
- No short line
- The dot at the end of pre-render scanline is never skipped. This combined with the fact that 312 is a multiple of 6 causes the chroma dot pattern not to vary from one field to the next, producing dirty stills but OK movement.
- Phase per line
- The PAL NES scanline has 284⅙ chroma cycles, rather than the standard 283¾. This results in a 6-line pattern of color artifacts, as the phase changes by 60° on each line. NTSC by comparison has 227⅓ chroma cycles per line, giving a 3-line pattern.
- Larger border
- The border, including the area outside the picture, is always black rather than using the background color at $3F00, and it covers the top scanline and the left and right 2 pixels of each remaining scanline.
- Hue shift
- The color hue is slightly different relative to NTSC. There is a 15 degree shift due to the color burst effectively using color phase "7.5" instead of 8, but this difference may be mitigated for brighter colors by PAL's cancellation of differential phase distortion effects (see below), which on NTSC appear to cause a similar shift but only for brighter colors.
- Differential phase distortion
- The output is subject to differential phase distortion like the NTSC PPU, and on individual scanlines the effect may be even more severe on PAL[1], but because the alternating-line mechanism causes the hue distortion to be opposite on consecutive lines, the color error can cancel out vertically when it's not on isolated rows. (See: NTSC video: Color phases)
The 2C07 and 6538 additionally have minor timing differences related to post-render length and OAM refresh; see Clock rate.
There are two different ways that a TV can decode PAL video. The simple way treats PAL as if it were NTSC, modulo the five differences above. If the television signal is subject to phase distortion, this produces an artifact called Hanover bars. The other way is a comb filter: average the received scanline's chroma (U and V channels) with the chroma from the received scanline immediately above it in the same field and use that. This method, invented by an engineer at Telefunken, eliminates Hanover bars at the expense of a 64 microsecond quartz delay line, a royalty payable to Telefunken, and blurred vertical color detail. Less expensive PAL TVs used the simple method and relied on the change in color burst phase over time to cancel out the Hanover bars, though this technique may not be effective with the slightly nonstandard scanline length in the PAL signal from an NES.
Emulator developers planning to simulate PAL video decoding can use a signal captured from a 6538 to test the decoder:
- 250 MHz capture
- Same capture downsampled to twelve times the subcarrier frequency (53.2 MHz), with one pixel per rise or fall of the master clock
Scanline Timing
Values in PPU pixels (341 total per scanline).
The video output of the PPU is delayed by 1 pixel clock in relation to the working PPU memory. In addition, the active video portion is delayed by another 1 pixel clock. Cycle 0, scanline 0 according to the PPU Frame Timing Diagram is marked by the black pixel.
The start times of each entry are thus relative to cycle 0, taking into account the delay. Timings based on Breaking NES Wiki reverse engineered horizontal[2] and vertical [3] decoder functions of the 2C07-0.
Rendering scanlines (n=240):
■ | name | start | duration | row | notes |
---|---|---|---|---|---|
■ | horizontal sync | 277 | 25 | 0-239 | |
■ | back porch (black) | 302 | 4 | 0-239 | |
■ | colorburst | 306 | 15 | 0-239 | |
■ | back porch, continued (black) | 321 | 5 | 0-239 | |
■ | left border (black) | 326 | 18 | 0-239 | |
■ | left border, cropping active video (black) | 3 | 2 | 0-239 | |
■ | active | 5 | 252 | 0-239 | line 0 is entirely cropped by the black border |
■ | right border, cropping active video (black) | 257 | 2 | 0-239 | |
■ | right border (black) | 259 | 9 | 0-239 | |
■ | front porch (black) | 268 | 9 | 0-239 |
Post-render blanking scanlines (n=30):
■ | name | start | duration | row | notes |
---|---|---|---|---|---|
■ | horizontal sync | 277 | 25 | 240-269 | |
■ | back porch (black) | 303 | 4 | 240-269 | |
■ | colorburst | 306 | 15 | 240-269 | |
■ | back porch, continued (black) | 321 | 5 | 240-269 | |
■ | vertical blanking region (black) | 326 | 283 | 240-269 | in the 2C07, VBlank flag is set on scanline 241 |
■ | front porch (black) | 268 | 9 | 240-269 |
Vertical sync scanlines (n=3):
■ | name | start | duration | row |
---|---|---|---|---|
■ | vertical blanking pulse | 277 | 320 | 270-272 |
■ | vertical sync separator (black) | 256 | 12 | 270-272 |
■ | vertical sync separator (front porch, black) | 268 | 9 | 270-272 |
Pre-render blanking scanlines (n=39):
■ | name | start | duration | row | notes |
---|---|---|---|---|---|
■ | horizontal sync | 277 | 25 | 273-311 | |
■ | back porch (black) | 303 | 4 | 273-311 | |
■ | colorburst | 306 | 15 | 273-311 | |
■ | back porch, continued (black) | 321 | 5 | 273-311 | |
■ | vertical blanking region (black) | 326 | 283 | 273-311 | in the UMC UA6538, VBlank flag is set on scanline 291; VBlank (both 2C07 and UA6538) is cleared on scanline 311 |
■ | front porch (black) | 268 | 9 | 273-311 |
This amounts to a total of 312 scanlines.
Libraries
See Also
References
- ↑ Re: PAL chroma merging? TheFox observes a ~60° hue difference between even and odd scanlines.
- ↑ Breaking NES Wiki article on H counter decoder in 2C07-0
- ↑ Breaking NES Wiki article on V counter decoder in 2C07-0
- What is the cause of these three effects? - Some strange decoding effects observed on a PAL television.