The downside to XTREME ACCURACY (tm)

8/26/2010 2:23:03 PM

By RetroRalph

So yes the deadline is coming! The end of August approaches and where is the release?! Well it's still coming, today I'll be talking about some emulation accuracy.

Some people have complained about RetroCopy's interlace emulation when it comes to Sega MegaDrive. Unlike most emulators RetroCopy simulates hardware very close to how it is physically represented, so when people say "make it look like Fusion" or something like this it can sometimes be hard.



So I rejigged how I did interlaced emulation, to make the scanline effect a little less noticeable. Now when this mode is enabled RetroCopy goes to a 30 FPS (or 25 FPS) progressive display. I won't be able to display a 60FPS progressive mode (which is the nicest it can look, but not accurate) like other emulators because it's not accurate and because the design of RC doesn't allow it.

This has nothing to do with me having a personal philosophy that "true emulation" is the only way to play games, I'm all for improving them. However when this improving comes at compromising the design of the emulator I can't really do it without wasting too much time and recoding large swathes of RC. I'd rather have an accurate emulator that played every game without any hacks than one that can run MOST games and some of them look a little better. Maybe one day an emulator will arrive that will do both!

Speaking of accuracy improvements, I spent the last few days fixing up the Megadrive core. I can't find a single game that doesn't work now! Of course there are still some hardware input devices I need to emulate (J-Cart, Lightgun, etc) for completion, however the base megadrive is very close to the real thing. There were some silly bugs in the VDP that were fixed and many timing improvements (the Motorola 68000 now runs on much finer granularity, not completely cycle accurate but memory cycle accurate, which is the best you're going to get in an emulator for a while) which puts the Megadrive very close to the other systems RC emulates. Thanks to Sasha and others for emailing/posting the Megadrive bugs.



Now I'm moving onto tidying up the arcade drivers I added and some .GAME related features and finally it will be ready!

29 responses to The downside to XTREME ACCURACY (tm)

Sasha wrote:

8/27/2010 1:12:46 AM

Thanks Ralph. ;)

Eke-Eke wrote:

8/27/2010 4:29:50 AM

Have you actually look at interlaced mode 2 on a real TV ? It does not look blurred or shakky at all, it's because the Genesis can output a 240-lines interlaced signal at 60hz (just like the Wii by the way, which is why I can accurately emulate this mode in Genesis Plus GX)

The "staircase" output you got is weird though (background seems not to be affected) ... Are you sure you are correctly emulating this mode ? It actually affects the internal VDP rendering: everything is in "double resolution" and the VCounter is affected as well.

DiDaDo wrote:

8/27/2010 4:32:55 AM

RetroCopy, Too Much To Handle :P

RetroRalph wrote:

8/27/2010 5:36:17 AM

@Eke yes I have looked at it. Are you aware of how interlaced mode works? Odd and even fields? Most emulators output a 60hz double line (odd AND even) progressive frame when emulating this mode. When in reality it is really only one field on each "frame", not two. So when you combine the two separate fields into one (deinterlacing) you get an effect whereby the lines won't match up exactly with each other in some instances. In the Sonic example I am scrolling the screen as fast as possible when making those captures, and you can see that each frame is differing by about 4-5 pixels horizontally. The sprites look more shifted because they are animated as well, the rings for instance rotate.

RetroCopy can't redraw the same line (odd and even) within the same frame to do 60hz full progressive , because each pixel is drawn in real time with real cycle counts like real hardware. What you're basically doing in Genesis Plus GX is making a 320x448 frame 60 times a second and letting the Wii handle the output to interlaced. Modern TV's do a pretty good job of de-interlacing so you won't easily spot it on a modern TV. If you do the deinterlacing yourself (like I have here) then you will see the problem. Of course there are more advanced ways to do deinterlacing which minimize most of these problems but it's not something I'm going to be implementing. ;)

Eke-Eke wrote:

8/27/2010 5:54:16 AM

Yes, I am perfectly aware of this and this is how I emulate it (first even field then odd field, the Wii video hardware taking care of interlacing fields at 60 Hz in 240i mode, you need to be correctly sync and fast enough to update eachh field at the right time though)

What PC emulators generally do is having a 480 lines framebuffer and in interlaced mode, render even lines on the even field, odd lines on odd field (still at 60hz), it's still quite accurate as long as you don't render 2 lines per field.

But you are right you can not output those 480 lines at 60hz if you are not also "blanking out" the lines that are not supposed to be displayed (i'm not sure if what i'm saying is quite clear, sorry for that), otherwise you can get weird effect (previous odd lines being displayed with the current even ones).

If you want to do that you need deflickering filters (again, the Wii do this natively in hardware in 480i or 480p video mode so it's fine) if you want to do that, but this looks blurry indeed ... or as you are saying, render 480 lines at 30hz . I didn't understood first that your screen was a capture to show the "bad" effect in movement.

RetroRalph wrote:

8/27/2010 6:05:45 AM

Ah, wasn't aware you could output each field separately under the Wii. That is nice. But yes, on PCs we don't have the interlaced modes (at least on any LCD monitor) so you can either do what most emulators do (320x448 60hz) which is nice and doesn't exhibit any of the effects I've shown or do it like we are (320x224 @ 60hz interlaced).

On PC monitors you will see the worst effects of interlaced content which is why quality deinterlacers are so sought after. The new version of RetroCopy at least has filters which can sort of simulate the blurring that happens on a real CRT minimizing the effects.

Eke-Eke wrote:

8/27/2010 6:22:00 AM

Yes, that's why running emulator on a real TV is incredibly fun and still outstanding compared to PC emulators.

I tested Genesis Plus GX "original" mode against my switched MD2, both on RGB on the same TV and I could not see any visual differences (apart those freaky CRAM dots in some games). Just got an adapter for Mega Drive controller and you are set, the "perfect" revival experience :-)

RetroRalph wrote:

8/27/2010 6:28:12 AM

Yeah that does sound nice. Does the Wii give you 0 latency in regards to the video output (like a real MD) or is buffering going on? When 240+hz monitors become the norm for PC we will be able to do better emulation of a CRT display and get very low latency.

Eke-Eke wrote:

8/27/2010 6:30:32 AM

Hum, i only realized this after posting but sorry if this felt like I "advertised" my own emulator on your website, this was definitively not my goal.

Eke-Eke wrote:

8/27/2010 6:38:24 AM

To answer your question, there is zero video latency, I use double buffering techniques to ensure the frame buffer (which Wii video hardware outputs) is always filled in time. I had some trouble with Sonic 2 interlaced mode because I was first syncing emulation with audio and unfortunately this leaded to occasional frame skipping each 4-5 seconds (with the effect you can imagine on this mode). I rewrote everything to be synced with video interrupt instead and emulate sound chips so that they are exactly in sync with the Wii frame rate to ensure there isn't any sample skipping as well. This brought some hard brainstorming to figure exactly how to do this but the result is rather satisfying.

RetroRalph wrote:

8/27/2010 6:53:54 AM

Well RetroCopy isn't on Wii (and doubt it ever will be) so there is no harm in advertising it. ;)

Yeah the timing would be hard to do right, it's why we need better display devices so we can do a more accurate emulation. If the video is zero latency are you aware of the Wii audio latency?

Eke-Eke wrote:

8/27/2010 7:11:33 AM

As far I know, lot of emulators use big audio buffers (thus increasing latency) and feed samples in the audio callback, genesis plus doesn't really do that, samples are made available after each frame and the difficulty is to keep everything in sync and make sure new samples are available when the previous audio frame has finished to be played by audio hardware

I dunno exactly about the latency, what you do on Wii is programming audio DMA which then starts outputting audio immediately (there must be hardware latency but it is really not noticable). I reprogram audio DMA on each frame with the sample buffer rendered for that frame (again, using double buffering techniques to avoid waiting for the current buffer access). Audio DMA is initially started at the first VSYNC and it is programmed so it stays in sync with Video Interrupt, so latency should be very minimal.

Waxonator wrote:

8/27/2010 10:34:45 PM

Emulator fight!

RetroRalph wrote:

8/27/2010 11:20:34 PM

With RetroCopy v0.800 on Vista/Win7 the hardware audio latency is now only 5ms. RetroCopy deals in frames also, so essentially you're going to have a 5ms+17ms inherent latency in audio. Compared to 99% of emulators it's quite low. I think people will be surprised by the new audio engine in RetroCopy, 3D mixing, low latency, RC talking directly to sound card so the emulation signal isn't touched by Microsoft! ;)

I don't really agree with resampling the audio to fit in with the video, but given the restrictions on Wii it's probably the best thing to do. I look at such problems on the PC end as "upgrade your hardware if you care". 75+Hz monitors solve missing video frames due to a 60.1 emulation framerate. Personally I don't mind missing the odd video frame (1 every 10 seconds) as you can barely notice it, but I can usually notice audio resampling unless it's decent quality.

I will be targeting the next generation of consoles and possibly the XBOX360. Though I suspect all the cores except the SEGA arcade ones would run at 100% on Wii, a 1GHz I7 equiv can run them now. I still have some optimizations I could do (VDP caching) that would improve speed further. At the moment there is only about 500 lines of platform specific code in it, and is what I spent most of the last few months working on to make it more platform independent.


Waxonator wrote:

8/28/2010 12:09:35 AM

PC is still the priority, now.

Waxonator wrote:

8/28/2010 5:34:28 PM

Is there a crop feature for the video? If I play a 16:9 movie on a 4:3 screen, I want it to take up the whole screen.

RetroRalph wrote:

8/28/2010 10:46:46 PM

Yes I added new zoom methods, which apply for every system (including video playback which I say is a system). You can do a crop and zoom, a full screen stretch which doesn't maintain the aspect ratio, and the two usual zoom methods from previous versions.

Waxonator wrote:

8/29/2010 2:05:45 AM

Ok, thanks a lot! :D

panzeroceania wrote:

8/30/2010 3:12:12 AM

I still use a CRT on my modern gaming PC because it can output at a higher refresh rate, and supports many refresh rates and resolutions with native capabilities, LCDs only have one native refresh rate and resolution.

Ralph, you should look into getting an Arcade or graphic artist CRT Monitor for your PC so you are getting a more accurate representation of what your emulator is doing.

RetroRalph wrote:

8/30/2010 3:51:46 AM

Yeah I would like to see how it looks on a CRT, but it's really not that needed. The future is going to be LCD or LED, not CRT. LCD's already have refresh rates over 240hz, and eventually will hit a rate whereby emulating CRT in real time becomes possible.

Since TV's and monitors these days are either LCD,PLASMA or LED there is no point in optimizing how RetroCopy looks on things very few people use. RetroCopy's video timing is also extremely accurate and given the right displays will work as close to real hardware as the display device can give.

Waxonator wrote:

8/30/2010 1:17:35 PM

August is almost over. ;)

panzeroceania wrote:

8/30/2010 2:43:08 PM

good point, although you forgot a few things.

1. while LCDs are getting higher refresh rates, it's mostly TVs, and they don't actually run content that is running at 120hz or 240hz, they upsample 60hz content to that level, so it's not true 120hz yet, something that can already be done on a CRT, but I understand your point.

2. the future isn't necissarily LCD or LED, in fact, it could be SED or FED

http://en.wikipedia.org/wiki/Surface-conduction_electron-emitter_display

http://en.wikipedia.org/wiki/Field_emission_display

which actually are quite similar to CRT displays in the way the technology functions, except flat screens.

There has already been a demo showing Gran Turismo 5 running on an FED display off of 4 PS3s at 240Hz.

http://www.displayblog.com/2008/11/20/fe-technologies-19-nano-spindt-fed/

then there are also laser displays, which have been told to run as fast as 1000hz so I'd certainly keep your eyes on the multiple display technologies on the horizon.

There is also OLED.

RetroRalph wrote:

8/30/2010 10:10:48 PM

Yeah I haven't stayed completely up to date in all the new display technologies, so thanks for highlighting some of them. My point is simply that CRT is inferior in most ways and only offers a few advantages at this point in time. Those advantages it still holds onto will disappear soon. I'd rather emulate a CRT display than actually use one because to have a large display you would need a washing machine sitting on your desk.

I had a very good 21 inch CRT monitor that could do around 100hz at 1600x1200 yet compared to a cheap 60hz LCD monitor for programming/reading text it was crap. It's still taken LCD's years to even get close to CRT's display advantages (color reproduction, high refresh rates), however I think the newer LED (and OLED) will be the ones that nail the coffin shut.

To fully emulate a CRT you're going to need a display that has like ~9000000hz refresh rate. At that point you wouldn't even have a frame buffer as such, you'd just be setting pixels on the screen directly. 15000hz could do a very decent job of simulating CRT. On the other hand you can do a "pixel filter" simulation of CRT without going to all the trouble of actually treating the display like a CRT. This would look okish on 120hz or maybe 240hz displays.

panzeroceania wrote:

8/31/2010 1:01:19 AM

you're right, I think I am in the minority here. The thing about LCDs is, you can pretty them up with LED lighting, and up the refresh rate infinitely, but there will always be a minimal response time delay, the response time delay on a CRT is zero.

old cheap CRTs do look fuzzy but most graphic art professionals still prefer a professional graphic CRT over an LCD, unfortuately for most people these cost hundreds of dollars so it isn't worth it to most people.

OLED does look promising and is actually in consumer products, mostly cell phones and mp3 players. It doesn't seem to be working out for large format displays like televisions though, and even apple has opted to go for an LCD over an OLED for the new iphone 4.

I think ultimately you are making the right decision for 99.9 percent of your users, so you are making the right decision, just bringing to light that there are some things that only a CRT can do, and they do them better than any technology available for sale.

I'd love to see an SED or FED for sale, unfortunately these technologies keep being pushed back as it is difficult to make the price reasonable, I believe they are only profitable to sell to medical professionals that pay thousands of dollars to have them for very fine detail read outs.

Waxonator wrote:

9/1/2010 12:42:31 AM

Last day....

If it still needs work, just delay it, there's no reason to rush.

I know that VLC supports youtube streams. Could you add a simple youtube search function for the next version?

RetroRalph wrote:

9/1/2010 2:27:13 AM

Yeah YOUTUBE support is definitely possible. I'll look into it soon.

Waxonator wrote:

9/1/2010 3:06:42 AM

Thanks again!

CoolArtDude wrote:

9/1/2010 12:56:27 PM

/me looks about for new release - hmm august over, no new release, wheres the pitch fork and torch hiding :p

Sasha wrote:

9/1/2010 1:00:16 PM

23:00 31.08.2010

I don't give up, i wait new release. :)

Add Comment
RetroCopy: Making emulation easy and fun.
  |   RetroCopy © 2011