2x integer vertical scaling in GBA2P

maze
Posts: 18
Joined: Tue Nov 22, 2022 6:48 am
Has thanked: 2 times
Been thanked: 1 time

2x integer vertical scaling in GBA2P

Unread post by maze »

I'm trying to achieve 2x integer vertical scaling in 720p in the Game Boy Advance 2 Player core, with horizontal splitscreen. However, with no interpolation, I'm getting uneven pixels and shimmering scrolling, which shouldn't be happening.

My relevant settings in mister.ini:

Code: Select all

vscale_mode=0
video_mode=0

[GBA2P]
vscale_border=200

If my math is right, two GBA windows (240x160) side by side should have a total native resolution of 480x160. This should evenly scale 2x up to 960x320. Using the formula from this thread:

Code: Select all

(video_mode resolution - target resolution)/2 = vscale_border setting

(720 - 320)/2 = 200

I arrive at vscale_border=200. However, it's clearly not achieving the expected results for some reason.

Does anyone have any ideas? It's almost as if the vertical resolution the core is producing in horizontal splitscreen is actually different than 160, but I'm not sure what else it would be.

Interestingly, in vertical splitscreen mode, I have no problem getting shimmer-free 2x integer scaling with vscale_border=40, using the same methodology.

Lastly, I should note the same problem occurs in the Gameboy2P core when I manually try to do 4x (vscale_border=72), but oddly 3x (vscale_border=144) works perfectly. Maybe it's related?

Yim
Posts: 125
Joined: Mon Jan 18, 2021 11:51 pm
Has thanked: 3 times
Been thanked: 87 times

Re: 2x integer vertical scaling in GBA2P

Unread post by Yim »

I haven’t used GBA2P and my MiSTer isn’t to hand so I can’t check this myself, but I’d fire the core up and take one screenshot using the raw output (win+left shift+printscreen) and another with the scaled output (win+printscreen). Then you can check the resolution of the raw output in case it’s different for some reason and also see how big the borders and active area are in the scaled image (take your screenshot when the game is putting out a full-screen image so the line between active area and border is obvious).

maze
Posts: 18
Joined: Tue Nov 22, 2022 6:48 am
Has thanked: 2 times
Been thanked: 1 time

Re: 2x integer vertical scaling in GBA2P

Unread post by maze »

Oh cool, I wasn't aware of the screenshot function. That's super helpful.

I decided to go back to basics and delete my custom vscale_border settings, just to see what the core does with its normal integer scaling menu settings (Aspect ratio: Original, Scale: V-Integer), because I noticed they also don't seem to work correctly. The results:

Raw output (240x160):

20230531_040351-Super Mario Advance (USA, Europe).png
20230531_040351-Super Mario Advance (USA, Europe).png (24.36 KiB) Viewed 5465 times

Scaled output (1280x640):

20230531_040403-Super Mario Advance (USA, Europe).png
20230531_040403-Super Mario Advance (USA, Europe).png (461.3 KiB) Viewed 5465 times

As you can see, the screenshots aren't capturing the two-player splitscreen at all, only one of the screens apparently. So, who can say what the actual splitscreen output resolution may be.

Another strange thing is that the scaled output screenshot has a resolution of 1280x640, a 2:1 aspect ratio, rather than the GBA's real 3:2 ratio.

Conclusion? I now suspect the core's settings for aspect ratio are off somehow, but if so, I don't know enough to determine this exactly.

FPGAzumSpass
Core Developer
Posts: 379
Joined: Sat May 23, 2020 12:55 pm
Has thanked: 38 times
Been thanked: 381 times

Re: 2x integer vertical scaling in GBA2P

Unread post by FPGAzumSpass »

Unscaled resolution for GBA2P is 480x160(hor) or 240x320(vert) or 240x160(single screen)
The screenshots don't work properly as the GBA2P is using direct framebuffer mode.

But if you open up the OSD and go left where the volume control is, you also see the scaled and unscaled resolutions.

I can't answer why the scaling doesn't work as expected, probably the odd ratio was not considered?

FoxbatStargazer
Top Contributor
Posts: 994
Joined: Thu Dec 10, 2020 5:44 pm
Has thanked: 309 times
Been thanked: 228 times

Re: 2x integer vertical scaling in GBA2P

Unread post by FoxbatStargazer »

For integer scaling, most cores seem to expect vertical resolution to be the limiting factor, which makes sense for 4:3 cores displayed in 16:9 container. If the limiting factor is instead horizontal resolution (which you would expect in the GBA 2p core), things can get weird, as I've seen when saying trying to put the lynx or GBA inside a 4:3 output resolution.

maze
Posts: 18
Joined: Tue Nov 22, 2022 6:48 am
Has thanked: 2 times
Been thanked: 1 time

Re: 2x integer vertical scaling in GBA2P

Unread post by maze »

I would like to play around with this further just out of curiosity. Is it possible to find the aspect ratio preset values used by the core (and other cores) somewhere in the GitHub? I poked around unsuccessfully but am not sure what to look for.

FPGAzumSpass
Core Developer
Posts: 379
Joined: Sat May 23, 2020 12:55 pm
Has thanked: 38 times
Been thanked: 381 times

Re: 2x integer vertical scaling in GBA2P

Unread post by FPGAzumSpass »

maze
Posts: 18
Joined: Tue Nov 22, 2022 6:48 am
Has thanked: 2 times
Been thanked: 1 time

Re: 2x integer vertical scaling in GBA2P

Unread post by maze »

I finally experimented with this some more. Again, my goal was to get 2x integer scaling in 720p with the two screens arranged horizontally.

Through trial and error, I found that this setting gets me the correct 2x vertical scale (320 pixel height):

Code: Select all

vscale_border=159

Why 159? No idea.

Another strange thing: with the "Original" aspect ratio setting, which in this case is 3:1, the core scales the horizontal resolution to 962 pixels wide, instead of the expected 960.

So, this is all above my knowledge level. But it does seem like something weird is happening with the scaling calculations.

Post Reply