I set phase 8 as color burst (according this) and get this:
As you can see, red and green is swapped. And I don't know why. All phases are correct - I tested it with logic analyzer. Any thoughts?
I guess I know... Need to check it out.
BT.601 says that both NTSC and PAL content can be captured at 13.5MHz. At this rate, the sampled pixels on NTSC are slightly narrow (10:11 PAR, i.e. when displayed on a computer monitor with square pixels it'll look too wide), and the sampled pixels on PAL are slightly wide (59:54, roughly 12:11, i.e. when displayed on a computer monitor with square pixels it'll look too narrow).
Given BT.470 (which says the PAL pixels are "square" at a sample rate of 14.75MHz), the PAL NES PAR should be ≈1.4, and the PAL NES DAR should be ≈1.5.
So, for BW 576i in 48us active time can be shown 48/(1/5,5)=264 elements which equvivalent 528 pixels. And it will be signifant less with PAL encoding. But there one importing thing: it is not alligned to any time slot. CRT has "pixels" as luminophore, but they much smaller than signal can pass. Especially for BW CRTs, they "pixels" so small that only beam focus is matters.
Oversampling in digital TVs and TV tuners at 13,5MHz or higher is matters only for color subcarrier capture, otherwise it can't be able to restore right colors. But it produce higher "resolution" for analog signal: 48/(1/13,5)=648 elements or 1296 "pixels".
48us active time in scanline is useful area, with "overscan", which is obiously not exists, it all about how TVs can support TV standard. Early TVs without raster stabilizer and curve CRT edges cropped active time to have some reserve. Latest CRT TVs is so modern, so they can reach this time almost without any artefacts. I remeber one commercial at late 90's about japan TV which allow to see "hidden" parts of picture. With modern digital LCD TVs it is all senseless. But still supported by manufacturer.
So, quite long post. In conclusion, PAL Dendy (famiclone) and seems like PAL NES to can't have square pixels. I clearly remeber that by this scene from Bucky O'Hare:
On my 4:3 61cm TV it was vertically shrunk and horizontally stretched. At that time (early 90s) I worked at repair shop and was able to fine adjust of my TV. It almost hasn't any overscan (raster stabilizer was able to hold size within 2..3mm swing for 61cm size).
Beside, not 256x224 nor 256x240 can't have square pixels on 4:3 TV (and 16:9 especially). I know that because I participated in BreakNES project. PPU has 341 pixels in whole scanline (with blanking and sync). And only 256 is video. So, only 341-256=85 left for HSync and HBlank. And within 64us scanline for PAL, 16us (4+4+8) is for HSync and HBlank. Now, watch the hands:
That why PPU crop some pixels at left and right.
Here is my decodes:HardWareMan wrote:Ok. Here two records, converted to B/W picture (warning: huge sizes).
500MHz sample rate
(OLD BUGGED: https://imgur.com/a/5FVak U&V swaped at the same time R,B swapped in saving routine causing error to be hidden)
bug was found while checking magnitudes of UV for same luma of decoded output.
Decode done in basic mode. Simple Low pass approach, and sync with burst for fixed pixel range.
Burst frequency assumed to be: 4.43361875 MHz.
Pixel frequency assumed to be: 500 MHz
Formula used to convert RGB from png into IRE:
thus, 0 IRE is 0x33 byte. From high level of burst (20 IRE) to sync level (-40 IRE), considered to be 0x5D,
so delta in 60 IRE = 0x5D delta in png.
composite: N - signal in png; luma: Y = lowpass(N); chroma is detected by lowpass of multiplication (without pre-highpass of N).
svideo: same as composite but Y = N (no lowpass).
comb filter: hue averaging for adjacent lines.
hue rotation correction: after digging into "why hue slightly differ for adjacent lines", it was detected effect discussed below. This is correction provided below.
In provided dump there is some HUE artifacts.
According to what we know about internals of PPU, there are 12 different phases, with 30 degrees step.
and subcarrier is generated by alternating of HIGH and LOW for selected luma.
this means, that HUE can't drift from 30 degrees step...
but in signal there is drift less than 30 degrees, it means that there is analog stuff which make phase drift.
after some investigation (took for me two days of headache), it was determined that most of drift is caused by luma levels.
luma 0 is considered as "without drift", then
luma 1 has drift ~3.8 degrees
luma 2 has drift ~3.8*2 degrees
luma 3 has drift ~3.8*3 degrees
and drift changes sign by each line, similarly to phase alternation of PAL.
this means, that probably it's so called phase delay.
but for linear filters, we use bode plot to show phase delay, but in bode plot phase delay depends on frequency.
here is different case, it depends on voltage, either highest voltage, or average voltage.
Because luma 3 has tiny amplitude, similar to luma 0. If drift would depend on amplitude of oscilation,
it would be similar drift for luma 3 and for luma 0, but NOPE. Luma 3 has biggest drift.
All degrees here is phase of oscilation in signal. In other words, it's angle in axis V*0.877 and U*0.493.
Even though I call it "HUE rotation", it's in V*0.877 U*0.493 space, phases of oscilation.
My correction has a bit more precise values, it uses table:
Code: Select all
0 0 0.0651628589 0.065681 0.1157002756 0.11697625 0.2222102756 0.2225894167
There is also other kind of hue drift, that's why "best" correction result still has some hue artifacts.
By "best" correction I mean: composite+hue rotation correction+comb filter.
Here is table for those who interested in investigation hue effects.
amplitude: half of amplitude of oscilation.
phase: in radians from burst, without any fix for even/odd lines.
same here, radians is phase of oscilation in signal. In other words, it's angle in axis V*0.877 and U*0.493.
middle: middle value.
amplitude & middle is in IRE/100 units. i.e. 100 is 1.0
btw, burst half amplitude is 0.105919 0.107037 (even, odd)
and burst middle level is 0.077083 0.072939 (even, odd)
table has 16*4 rows. to understand what single row mean...
there is 8x8 cells on screen. almost all has colors in it, except 8 cells in second half of screen.
16*4 rows is all cells including "empty ones"
first 16 is all colors of luma 0, i.e. full first row from left to right, and then full fifth row from left to right.
and so on, for all 4 lumas.
Any ideas from where HUE drift based on voltage may come from?
Also, it's considered that PPU has rectangle output. But here it's more like to have more sinus-like output than rectangle.
"Best fit" distorted sine that I come with, is this: https://i.imgur.com/8KKoi12.png
Any consideration why this form also would be nice.
This form of signal doesn't affect angle of U*0.493 V*0.877, it is only changing its magnitude, and leak a bit into Y.
So, this form of signal doesn't rotate HUE.
- (3.52 KiB) Downloaded 155 times
Do you have RAW recoriding of some PAL TV signal? I want to check sanity of my decoder.
Question to everyone.
Does someone knows how old TVs (1995 and below) handle out of range RGB values?
It means negative ones and over 1 ones.
Because as far as I understand my results only differs where I get out of range values.
So, I have found one old post: viewtopic.php?f=21&t=7261&p=117010#p117000
Clip - was by default. Bad result.NewRisingSun wrote:You can either just clip at 0 and 255, or reduce saturation for that color until none clip.
Reduce saturation - tried, it makes colors greyish too much.
Best result so far is my dirty hack. But it's stupid. Old TV should not use my dirty hacks
Also, can you explain in details alignment of levels by TV: black and white.
I thought scale is fixed by voltage, but looks like I'm wrong. I thought 1 V is always 100 IRE.
About white level. TV always trying to stabilize input signal twice: in radio demodulator and at luma path in color module by AGC (Automatic Gain Control). If you use RCA connection only second one used. In luma path, where contrast adjustment happen, because contrast is a difference white level from black level. In addition, contrast adjust also R-Y/B-Y signals to compensate color distortion and overflow in RGB recover. It is not math overflow, it is level limit.
About saturation. Saturation is gain control of signal from color decoder (R-Y/B-Y). This signals are with sign. The have positive and negative values and 0 is mean a BW. Of course TV does not use negative voltage, because it is a complicated things, so they shift to some level to handle gain (some DC added). Then, R-Y and B-Y mixed up with resistor matrix to recover G-Y. And then, full bundle of signal are added to luma.
I cannot see how negative R/G/B levels coming from the color decoder (and after applying contrast, i.e. gain, and brightness, i.e. bias) would not just be effectively clipped (or "limited") to zero, because you cannot excite a phosphor to produce negative light. I cannot imagine any analog TV adding DC to the entire RGB tuple just because one of them goes negative, and all old TVs that I have seen certainly didn't.
On the other end, assuming that the R/G/B levels coming from the color decoder directly drive the beam on an analogue CRT TV, then values above R/G/B 1.0 would just make the picture brighter, as if you had increased contrast for those pixels, until the phosphor is saturated, after which is does not become any brighter. Sort of an "optical" rather than an "electric" clip.
This is difficult to emulate correctly, because on modern systems, R/G/B levels do not drive the display directly, so R/G/B 255 just gets you the maximum brightness at the monitor's current contrast setting. You could remove the overall brightness (on linear light signals, not gamma pre-corrected signals) to give you some headroom, but that of course will make the picture look subjectively darker in general.
There is one partial PAL raw recording in this post. Partial because the capturing program is for NTSC only, and so still samples only for 1/60th time at 8*NTSC-Fsc.r57shell wrote:Do you have RAW recoriding of some PAL TV signal? I want to check sanity of my decoder.