VI - Async video out and more (Patreon)
Downloads
Content
Hi Everyone!
The first of the open tasks from the last post is now mostly implemented. What again was it useful for? You can see it in the title image.
The core previously used the main system clock of 62.5 Mhz to generate video output from it. The N64 however was using different clocks for the video output: 48.68 MHz for NTSC and 49.65 Mhz for PAL, so the framerate didn't match exactly.
That is also the reason why it's called async: the video clock is asynchronous to the system clock, they have no common multiple frequency, which makes it always a bit more difficult to get this stable, because both clock domains need to exchange information back and forth.
So before we got 60.1 Hz for NTSC and 50.0 Hz for PAL and now it's 59.8 Hz for NTSC and 49.9 Hz for PAL. This is for 240p content, 480i has slightly higher framerate. If you look closely, you will also see that the resolution changed and we will also take look why.
But first we should think about why such a small change is such a big deal overall. Of course you want the games to be played in the exact speed and not 0.5% faster. But that you might not notice after all.
What you will notice however, is when a game will sync it's output to the video speed, for example in cutscenes. Even if the speed is wrong for only 0.5%, you can get a cutscene to desync over time and you can notice that.
Another important part that plays into that: audio output is also using the video clock. With the video out being switched over to using the different clock frequency, audio also had to switch and it now also using the correct speed. Before it was about 1.5% too fast, which could also lead to different issues.
What is the point of this resolution change now?
Let's take a look at one extreme example:
This is World Driver Championship using the option "Hi-Res Letterbox".
You can easily see that the aspect ratio is completly wrong. This is because the old VI output implementation generated a video signals for all visible pixels only and forced a aspect ratio of 4:3 to it.
What does it look like now?
The aspect ratio is correct and we get the huge letterbox that this game also shows on on CRT TV.
That is also the main idea of how the new output works: a fixed viewport of 640x240 pixels for 240p NTSC content and the visible image is just placed inside this area. This will make sure you see the same that you would see with a real N64 either via analog out or a proper HDMI mod.
Due to interlaced and NTSC/PAL games, 4 viewports exist:
- 240p NTSC: 640x240
- 480i NTSC: 640x480
- 288p PAL: 640x288
- 576i PAL: 640x576
If you have a game that uses a smaller visible area or has some flicker inside that would usually be hidden with overscan, you can also crop the top and bottom of the image. Horizontal crop will also be added soon.
With this method, the correct aspect ratio is always active. Kitrinx provided the calculation and aspect ratio values for all these resolutions and crop modes and it works very well.
If you want the old output back, mostly because you hate black bars so much, there is also an option for that: "Fixed Blanks = off" will bring back the old "visible pixels only" viewport with 4:3 aspect ratio or custom aspect ratio through the mister.ini file.
The video output also changed a lot for analog out with this change, but as of the time of this writing, it is not fully working yet. 240p content seems to be correct, but 480i content still has some issues. I got a lot of support from MikeS for the analog out(in fact, he is doing most of the work), but we still need some more time to fully figure it out.
With this finished you should be able to use analog out and not see a difference in function and centering to a real N64.
As the Async VI output is a complete rewrite of the video output module, it took me several days to complete, so this is the main change over the previous version. However, I used the days in between some testing rounds to fix some more bugs.
Since last article, these bugs have also been fixed:
- Diddy Kong racing: wrong water color
- Pokemon Stadium 1+2: text and polygon artifacts
- Beetle Adventure Racing: Fog and Lava
- Ocarina of Time: Color Banding
- Top Gear Really: title screen and texture glitches
- Dr Mario: sprites no longer have black boxes around
- Ridge Racer: tail lights look correct now
- some more wrestling games now have readable texts
A buid with these changes is attached.
The next task will be in the CPU: I first need to cleanup and unify the memory request handling. This could potentially improve timing and ressources, but most importantly will make the next step easier: implementing the Write Fifo and maybe other missing CPU parts.
Digging into the CPU is not an easy task, so expect any useful results to take some weeks. I might do a bugfixes in between if things get boring.
Have fun!