nesdev.com
https://forums.nesdev.com/

NTSC emulation test?
https://forums.nesdev.com/viewtopic.php?f=3&t=3393
Page 4 of 5

Author:  tepples [ Wed Jun 06, 2007 1:16 pm ]
Post subject: 

byuu wrote:
EDIT: darn, doesn't seem they sell PAL CRTs very often anymore, and the ones they do seem to be those dual NTSC/PAL ones.

A conforming dual NTSC/PAL TV should switch to PAL "pixel" aspect ratio (where "pixel" = 1/341 scanline period) when fed a PAL signal.

Author:  dXtr [ Wed Jun 06, 2007 2:20 pm ]
Post subject: 

byuu wrote:
If someone wants to draw a 256x224x256-color (or less) bitmap, I can make an SNES ROM with a test image. But we need someone with a PAL copier + TV to verify.

I'll use 48/35 for now, until we hear otherwise. I'd be happy with NES verification, too. It actually doesn't look that bad.

Meh, maybe I should just buy a PAL TV and SNES, I think my UFO is supposed to work on both. I've been asking questions on PAL for over two years and never gotten anything concrete :/

EDIT: darn, doesn't seem they sell PAL CRTs very often anymore, and the ones they do seem to be those dual NTSC/PAL ones. Maybe that will work, maybe not ...


I got a crappy PAL TV and a SNES with a SWC DX2.. so I could probably try it out.

edit: but I probably would need some instructions on what I'm supposed to do when testing it ;)

Author:  byuu [ Wed Jun 06, 2007 5:05 pm ]
Post subject: 

I figured some people here might be interested in this ...

http://board.zsnes.com/phpBB2/viewtopic ... 142#148142

Verdauga Greeneyes took a screenshot of http://i73.photobucket.com/albums/i221/byuusan/som.gif , at a very high resolution (2592x1944), and with a tripod to make sure the image was minimally slanted. I then cropped the "Secret of Mana" logo out of the picture.

Below are my results:

Code:
 127x 43 = 2.953488 -- 256x239 1:1 image size
1140x272 = 4.191176 -- CRT TV image size

43x4.191176 = 180.220568

180.220568 / 127 = 1.419060


So, ~1.42x is very close to tepples' ~1.39x, enough to be the difference between two different TV sets.

But, as we can see, it's definitely way off compared to NTSC's 8:7 (~1.14x). I will probably use a rounded average between our three samples. Maybe 1.40x. It's "close enough", but probably not 100% perfect.

If anyone wants, I can forward them the PAL TV screenshot for double verification. I know it's not a perfect test, but it's the best we can do.

Author:  blargg [ Wed Jun 06, 2007 6:06 pm ]
Post subject: 

Quote:
It's "close enough", but probably not 100% perfect.

I think it's clear that there is no "perfect", since TVs differ slightly in how they distort the image.

I think porting tepple's test to the SNES is a perfect solution, along with emulator authors providing a horizontal stretch slider so that the user can make the correct box square on whatever they're displaying the emulator with. This way the user can calibrate it as closely as desired, or throw it off to match a particular TV.

We should add NTSC/PAL detection to the ROMs to simplify things for the user.

Author:  Zepper [ Thu Jun 07, 2007 4:45 pm ]
Post subject: 

If you capture the TV output through a video card and measure the frame, isn't this the correct thing?

EDIT: OK, now I'm curious. If you output the emulator image to the TV, the test still fails. Why?

Author:  tepples [ Fri Jun 08, 2007 5:40 pm ]
Post subject: 

Fx3 wrote:
OK, now I'm curious. If you output the emulator image to the TV, the test still fails. Why?

If your emulator assumes square pixels, then your video card will just shoot those square pixels straight out to the TV, likely at 7/12 color cycle per pixel, unless you can tell your video card to run in some 560x480 pixel overscan mode.

Author:  blargg [ Fri Jun 08, 2007 6:52 pm ]
Post subject: 

Quote:
If you output the emulator image to the TV, the test still fails. Why?

Because TVs don't have pixels, just scanlines whose hue/saturation/luminance varies from left to right. It's the video ENCODER chip that determines the width of a pixel. The NES has a different video encoder than your PC's video output, so the pixel width probably differs. Your PC's video output probably uses a pixel width that matches scanline height, resulting in square pixels on the TV screen, because PC pixels are usually square and you'd want the image to appear nearly the same on a TV as it does on your PC display.

There's really no difference between the above situation and a normal PC video card connected to a CRT-based display. In the same way, the PC video card determines the width of a pixel, and could make them rectangular if it wanted.

Author:  NewRisingSun [ Sat Jun 09, 2007 10:00 am ]
Post subject: 

I thought this aspect ratio business was a done deal already.

Quote:
If you capture the TV output through a video card and measure the frame, isn't this the correct thing?
Most TV cards don't capture the image properly, at least not with default settings.

Correct pixel aspect ratio (NTSC):
Active scanline is 52+59/90 µs (ITU-R BT.470-6). NES' pixel clock is precisely 6/4*Fsc = 7,5*63/88 MHz, giving 282.7 pixels, or 282 full pixels horizontally.
Active height is 486 scanlines for interlaced, or 243 for progressive pictures (one is always black in progressive, so 242. Since that black line is part of the 4:3 area however, we must include it).
Therefore, the NES active area including overscan is 282x243. For square pixels forming a 4:3 image, you'd need 243*4/3=324 horizontal pixels, giving you the NTSC NES' precise pixel aspect ratio of 324/282, or 54/47, about 1.148936 :)

Correct pixel aspect ratio (PAL):
Active scanline is 52 µs (ITU-R BT.1700). NES' pixel clock is (1135/4 + 1/625)*15625*6/5 Hz, giving 276.7 pixels, say 276 full pixels.
Active height is 576 scanlines for interlaced, or 288 for progressive.
Therefore, the NES active area including overscan is 276x288. For square pixels, we'd need 288*4/3=384 horizontal pixels, giving you the PAL NES' precise pixel aspect ratio of 384/276, or 32/23, about 1.391304. :)

These values are what you should go for, not by empirically measuring screencaps from consumer-grade TV cards, which rarely get things right, or pushing a ruler against your TV. And if you're trying to get your emulator to imitate the image of every cheap-ass TV out there, you'd have to simulate curvature, overscan, phosphor chromaticities and aperture, dust on the tube, the influence of the earth's magnetic field depending on your particular geographic location (no, really!)...

Author:  tepples [ Sat Jun 09, 2007 11:39 am ]
Post subject: 

NewRisingSun wrote:
Correct pixel aspect ratio (NTSC):
Active scanline is 52+59/90 µs (ITU-R BT.470-6). NES' pixel clock is precisely 6/4*Fsc = 7,5*63/88 MHz, giving 282.7 pixels, or 282 full pixels horizontally.
Active height is 486 scanlines for interlaced, or 243 for progressive pictures (one is always black in progressive, so 242. Since that black line is part of the 4:3 area however, we must include it).
Therefore, the NES active area including overscan is 282x243. For square pixels forming a 4:3 image, you'd need 243*4/3=324 horizontal pixels, giving you the NTSC NES' precise pixel aspect ratio of 324/282, or 54/47, about 1.148936 :)

324/282.7 is still damn close to the 324/283.5 resulting from the easy-to-compute-with assumption that scanline height = 7/12 of the width of a color cycle. (Interestingly enough, this results in the 14x12 pixel metatiles of several Apple II games being perfect squares.)

Quote:
For square pixels, we'd need 288*4/3=384 horizontal pixels, giving you the PAL NES' precise pixel aspect ratio of 384/276, or 32/23, about 1.391304. :)

I get 1.38800 by not rounding the 276.66 down, but whatever. Good job on coming up with the data behind the exact values.

Quote:
And if you're trying to get your emulator to imitate the image of every cheap-ass TV out there, you'd have to simulate curvature, overscan

The whole 256x224 myth comes from emus that simulate overscan the wrong way.

Author:  NewRisingSun [ Sat Jun 09, 2007 2:23 pm ]
Post subject: 

Quote:
324/282.7 is still damn close to the 324/283.5
The standard allows quite some tolerance for the blanking and thus for the active duration of a scanline. But blargg already found that that the NES does indeed 282 pixels including overscan.

The only question is whether that weird "pulse" pixel should be considered part of the active area or not; if so, we would need to go with 283 and 324/283 (1.144876) pixel aspect ratio, which would be most unfortunate, since 283 is a prime number. ;)

(I have seen this pulse on imported Japanese NTSC VHS videos, too; never on US ones. I suspect this has something to do with NTSC-J, maybe a help for the TV to properly center the picture, as it can no longer tell the active from the blanking area by looking for a 7.5% setup.)

Author:  tepples [ Sun Jun 10, 2007 1:18 pm ]
Post subject: 

blargg wrote:
Oh, and you might want to add an epilepsy warning for the NTSC test, as it flickered a bunch on the TV (probably due to the PPU alternating between two phases between frames, rather than your code slowly shifting the diagonal pattern).

Done.

blargg wrote:
We should add NTSC/PAL detection to the ROMs to simplify things for the user.

Done.

New version uploaded

Author:  Dwedit [ Sun Jun 10, 2007 3:36 pm ]
Post subject: 

Dammit, now I have to make FlashMe for this nes demo....

Author:  aspectyl [ Tue Aug 25, 2015 3:20 pm ]
Post subject:  Re: NTSC emulation test?

In reply to tvpassfail

Have any of you seen this? It looks to be very thorough multi-platform test (minus NES).
http://junkerhq.net/xrgb/index.php/240p_test_suite

Linearity test is extra useful.

Author:  mikejmoffitt [ Thu Aug 27, 2015 2:31 pm ]
Post subject:  Re: NTSC emulation test?

aspectyl wrote:
Have any of you seen this? It looks to be very thorough multi-platform test (minus NES).
http://junkerhq.net/xrgb/index.php/240p_test_suite

Linearity test is extra useful.

Recreating the suite for the NES would be a good simple project to gain familiarity with the NES PPU.

Author:  tepples [ Thu Aug 27, 2015 5:51 pm ]
Post subject:  Re: NTSC emulation test?

mikejmoffitt wrote:
aspectyl wrote:
http://junkerhq.net/xrgb/index.php/240p_test_suite

Recreating the suite for the NES would be a good simple project to gain familiarity with the NES PPU.

As a start, I've redrawn most of the test screens for the NES, in case anyone else wants to pick up this project.

Attachments:
File comment: 240p test suite, partially redrawn for NES
Row 1: PLUGE, PLUGE highlight, color bars, gray ramp
Row 2: SMPTE bars, SMPTE on gray, bleed check vertical lines, bleed check checkerboard
Row 3: IRE, CPS-2 grid, linearity NTSC, linearity PAL
Row 4: sharpness, overscan, lag test, manual lag test
Row 5: horizontal stripes, checkerboard, grid scroll, backlit zone

240peepatterns.png
240peepatterns.png [ 15.56 KiB | Viewed 2051 times ]

Page 4 of 5 All times are UTC - 7 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/