PAL color palette emulation

Discuss emulation of the Nintendo Entertainment System and Famicom.

Moderator: Moderators

User avatar
HardWareMan
Posts: 209
Joined: Mon Jan 01, 2007 11:12 am

Re: PAL color palette emulation

Post by HardWareMan »

Ok. 250MHz sample rate video capture
3 full frames. Still huge oversample. Anyway, you can restore all phase info from it.

Ask your answers.
Last edited by HardWareMan on Sun Dec 23, 2018 9:18 am, edited 1 time in total.
User avatar
feos
Posts: 108
Joined: Tue Apr 19, 2011 11:26 am
Location: RU

Re: PAL color palette emulation

Post by feos »

Correction: by colorburst we see better that it's still a 6 line period, on actual image they indeed look like 3.
User avatar
HardWareMan
Posts: 209
Joined: Mon Jan 01, 2007 11:12 am

Re: PAL color palette emulation

Post by HardWareMan »

I have increased the clarity of the picture with 250MHz samplerate. Now it is possible to specify the phase of each of the colors, and the phase shift relative to the scanlines.
I remind you that PAL has 180 degrees shift in R-Y channel each scanline. And subcarrier has some shift to scanline too. But it still multiple to whole frame and looks like steady dot net.
WOW...

Code: Select all

BURST ______------______------______------______------  
 x1   _------______------______------______------_____
 x2   __------______------______------______------____
 x3   ___------______------______------______------___
 x4   ____------______------______------______------__
 x5   _____------______------______------______------_
 x6   ______------______------______------______------ < BURST PHASE
 x7   -______------______------______------______-----
 x8   --______------______------______------______----
 x9   ---______------______------______------______---
 xA   ----______------______------______------______--
 xB   -----______------______------______------______-
 xC   ------______------______------______------______
WIKI wrote: PAL color burst is believed to alternate between 7 (-U+V) and A (-U-V), so hue is rotated by 15° from NTSC.
6 and not 7.
Last edited by HardWareMan on Sun Dec 23, 2018 9:15 am, edited 1 time in total.
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: PAL color palette emulation

Post by lidnariq »

HardWareMan wrote:
WIKI wrote:PAL color burst is believed to alternate between 7 (-U+V) and A (-U-V), so hue is rotated by 15° from NTSC.
6 and not 7.
Is the rest of the sentence still accurate?
i.e. is this edit correct:
PAL color burst has been found to alternate between 6 (-U+V) and A (-U-V), so hue is rotated by 15° from NTSC.
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: PAL color palette emulation

Post by tepples »

I guess it means 6 on one line and 6 on the next line, which is the same phase as A on the previous line because it flips around 8. And because it flips around 8 (not 8½ as believed before), there's no hue shift unless your TV is misinterpreting it due to the scanline period not matching the 64 μs delay line period or due to the 120/240 swing not matching the expected 135/225 swing.
User avatar
HardWareMan
Posts: 209
Joined: Mon Jan 01, 2007 11:12 am

Re: PAL color palette emulation

Post by HardWareMan »

I think 7 and A goes to 6 and 9 for alternating. And tepples right: for decoder every scanline have the same phase shift for every hue, because it affected to burst and hue together.

PS I've just thinking. x6 is pure red. And if I remember it right the color burst must be R-Y phase. Because PLL of decoder use it for fine tune own generator and R-Y alternating by 180 degrees each scanline for better phase stabilization by eliminate phase error wich NTSC don't have. So, it quite logical.
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: PAL color palette emulation

Post by lidnariq »

Colorburst is at hues -U-V and -U+V, neither of which is really red.... it's more nearly orange.

Red "should" be 14° towards -U from +V, (and yellow 12° towards +V from -U), neither 45° as in the PAL colorburst.

Then again, shade 6 isn't a very pure red...
User avatar
rainwarrior
Posts: 8734
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: PAL color palette emulation

Post by rainwarrior »

After trying out the PAL emulation that was in FCEUX r3112, and trying to understand what the pictures in this thread mean, I am curious about these checkerboard patterns. Is the picture supposed to be downsampled? Can you see these patterns on a PAL TV? (I can't seem to see them in videos of PAL NES footage people have on youtube, etc.)

Example from the filter, and the same image downsampled:
gimmick_fceux_pal_filter_downsample.png
Is the end result supposed to be the one on the right?
User avatar
feos
Posts: 108
Joined: Tue Apr 19, 2011 11:26 am
Location: RU

Re: PAL color palette emulation

Post by feos »

I asnwered in the other thread, but how are you downsampling it? Color borders look quite nice (unless that's what my filter does).
User avatar
rainwarrior
Posts: 8734
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: PAL color palette emulation

Post by rainwarrior »

Why did you answer my question from here in the other thread? (link to answer) My question in the other thread is asking about the existence of tools, not for a description of how PAL works. I asked about the moire patterns here, not there.

The downsampling I used in that picture was just a simple 3:1 horizontal blend (i.e. scale down to 256 pixels wide averaging every 3, then scaled back up with linear interpolation). Any colour artifacts at the edges of shapes are due to patterns in your filter's output.

I just did that as a test to see what it would look like. I never see moire patterns on other people's captures and photographs of PAL NES stuff, I've only seen them in this thread, which is what's confusing to me. I get that you're subdividing the signal into 3 parts per pixel to emulate how the PAL colour is generated, but isn't this missing some critical final bandlimiting step of some sort to smooth it back out into flat colours?

The kind of stuff I see in video captures like this one of Battletoads makes sense to me. Flat areas look like a flat colour, and the edges of shapes get corrupted, similar to how NTSC does but with a different pattern to it than NTSC has.

Where do the capture pictures in this thread of moire patterns come from? Is your capture device special, or designed for higher frequency devices? Do these patterns appear on regular PAL TVs in some cases, or are we only seeing them in this thread because you are doing something special to reveal them?
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: PAL color palette emulation

Post by tepples »

I took rainwarrior's "Example from the filter" and did this in GIMP:
  1. Nearest neighbor scale by one-third vertically
  2. Crop to 756x239, taking into account the PAL PPU's blanking of the left and right 2 pixels
  3. Pad back to 768x240
  4. Notice that flat areas in the filter output have a repeating horizontal pattern of period 4
  5. Convolve horizontally with a box filter that notches out period 4 patterns: [1 1 1 1]/4
  6. Linear scale to 704x240 and then nearest neighbor scale to 704x480 (to nearly correct 11:8 PAR)
But I don't see where the pattern of period 4 comes from, as each PAL pixel is 5/6 of a color burst period wide.
Attachments
gimmick_convolved_1_1_1_1.jpg
User avatar
feos
Posts: 108
Joined: Tue Apr 19, 2011 11:26 am
Location: RU

Re: PAL color palette emulation

Post by feos »

Stretching the image horizontally by 3 was initially suggested by HardWareMan to simplify the calculations, so all my attempts were relying on that method. The first revisions of the filter also have an erroneous 4 scanline pattern instead of a 6 scanline one. I think I fixed it in later revisions.

This stretching approach, however, resulted in wrong samplerate that I mentioned. Hence the exact pattern didn't match the one from a tuner or from a TV, even though without notch filter it did look close to an SVideo capture for an untrained eye.
I never see moire patterns on other people's captures and photographs of PAL NES stuff, I've only seen them in this thread, which is what's confusing to me.
That's because everyone uses the Composite channel to obtain the signal from the console, and because of that, on flat areas, all the colors of the pattern get mixed together. Notch is done by applying some latency to every color, so they bleed together all the time. On flat areas more or less the same color pattern repeats, so they smoothly mix together. But for color edges, it becomes a few pixels of shades of one color, then a few pixels of shades of the other color, and only then it might start repeating. So those don't mix together as well, in the end you see the moire artifacts.

SVideo doesn't apply the notch filter by design, because it's supposed to get Luma and Chroma already separated. NES doesn't output that, but if we plug it into the SVideo channel, we can clearly see the exact pattern of the moire and study/simulate it first. Then we can either smooth the picture out in some way or just cancel the moire rendering for flat areas. I think that's how Blargg's filter does that.

Now here's a pack of all the shot's we've done, both from TV and from our tuners. My tuner is the USB one, the weakest, but it shows some things accurate enough to compare to, tuners from Eugene and HardWareMan are Avermedia, so they produce a picture similar to what you see at GDQ marathons.

https://www.dropbox.com/s/lsvh4nql4m3tssr/shots.7z?dl=0
User avatar
rainwarrior
Posts: 8734
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: PAL color palette emulation

Post by rainwarrior »

feos wrote:NES doesn't output that, but if we plug it into the SVideo channel, we can clearly see the exact pattern of the moire and study/simulate it first.
Ahh, thank you. That explains what I'm looking at.
feos wrote:Now here's a pack of all the shot's we've done
Cool!
User avatar
feos
Posts: 108
Joined: Tue Apr 19, 2011 11:26 am
Location: RU

Re: PAL color palette emulation

Post by feos »

I'm currently updating the archive, put there a video by mistake. If you haven't yet started downloading, wait a few minutes.
User avatar
Eugene.S
Posts: 317
Joined: Sat Apr 18, 2009 4:36 am
Location: UTC+3
Contact:

Re: PAL color palette emulation

Post by Eugene.S »

Last edited by Eugene.S on Sun Apr 26, 2020 5:11 am, edited 3 times in total.
Post Reply