PAL color palette emulation

Discuss emulation of the Nintendo Entertainment System and Famicom.

Moderator: Moderators

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 »

Chroma in both NTSC and PAL is sent on a QAM signal. To isolate chroma from the rest of the signal, use a bandpass filter centered about the carrier frequency. For NTSC, this might be a bandpass allowing 3.0-4.2 MHz.
r57shell
Posts: 9
Joined: Thu Jul 23, 2015 9:56 am

Re: PAL color palette emulation

Post by r57shell »

That's what I'm talking about. I know where it is, and how to get it with "perfect" stuff, like fourier transforms etc. But analog device does work completely different. It can't see future, to perform perfect bandpass. And as you should know bandpass is equal to lowpass+highpass. Also, lowpass is enough to get Y component.

I know what is QAM and how to decode it in "perfect" maner again, but it's analog device, it works different. For example no ringing on borders (steps), only glitch transition, but no after-effects except maybe some particular cases.

That's why I'm asking about analog lowpass, comming in TV, and how other things made there in most of cases.
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: PAL color palette emulation

Post by lidnariq »

The bandpass in analog decoding of NTSC and PAL is made by demodulating first, followed by a sharp lowpass. Even in discrete time versions, because you ultimately need the baseband version of U/V/I/Q, you still usually demodulate first.

Simulating analog decoding on a computer is an exercise in frustration—in practice you're going to end up with something that ultimately is discrete-time anyway. Regardless of whether you're working in continuous or discrete time, you can fake an anticausal filter with a delay line—and, in fact, proper PAL decoding requires a delay line anyway.

P.S. you need a much sharper filter than just a first-order one.
r57shell
Posts: 9
Joined: Thu Jul 23, 2015 9:56 am

Re: PAL color palette emulation

Post by r57shell »

lidnariq wrote:Even in discrete time versions, because you ultimately need the baseband version of U/V/I/Q, you still usually demodulate first.
UV is QAM modulated, so all I need is demodulate, and it's done by modulating with cos() and sin() with applying lowpass after, but as I said, I stucked at simulation of lowpass filter.

delay line is done simple -> just look up line above :D.
lidnariq wrote:P.S. you need a much sharper filter than just a first-order one.
Yes, that is question, what lowpass to use.

I can easily make RGB->YUV->N (composite signal of color only)
but to be able N->YUV->RGB I need apropriate lowpass. I don't like perfect one because of ringing and because it wasn't used in analog tv. It's used now, in LCD, digital TV tuners...
fcism
Posts: 9
Joined: Wed Sep 25, 2013 8:49 pm

Re: PAL color palette emulation

Post by fcism »

Color 0c/1c is greenish cyan on hardwareman's NES,it is wrong ,this color should be azure.
User avatar
HardWareMan
Posts: 209
Joined: Mon Jan 01, 2007 11:12 am

Re: PAL color palette emulation

Post by HardWareMan »

r57shell wrote: Also, from question that I need to solve... when TV decoding UV from composite signal...
1) does it decode UV straight from N (composite signal), or does it decode UV from N-Low_pass(N,3.5MHz), or maybe from High_pass(N,3.5MHz). (frequency is just some random chosen because I don't remember exact value)
2) Any analog low-pass filter introduces delay in signal, so does it synced after? (UV with Y)
[1]
Color decoder gets unmodified CVBS signal. Then it pass it through own subcarrier LC contour and resulting signal used as information for color decoding. LC contour used for subcarrier restore and can oscillate even from some quick Luma level change. That's this happens with BW contour:
Image
[2]
I can say more: color U/V decoder adds delay too. That's why in Luma channel there are Luma Delay Line after separating repeater, to eliminate the effect to color decoder input.
Image
That's right: subcarrier notch filter enabled by color decoder when it detect suitable color signal at input. This was done in order to compatibility to BW television with more frequency in Luma channel (BW contain more details in picture comparing to color).

In DSP era video processor delays output signal, so it has some time to predict color and push the limits eliminating some analog color decoder artefacts. It's true even for CRT TVs with DSP (f.e. with PiP or Teletext abilities). DSP can decode color even by one scanline.
fcism wrote:Color 0c/1c is greenish cyan on hardwareman's NES,it is wrong ,this color should be azure.
It can be sort of AVerMedia TV Tuner decoder artefact.
r57shell
Posts: 9
Joined: Thu Jul 23, 2015 9:56 am

Re: PAL color palette emulation

Post by r57shell »

HardWareMan wrote:Color decoder gets unmodified CVBS signal. Then it pass it through own subcarrier LC contour and resulting signal used as information for color decoding.
Do you mean https://en.wikipedia.org/wiki/LC_circuit
If yes, then, in parallel or in series?

Image
I doubt that this schematics is correct. I guess it's just to "understand" to have some imagination.
Is it really has two separate LC-circuits?
1) one for subcarier separation: high-pass filter or band-pass filter (didn't check what LC-cicruit able to do).
2) one for notch filter: low-pass or band-stop filter.
That actually mean just opposite to fist one, and easies way to implement it just select other output. It's always in this way: if you connecting in "this way", you'll get low-pass, and if you connect to same, but in "other way" you'll get hight-pass. But you can connect in both ways at same time, so you'll get two separate signals: low and high pass. Same with band-stop/band-pass.

That's why I really doubt, about two separate LC-cicruits. But if they are, then there should be reason to do this exactly in this way.

Also, according to this diagram, notch filter does not affect Y (luma) at all. It looks wrong.
HardWareMan wrote:That's right: subcarrier notch filter enabled by color decoder when it detect suitable color signal at input. This was done in order to compatibility to BW television with more frequency in Luma channel (BW contain more details in picture comparing to color).
I don't understand this, because, notch output connected to UV-color, and for BW you don't need UV at all. More details please.

Reason of delay from UV detector is simply phase-response of filters. Yes? :)
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'm guessing you need two filters because you need both outputs: the band-pass output for U and V and the band-stop output for Y.
User avatar
HardWareMan
Posts: 209
Joined: Mon Jan 01, 2007 11:12 am

Re: PAL color palette emulation

Post by HardWareMan »

Yes. This block diagram is "just to understand" the basics. Here is most popular color module 3rd generation CRT TVs in USSR/ExUSSR (clickable):
Image
PAL decoder situated in A2.1 area. It based on TDA3510. C1L1C2C3 circuit that subcarrier restorer LC contour. Pin 1 is for amplitude subcarrier detecting (affect to saturation level) and pin 2 is for phase discover (affect to HUE).

Notch filter situated in the center of A2 area. C25C32L5 ciruit connected right before Luma Delay that marked as DT2. There two electronic switches maked by two transistors marked as VT2 and VT3. They controlled by color decoder and when any of it opens the LC chain connected to the Luma path and can affect to it. There should be 2 different LC contours but USSR engineers cheating with one L and two C for frequency adjust.

Notice that there is DT1 64us delay line for color decoding. Feel free for asking any tech info.

PS Ah, L5 is SECAM notch. PAL notch situated in A2.1 area, L2C1 circuit. Connected to the "A" point of the luma path. Controlled by VT1 transistor. Sorry.
r57shell wrote:Reason of delay from UV detector is simply phase-response of filters. Yes? :)
No. Decoder contains some amplifier stages and demodulaters that realy delays decoded UV signals. TDA3510 internals:
Image
User avatar
feos
Posts: 108
Joined: Tue Apr 19, 2011 11:26 am
Location: RU

Re: PAL color palette emulation

Post by feos »

Can you guys tell me how rainbow effect behaves visually? It occurs when luma value suddenly changes, right? And its color depends on position. But is it known what color is caused by what luma change at what position? Also, how far do they bleed?

Here's a capture of a test rom alternating black and white.
http://savepic.su/6155842.png
http://savepic.su/6159938.png
http://savepic.su/6157890.png
User avatar
HardWareMan
Posts: 209
Joined: Mon Jan 01, 2007 11:12 am

Re: PAL color palette emulation

Post by HardWareMan »

It's easy.
1. They bleed as far as LC contour doing damped oscillations. So, you can play with this to find out most authentic visualization.
2. Color of bleed is phase of BW luma change respect to chroma burst. As we know that BW luma change aligned to pixels and in PAL case there are 6 scanline shift cycle. So, you can calculate the bleeding HUE to any pixel position. It can be done by measuring or result observing on authentic CRT TV.

In fact, those bleeding is artefacts and engineers trying to rid off them. I recall that correct adjustment of the decoder reduces them to a minimum making it imperceptible. In the opposite case, they can be even brighter than the color. Like that rainbow effect in Sonic or Shinobi games on MegaDrive/Genesis.
Image
Image
User avatar
feos
Posts: 108
Joined: Tue Apr 19, 2011 11:26 am
Location: RU

Re: PAL color palette emulation

Post by feos »

1. Does it depend on luma level going up or down?
2. What color should I attach to each position, or how do I figure them out?
3. Fringing even occures a few pixels before the luma level actually changes, how does that happen?

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

Re: PAL color palette emulation

Post by HardWareMan »

feos wrote:1. Does it depend on luma level going up or down?
2. What color should I attach to each position, or how do I figure them out?
3. Fringing even occures a few pixels before the luma level actually changes, how does that happen?
1. I think there is influence. But I can't confirm right now.
2. It can be calculated by distance from burst. Only measurement with oscilloscope can help.
3. This can happen because of notch filter. Some old CRT TVs had some chroma desync.

I tried to synthesize PAL palette using this info. I use a sine function for generate UV signals (technically, I generate three signals: R-Y, B-Y and G-Y. G-Y can be restored from R-Y and B-Y, but in this case it same shifted sine) . This what I've got:
Image
It's rough approach but it's clear that this method is right for PAL (and may be NTSC because they almost the same). Only index of color are used (as color box coordinate) and two luma level used as it in PPU. Discuss.

PS Blurred:
Image
User avatar
feos
Posts: 108
Joined: Tue Apr 19, 2011 11:26 am
Location: RU

Re: PAL color palette emulation

Post by feos »

HardWareMan wrote:2. It can be calculated by distance from burst. Only measurement with oscilloscope can help.
Pretty PLEEEEEEEZE! :roll:
User avatar
HardWareMan
Posts: 209
Joined: Mon Jan 01, 2007 11:12 am

Re: PAL color palette emulation

Post by HardWareMan »

I've got a digital record of video output of PPU:
Image
So, I can build a picture wich can show any phase relationships between hues. And we can see the color burst too.

I also have 3-channel record and can make colored picture.
Image
Should I?
Post Reply