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

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

Author:  Jagasian [ Mon Jun 04, 2007 4:13 pm ]
Post subject: 

Why is there animosity against testing the accuracy of the emulation of how a real NES system's video looks? Was there a time when people hated the emulation of the NES's slowdown?

Author:  tepples [ Mon Jun 04, 2007 5:39 pm ]
Post subject: 

Jagasian wrote:
Why is there animosity against testing the accuracy of the emulation of how a real NES system's video looks?

Because it appears people prefer the PlayChoice look.

Author:  Jagasian [ Mon Jun 04, 2007 6:37 pm ]
Post subject: 

tepples wrote:
Jagasian wrote:
Why is there animosity against testing the accuracy of the emulation of how a real NES system's video looks?

Because it appears people prefer the PlayChoice look.


I love the way the Apple II's video output looks, but I sure as hell don't think a NES emulator should try to emulate the Apple II's video output.

blargg wrote:
Jagasian: did you first measure with a ruler a square box drawn with a graphics program? That'd rule out your monitor itself not being calibrated for the PC's square pixels.


I made a square using GIMP and measured it, and it is a perfect square. Then I ran tepples test ROM again, in Nestopia, and measured the NTSC box to be 7.9cm x 8.2cm. Note that I am using a laptop's display to do all of this. So it is a digital display at 1900 x 1200 native pixels.

Author:  baisoku [ Mon Jun 04, 2007 7:40 pm ]
Post subject: 

tepples wrote:
But pixel aspect ratio is another bugaboo of mine, and I've added a second screen to the test program.

That's hot. Nice work, tepples. :)

Author:  byuu [ Tue Jun 05, 2007 11:57 am ]
Post subject: 

blargg wrote:
Nifty update. People so often post about aspect ratio problems for various emulators, and then other people give wrong authoritative answers like "A TV's width is 4:3 the height, therefore pixels are rectangular with the same ratio", even though the width of a pixel depends on the particular console, etc. I'll have to adapt your code to the SNES (including your flashy anti-aliased font heh).


That would probably include me, sadly. Though I don't claim that all TVs are exactly 4:3, I was under the impression both NTSC and PAL were relatively close.

Is 48:35 the authoritive "average" aspect ratio for PAL height:width? Google is failing me.

Author:  dvdmth [ Tue Jun 05, 2007 12:20 pm ]
Post subject: 

byuu wrote:
That would probably include me, sadly. Though I don't claim that all TVs are exactly 4:3, I was under the impression both NTSC and PAL were relatively close.

Is 48:35 the authoritive "average" aspect ratio for PAL height:width? Google is failing me.
The actual aspect ratio (on both NTSC and PAL) is primarily dependent on the number of pixels per scanline (including overscan). Both the NES and SNES generate pixels at the same frequency (ignoring the SNES's Hi-Res mode here), so the aspect ratios should remain the same when comparing NES to SNES output. The fact that the SNES renders fewer scanlines per field (224/239 instead of 240) should not have an impact on the aspect ratio AFAIK.

Author:  tepples [ Tue Jun 05, 2007 12:24 pm ]
Post subject: 

byuu wrote:
Is 48:35 the authoritive "average" aspect ratio for PAL height:width?

I took the 8:7 ratio that we had previously worked out for NTSC and multiplied it by 6:5, the PAL scale factor.

Quote:
Google is failing me.

The PAL color subcarrier is 4433618.75 Hz, and there are 6 pixels per 5 color cycles, meaning the PAL PPU runs at 5320342.5 Hz. Apparently, the active picture area is 51.95 microseconds wide. 51.95 * 10^-6 s * 5320342.5 pixels/s = about 276.4 pixels per active line. Treating 276.4x288 pixels as a 4:3 picture means that 276.4 pixels across is the same as 384 pixels down, for a 1.389:1 pixel aspect ratio, which is just a smidgen wider than the 1.371:1 that the test program assumes. I'll hazard a guess that a +/- 3% tolerance is OK; just don't assume 1.0:1.

Author:  blargg [ Tue Jun 05, 2007 12:54 pm ]
Post subject: 

The only discrete aspect of an NTSC/PAL image is scanlines. Those are an all-or-nothing thing. Anything on screen is a multiple of a scanline height. The width, on the other hand, depends on the video chip that's generating the image. A video chip could make a pixel as wide as the entire screen, and one scanline tall, or as narrow as it likes (too narrow and it will cause artifact colors, as on the Apple II in high-res mode). Thus, there is no such thing as a pixel for NTSC/PAL, just a scanline whose color/brightness/saturation changes over its length, in response to what the video signal is doing at that moment.

If one must define a pixel, it'd make most sense to base its width on a single color carrier cycle. For the TV I posted the images of, we can calculate the size of a pixel using this definition. The NTSC box was 70x80 NES pixels, and measured 80x75 mm on screen. This gives a NES pixel size of 1.1429x0.9375 mm, with an width/height ratio of 1.2191, or about 11/9. A NES pixel's width is 2/3 of a color carrier cycle, so a pixel the width of a single color carrier cycle is 1.7143x0.9375 mm, with an width/height ratio of 1.8333, or about 11/6. Put another way, a square pixel on this particular TV could be achieved by having the video chip make each pixel last 0.5455 (~6/11) of a color carrier cycle, (which is close to what the Sega Genesis does).

I just realized that with tepples' test, an emulator author can side-step the whole issue by providing a "stretch" slider that affects how wide the image appears on the PC monitor. The user is then instructed to adjust this until the appropriate NTSC/PAL box appears nearly square. This takes everything into account, including a PC display that doesn't have square pixels, with an absolute minimum of work.

Author:  Zepper [ Tue Jun 05, 2007 2:35 pm ]
Post subject: 

So... the NTSC thing isn't only the output of your filter, but the aspect ratio too? Here's something...

Image
double sized, 512x480 pixelated

Image
stretched 256x240 into 640x480

Author:  blargg [ Tue Jun 05, 2007 4:01 pm ]
Post subject: 

Yes, NTSC video handling conceptually includes how rectangular each pixel is in addition to the color mixing and artifacts, since the rectangularity is different for PAL. With tepples' test, you can ignore the math and simply focus on whether the NTSC box is nearly square or not; if it is, then the rectangularity of NES pixels is (very likely) handled correctly. Your 256x240->640x480 expansion shows the NTSC box very close to square, thus it's correct.

Author:  byuu [ Tue Jun 05, 2007 4:59 pm ]
Post subject: 

Ok, so basically ...

Code:
void update_video_settings() {
uint width  = 256;
uint height = config::video.region == SNES::NTSC ? 224 : 239;
uint multiplier = minmax<1, 5>(uint(config::video.multiplier));
  width  *= multiplier;
  height *= multiplier;
  if(config::video.aspect_correction == true) {
    if(config::video.region == SNES::NTSC) {
      width = uint( double(width) *  8.0 /  7.0 );
    } else /* config::video.region == SNES::PAL) */ {
      width = uint( double(width) * 48.0 / 35.0 );
    }
  }
  window_main.resize(width, height);
  window_main.view.resize(width, height);
}


That should do, then?

PAL seems really really wide, but I'll trust your math since I've never seen a PAL TV before :/

Author:  Zepper [ Tue Jun 05, 2007 5:24 pm ]
Post subject: 

Resizing isn't that easy as far as I know. There's loss of quality if you do this.

Author:  dvdmth [ Tue Jun 05, 2007 5:58 pm ]
Post subject: 

byuu wrote:
PAL seems really really wide, but I'll trust your math since I've never seen a PAL TV before :/
I can't provide an authoritative answer, not having the luxury of a PAL TV myself, but I have read that the total number of visible scanlines per frame on PAL is significantly larger than the number of lines output by the (S)NES, resulting in a somewhat letterboxed display. (Someone can correct me if I'm wrong.)

Is there anybody here who can take a PAL snapshot of the test ROM? We have yet to verify the accuracy of the PAL box in the test.

Author:  blargg [ Tue Jun 05, 2007 8:08 pm ]
Post subject: 

byuu wrote:
That should do, then?

Wait until we make a test ROM for SNES, then the answer will be completely reliable. "Show me your image" instead of "show me your code" will be sufficient.

Fx3 wrote:
Resizing isn't that easy as far as I know. There's loss of quality if you do this.

Only noticeable if you consider perfectly crisp pixels to be the quality standard. If you're aiming for even an RGB monitor, there will be natural blurring at the edges and even scaling with linear interpolation will look fine (but of course nearest neighbor will never look good, since it adds way too much error).

Author:  byuu [ Wed Jun 06, 2007 8:22 am ]
Post subject: 

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 ...

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