
Super Mario Bros.
I still need to measure the effect of the emphasis bits, then check things over and post updated NTSC emulator code (the changes are slight, just involving the table initialization). I'm excited about finishing this.
Moderator: Moderators

Uh huh, indeed.WedNESday wrote:RGB will be fine for me thanks. Although I have to admit, the colours do look a bit fuzzy.

Code: Select all
/* Luma amplitudes */
float luma [3] [4] = {
0.39, 0.67, 1.00, 1.00, /* x0 */
0.14, 0.34, 0.66, 0.86, /* x1-xC */
-0.12,0.00, 0.31, 0.72 /* xD */
};
/* Chroma sine wave amplitudes */
float chroma [4] = { 0.26, 0.33, 0.34, 0.14 };
Agreed all the way. The RGB depends on the TV's decoder.Just the levels, please, no RGB.
The NES apparently clamps its NTSC signal on the RCA output. I fed the video card another video signal with pure white and it was about 4% higher than the highest NES levels, so the video digitizer itself isn't clamping either.Also, did you use signal clamping for that screenshot, or did the 3x colors turn out that way by themselves? Or do the 3x colors really have a different amplitude than the rest?
Maybe I should remove that, so people don't prematurely go using it as a "correct" palette (espcially since it was wrong, due to the sine/square wave error mentioned above). People, all that's reliable here are the raw NTSC video waveform values. The images above are with my (somewhat crappy) NTSC emulator. That will be the next thing that gets polished up.Here, I made a .PAL file from Blargg's screenshot. Note that this screenshot is at a hue knob setting of minus 15 or so degrees. If you compare this with a "video-essentials" calibrated TV (hue knob at +/- zero degrees, no hue change), it'll be a little bit more greenish.
I'm not sure you should do that in the NES video encoder, because that will adversely affect the luma artifacts as well. Also, at least on my calibrated TV, it looks exactly like the levels without the 1.27, so maybe we should just ditch that altogether.but I correct an error on my part of using the chroma square wave amplitude directly without adjusting by 1.27 (to get the amplitude of the fundamental sine wave).
I'm not sure color 30's level is within the NTSC spec though. You said you normalized the waveform --- what is the exact voltage for that level?The NES apparently clamps its NTSC signal on the RCA output
That's bad, because the NES' black level is actually the blanking level. In real NTSC, it should be 7.5% above blanking, so your camera isn't up to spec (the American one at least) either.It seems that $0F and $30 roughly match the black and white levels of my video camera (cheap Sony Handycam)
Are you referring to color $0D, or are you referring to xE/xF/1D (which are all nearly the same very dark gray)?NewRisingSun wrote:That's bad, because the NES' black level is actually the blanking level. In real NTSC, it should be 7.5% above blanking, so your camera isn't up to spec (the American one at least) either.
I am refering to the LEVELS.WAV file that Blargg posted. The blanking level during the front/back porch is the same level (minus 50 percent) as what is the level of color 0F, which is black. In American NTSC, "black" should be 7.5% higher than the blanking level, but the NES' black (color 0F) is AT blanking level, probably because in Japanese NTSC, they are the same.Are you referring to color $0D, or are you referring to xE/xF/1D (which are all nearly the same very dark gray)?
This page describes a device that generates a sine wave from a square wave. It says that "the fundamental frequency component of a square wave is about 1.27 times the peak amplitude of the square wave", but more importantly, "and the amplitude of the sine wave output will be approximately 87 percent of the peak of the square wave". So the chroma amplitude should be 87 percent?A square wave of amplitude 1.0 is made of sine harmonics 1.27*sin(t) + 1.27*sin(3*t)/3 + 1.27*sin(5*t)/5 +
Code: Select all
25 sync
4 black
15 colorburst
5 black
1 odd pulse
15 left border (color 0)
256 active
11 right border (color 0)
9 black
------------------------------
341 scanline
If the encoder is generating the filtered signal, it seems it must output the sine wave component of the square wave. The only way to avoid this translation is to generate the signal at many times the normal video bandwidth (which is admittedly the correct thing to do, since that would handle the chopped-off edges between pixels properly). We'd need some more optimization talent to make that work in real-time.I'm not sure you should do that in the NES video encoder, because that will adversely affect the luma artifacts as well.
So 282 NES pixels, or 752 active pixels out of 910 total = 17.4% Blanking. Sounds good to me. So, to properly render a NES picture at the correct aspect ratio, stretch from 282 to 640 if you're working in RGB, or from 282 to 752 if you're doing NTSC artifacting, then shrink back to 640. Then you'll have everything correct.Code: Select all
206 left border (15 pixels) 3515 active (256 pixels) 151 right border (11 pixels)
I'm not sure we should worry about that at all. Empirically, my TV doesn't do that, because if I use the square wave amplitude as the chroma amplitude, everything looks right, whereas with *1.27, it looks oversatured. Is it possible that my TV just does not do the "filter to the fundamental sine wave" thing?If the encoder is generating the filtered signal
If you've got a square wave at 3.579545 MHz (colorburst), then it's got a harmonic at 10.74 MHz, another at 17.90 MHz, etc. These are way beyond a video signal, so I'd expect a TV to remove them at some point. If they are removed, then the remaining sine wave at ~3.58 MHz will have an amplitude higher than you might expect, because the harmonics were canceling its peak somewhat.Empirically, my TV doesn't do that, because if I use the square wave amplitude as the chroma amplitude, everything looks right, whereas with *1.27, it looks oversatured. Is it possible that my TV just does not do the "filter to the fundamental sine wave" thing?
