Regen 0.93 Beta 4 + new Debuggers

AamirM's Regen forum

Moderator: AamirM

Eke
Very interested
Posts: 885
Joined: Wed Feb 28, 2007 2:57 pm
Contact:

Post by Eke » Fri Sep 26, 2008 3:52 pm

Then what stretches them? If its the Genesis, I am wrong then and I'll accept that. But unless I missed something, I thought it produced 256 or 320 pixels wide video and due to the pixel clocks it gets stretched.
Technically speaking , TV stretches nothing, it just scans an analogic video signal which have a constant line length (approx. 63.7 us for ntsc).
From this, only a certain part (still constant) can contain active pixel data (including the borders)...

The pixel clock will determine the maximum pixel resolution of the VDP, this means the number of samples by line. The less individuals samples you have on a single line, the more "stretched" original pixels appear on TV screen because the TV is scanning the line at his own constant frequency.

By simulating this stretch, you are not emulating a TV but emulating the analogic video signal which the genesis outputs, which is really important to maintain correct aspect ratio.

Btw, I noticed that the NTSC filter in 256 pixels mode will return a 602 pixels wide image, how does it come and is it really correct ?

Snake
Very interested
Posts: 206
Joined: Sat Sep 13, 2008 1:01 am

Post by Snake » Fri Sep 26, 2008 6:37 pm

Eke wrote:By simulating this stretch, you are not emulating a TV but emulating the analogic video signal which the genesis outputs, which is really important to maintain correct aspect ratio.
It's also important to note that this is the *ONLY* place where an image is generated. The genesis has no 'frame buffer' or anything like that at all. The VDP only creates the image you see at the final output stage, working out what colour each pixel should be and sending them out one at a time. So there is no stretching going on anywhere - this is just how it is.
Eke wrote:Btw, I noticed that the NTSC filter in 256 pixels mode will return a 602 pixels wide image, how does it come and is it really correct ?
You'd have to talk to Blarrg about that one. His plugin basically takes an emulator output, pretends its the signal coming to the TV at a fixed rate, and attempts to emulate the other end of it inside the TV. I think the number of pixels it puts out is something to do with the number of times a TV actually responds to changes. I'm sure it's correct. The guy is a genius.

AamirM
Very interested
Posts: 472
Joined: Mon Feb 18, 2008 8:23 am
Contact:

Post by AamirM » Fri Sep 26, 2008 7:23 pm

Hi,
Snake wrote: It's also important to note that this is the *ONLY* place where an image is generated. The genesis has no 'frame buffer' or anything like that at all. The VDP only creates the image you see at the final output stage, working out what colour each pixel should be and sending them out one at a time. So there is no stretching going on anywhere - this is just how it is.
Although my knowledge about analog imaging and signals is rather limited but I knew that Genesis doesn't use frame buffering. Ah well, I'll do it the way Kega does it then since thats right. I thought TV was stretching it. My bad :oops: .
Eke wrote: Btw, I noticed that the NTSC filter in 256 pixels mode will return a 602 pixels wide image, how does it come and is it really correct ?
Remeber that md_ntsc filter is for 320 pixels mode only. For 256 pixels mode you should use sms_ntsc (if you are not doing it already).

stay safe,

AamirM

TmEE co.(TM)
Very interested
Posts: 2440
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Post by TmEE co.(TM) » Fri Sep 26, 2008 7:33 pm

Actually TV is the thing stretching the image... for example, I have a knob inside my TV which I can use to adjust the height of the image... MD will always output same image, how that image is displayed depends on the output equipment... in NTSC, you have the image stretched out a bit compared to PAL. or if you have the image in NTSC correct, its squeezed in PAL... two end blade... I consider PAL the right way :P
Mida sa loed ? Nagunii aru ei saa ;)
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen

SmartOne
Very interested
Posts: 77
Joined: Sun Sep 21, 2008 5:18 am

Post by SmartOne » Fri Sep 26, 2008 7:48 pm

Please keep some sort of idiot-proof function (for me) to scale the final 4:3 to the largest possible for your indicated resolution.

I'm playing with Kega's Expert Options, but I can't for the life of me figure out how many pixels to add so I can minimize the overscan borders (to try to achieve the above.)

Snake
Very interested
Posts: 206
Joined: Sat Sep 13, 2008 1:01 am

Post by Snake » Fri Sep 26, 2008 8:53 pm

TmEE co.(TM) wrote:Actually TV is the thing stretching the image... for example, I have a knob inside my TV which I can use to adjust the height of the image... MD will always output same image, how that image is displayed depends on the output equipment... in NTSC, you have the image stretched out a bit compared to PAL. or if you have the image in NTSC correct, its squeezed in PAL... two end blade... I consider PAL the right way :P
Well obviously the TV can be altered too, yeah, but the point is that the image coming out of the genesis is always 4:3 no matter what the resolution.

Actually I'm not entirely sure why anybody thought different. What would be the point of the different modes if this wasn't the case?

Snake
Very interested
Posts: 206
Joined: Sat Sep 13, 2008 1:01 am

Post by Snake » Fri Sep 26, 2008 9:03 pm

SmartOne wrote:Please keep some sort of idiot-proof function (for me) to scale the final 4:3 to the largest possible for your indicated resolution.

I'm playing with Kega's Expert Options, but I can't for the life of me figure out how many pixels to add so I can minimize the overscan borders (to try to achieve the above.)
1280,800,60,100,1066,854 should do it.

SmartOne
Very interested
Posts: 77
Joined: Sun Sep 21, 2008 5:18 am

Post by SmartOne » Fri Sep 26, 2008 9:37 pm

Thank you so much! I've been trying to do this for so long.

AamirM
Very interested
Posts: 472
Joined: Mon Feb 18, 2008 8:23 am
Contact:

Post by AamirM » Sat Sep 27, 2008 9:41 am

Hi,
Snake wrote: 1280,800,60,100,1066,854 should do it.
So does Kega, without using expert settings, sets the output to largest multiple of 320x240 smaller than fullscreen res (with Zoom(fit))?

stay safe,

AamirM

SmartOne
Very interested
Posts: 77
Joined: Sun Sep 21, 2008 5:18 am

Post by SmartOne » Sun Sep 28, 2008 3:06 am

Snake wrote:1280,800,60,100,1066,854 should do it.
I am a complete idiot. How do you calculate this for other resolutions? Like 1920x1080. My head hurts. How much border is there? Is that included in 320x240? adfgdah :?:

EDIT: This is what I came up with: 1920,1080,60,100,1498,1158

I couldn't tell you exactly how I got those numbers. For the first, a bunch of multiplication and division. For the second, trial and error. How did I do? What's the correct formula???

Eke
Very interested
Posts: 885
Joined: Wed Feb 28, 2007 2:57 pm
Contact:

Post by Eke » Mon Sep 29, 2008 9:31 am

Snake wrote: You'd have to talk to Blarrg about that one. His plugin basically takes an emulator output, pretends its the signal coming to the TV at a fixed rate, and attempts to emulate the other end of it inside the TV. I think the number of pixels it puts out is something to do with the number of times a TV actually responds to changes. I'm sure it's correct. The guy is a genius.
well, I tried recently to contact him because I would like to simulate the vertical dithering effect in Genesis Plus GX but was not sure about the necessity of using these heavy filters since I already output to a TV

And effectively, his technical comprehension of the NTSC video signal is purely amazing, the NTSC filters are impressive since they could even be considered as emulators themselves.

On a side note, I found out that on the Gamecube/Wii, when I emulate horizontal borders, I need to render 280 (12+256+12) or 352 (16+320+16) pixels streched to the maximal video size (720 pixels), to match my switched Megadrive output perfectly.
I guess that the amount of "stretch" you need to use is related to the target pixel clock and that 602 pixels might be how it should be on a computer screen when compared to a TV screen ? As you said AamirM, this is only for the "sms_ntsc filter" which handle the "256 pixels" mode, the other one will only double the resolution.

I also notided that on a real Megadrive, PAL 50Hz signal somehow appear a little more "stretched" than PAL 60Hz.

tetsuo55
Newbie
Posts: 7
Joined: Mon Sep 29, 2008 12:03 pm

Post by tetsuo55 » Mon Sep 29, 2008 12:07 pm

blargg's NTSC filter is a discrete simulator, this is why it requires so much cpu power.

I'm working on emulating the TV but my coding skills are near 0.

The status so far can be seen here:
http://security-emulation.blogspot.com/ ... ation.html

Note that the CRT-TV simulation will require both the NTSC filter AND the CRT-TV filter for accurate results.

Not all systems/games need this but there are plenty of games out there that can never be accurately emulated without these 2 filters. One example is the fog in Silent Hill for the PSX

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Mon Sep 29, 2008 10:10 pm

That really isn't simulating a TV very well. To REALLY simulate a TV, you need to take the RGB frame and convert it to YIQ. Low-pass filter the Y channel to 2.5 to 3.5 MHz (depending on how "sharp" you want the simulated TV to be). Then low-pass filter the I and Q channels to 0.5 HMz. Then delay the I/Q channels a few milliseconds. Then convert back to RGB.

HardWareMan
Very interested
Posts: 745
Joined: Sat Dec 15, 2007 7:49 am
Location: Kazakhstan, Pavlodar

Post by HardWareMan » Tue Sep 30, 2008 3:47 am

Chilly Willy wrote:That really isn't simulating a TV very well. To REALLY simulate a TV, you need to take the RGB frame and convert it to YIQ. Low-pass filter the Y channel to 2.5 to 3.5 MHz (depending on how "sharp" you want the simulated TV to be). Then low-pass filter the I and Q channels to 0.5 HMz. Then delay the I/Q channels a few milliseconds. Then convert back to RGB.
I have a lot of experience in hamradio and I can tell where you are wrong.
1. Color schemes in TV standards - this is one luminance signal Y and two color signals R-Y and B-Y. Managing the magnitude of the signal Y, we can change the brightness and contrast, while controlling the extent of the R-Y and B-Y - the color saturation.
2. Color accuracy is half of brightness (on vertical). Since all television standards transmit R-Y signal at every even scanline and signal B-Y at every odd scanline. Then, using delay line at 64mks to combine R-Y and B-Y. Thus, the color accuracy of 2 neighboring lines are added. And given that this is all happening in each raster field, then combine the two fields definition color diluted to 4 lines (familiar, eh?).
3. Luminance signal clipped by frequency. The frequency cutoff depends on a system of color is needed to suppress the load of color and getting rid of "dot net" artefact. For NTSC that would be 3.579MHz or 4.43MHz, and for PAL 4.43MHz.
4. The signals R-Y and B-Y and really cut to 0.5MHz.
5. The delay spread of the signal in the decoder chromaticity offset line delays brightness. It delays the signal by about 0.6 microseconds. It will it affect combining color images and brightness.

So, when you want to emulate true low quality TV, you must do this:
Step 1: Get RGB field and split it to 3 separate fields: Y, R-Y, B-Y.
Step 2: Do some blur in every single scanline of Y field (do not blur between scanlines!).
Step 3: Do reduce the vertical resolution of R-Y and B-Y fields twice.
Step 4: Do some blur (more than for Y field) in every single scanline of R-Y and B-Y fields.
Step 5: Do left shift Y field by 0.5-1.5 pixels (or do right shift for R-Y and B-Y fields). This is optional step.
Step 6: Combine again all 3 fields Y, R-Y, B-Y to one RGB field and show it on screen.
This algorythm not depends on total frame resolution.
For emulate SECAM color space YDbDr. For emulate PAL or NTSC can be used YCbCr.
Remember! NES and SegaMD/Genesis do not used even/odd fields for video. They always show full frame in progressive scan. PSX and other powerfull consoles can use interlaced video mode, but you should remember: each frame must be handled separately before deinterlace!

tomaitheous
Very interested
Posts: 256
Joined: Tue Sep 11, 2007 9:10 pm

Post by tomaitheous » Tue Sep 30, 2008 2:33 pm

2. Color accuracy is half of brightness (on vertical). Since all television standards transmit R-Y signal at every even scanline and signal B-Y at every odd scanline. Then, using delay line at 64mks to combine R-Y and B-Y. Thus, the color accuracy of 2 neighboring lines are added. And given that this is all happening in each raster field, then combine the two fields definition color diluted to 4 lines (familiar, eh?).
Not for NSTC RF and composite it's not. R-Y and B-Y are mapped to Q and I color space. They are mapped to a 360 degree color phase chart. The color burst signal on the front porch provides the comparison point in which the subcarrier oscillation is compared to (out of phase to). This happens every scanline.

What you're referring to looks like component output and 4:2:0 color resolution.

Post Reply