VIDEO Patch for pixel-perfect scaling (SDL1)

Here you can discuss the development of patches.

Re: Full-screen mode

Postby KainXVIII » 2016-8-06 @ 18:48

Flashback does not look right?
You do not have the required permissions to view the files attached to this post.
User avatar
KainXVIII
Member
 
Posts: 278
Joined: 2015-5-20 @ 15:04
Location: Yaroslavl

Re: Full-screen mode

Postby Ant_222 » 2016-8-06 @ 18:56

KainXVIII wrote:Flashback does not look right?


Now it does. I had bug in my code. Notice that on your monitor it is displayed with 5x4 pixels, for the its calculated aspect ratio is 0.857 vs. the 1.000 that DOSBox assumes. EDIT: The question is: is it better or "truer" than the 1:1 ratio?
Ant_222
Member
 
Posts: 375
Joined: 2010-7-24 @ 21:29

Re: Full-screen mode

Postby Ant_222 » 2016-8-06 @ 20:08

Once upon a Forest looks great.
You do not have the required permissions to view the files attached to this post.
Ant_222
Member
 
Posts: 375
Joined: 2010-7-24 @ 21:29

Re: Full-screen mode

Postby KainXVIII » 2016-8-06 @ 20:33

Ant_222 wrote:
KainXVIII wrote:Flashback does not look right?


Now it does. I had bug in my code. Notice that on your monitor it is displayed with 5x4 pixels, for the its calculated aspect ratio is 0.857 vs. the 1.000 that DOSBox assumes. EDIT: The question is: is it better or "truer" than the 1:1 ratio?

I prefer 1:1 and it looks exactly like this on CRT monitor back in the days, AFAIR.
User avatar
KainXVIII
Member
 
Posts: 278
Joined: 2015-5-20 @ 15:04
Location: Yaroslavl

Re: Full-screen mode

Postby Ant_222 » 2016-8-07 @ 12:59

KainXVIII wrote:
Ant_222 wrote:Notice that on your monitor [Flashback] is displayed with 5x4 pixels, for the its calculated aspect ratio is 0.857 vs. the 1.000 that DOSBox assumes. EDIT: The question is: is it better or "truer" than the 1:1 ratio?

I prefer 1:1 and it looks exactly like this on CRT monitor back in the days, AFAIR.

That can changed. Does anyone know how it is possible—was Flashback letterboxed originally?
Ant_222
Member
 
Posts: 375
Joined: 2010-7-24 @ 21:29

Re: Full-screen mode

Postby Scali » 2016-8-07 @ 16:41

Flashback was originally an Amiga game, which runs in a PAL resolution of 320x256, so a different aspect ratio than what you'd have on PC. So it always looked a bit 'stretched' vertically on PC.
Scali
l33t
 
Posts: 3546
Joined: 2014-12-13 @ 14:24

Re: Full-screen mode

Postby KainXVIII » 2016-8-07 @ 18:50

User avatar
KainXVIII
Member
 
Posts: 278
Joined: 2015-5-20 @ 15:04
Location: Yaroslavl

Re: Full-screen mode

Postby James-F » 2016-8-08 @ 03:43

KainXVIII wrote:output=direct3d
pixelshader=bilinear.fx
aspect=true
scaler=normal5x


This is pretty much the same settings I use but with the SVN dosbox.
output=opengl (bilinear interpolation).
aspect=true
scaler=normal3x forced


It's a well known method to scale/stretch to a different non pixel perfect resolution without distortion, I use it in all emulators.
Super-sampling and bilinear interpolation, then down-scaling to LCD native resolution.
It works best with low resolution source (like emulators) and high resolutions displays like 2560x1440 or 3840x2160.


@Ant_222
What is the point of pixel perfect image if it's not in 4:3 like on a CRT?
Back in the day all games were stretched to 4:3 no matter what the source resolution of the game was.
User avatar
James-F
Oldbie
 
Posts: 1428
Joined: 2015-11-30 @ 04:10

Re: Full-screen mode

Postby KainXVIII » 2016-8-08 @ 09:10

Latest SVN dosbox is very buggy for me (crashes very often), Ant_222's built has same problems.
User avatar
KainXVIII
Member
 
Posts: 278
Joined: 2015-5-20 @ 15:04
Location: Yaroslavl

Re: Full-screen mode

Postby Ant_222 » 2016-8-08 @ 11:26

KainXVIII wrote:Latest SVN dosbox is very buggy for me (crashes very often), Ant_222's built has same problems.

Unless you think I have introduced those problems, let us not discuss them here. I can patch the official DOSBox 0.74 if I get its sources. Does it correspond to any specific SVN revision?
Last edited by Ant_222 on 2016-8-08 @ 11:42, edited 1 time in total.
Ant_222
Member
 
Posts: 375
Joined: 2010-7-24 @ 21:29

Re: Full-screen mode

Postby Qbix » 2016-8-08 @ 11:31

Ant_222 wrote:
KainXVIII wrote:Latest SVN dosbox is very buggy for me (crashes very often), Ant_222's built has same problems.

Unless you think I have introduced those problems, let us not discuss them here. I can patch the official DOSBox 0.74 if I had its sources. Does it correspond to any specific SVN revision?


3609

You might want to start to publish the diff anyway, as you are starting to distribute binaries (GPL)


KainXVIII wrote:Latest SVN dosbox is very buggy for me (crashes very often), Ant_222's built has same problems.

There is no good reason why the SVN should be unstable for you. As far as I know it is at least as stable as 0.74 at the moment, so please create a thread for it and post games that have that problem.
Water flows down the stream
How to ask questions the smart way!
User avatar
Qbix
DOSBox Author
 
Posts: 10651
Joined: 2002-11-27 @ 14:50
Location: Fryslan

Re: Full-screen mode

Postby Ant_222 » 2016-8-08 @ 12:57

Qbix wrote:You might want to start to publish the diff anyway, as you are starting to distribute binaries (GPL)

Ok, I shall only clean my custom logging out of there. I have not prgrammed in C since university...
EDIT: I will upload the patch this weekend.
Last edited by Ant_222 on 2016-8-08 @ 20:01, edited 1 time in total.
Ant_222
Member
 
Posts: 375
Joined: 2010-7-24 @ 21:29

Re: Full-screen mode

Postby Ant_222 » 2016-8-08 @ 13:15

May I rename this thread to something like [patch] Pixel-perfect display, or create a new one with a proper title? The current one summarizes my initial question about full-screen mode and does not reflect what it has turned into. Otherwise readers will not know that a patch (coming soon) and a new patched version are proposed for testing.
Ant_222
Member
 
Posts: 375
Joined: 2010-7-24 @ 21:29

Re: Full-screen mode

Postby James-F » 2016-8-08 @ 14:16

The alpha works.

I still don't understand why would anyone want to use non 4:3 aspect ratio with dos games.
SNES for example has 256x224 resolution which meant to be shown as 4:3; why would you want to display it in a pixel perfect way?
The game developers worked really hard to create a perfect circle on a 4:3 display with in 256x224 resolution, see what I mean?
User avatar
James-F
Oldbie
 
Posts: 1428
Joined: 2015-11-30 @ 04:10

Re: Full-screen mode

Postby Ant_222 » 2016-8-08 @ 14:21

Regarding the native pixel aspect ratio of Flashback:
Scali wrote:Flashback was originally an Amiga game, which runs in a PAL resolution of 320x256, so a different aspect ratio than what you'd have on PC. So it always looked a bit 'stretched' vertically on PC.

If they did not scale or redraw the GFX for MS-DOS but chose to display the same pixels in the smaller area, then the game should look wider in MS-DOS:
Code: Select all
A pixel's width relative to its height is:
w_p = 4/3 * height / width;
w_p_amiga = 4/3 * 256/320 = 1.07
w_p_msdos = 4/3 * 224/256 = 1.17

KainXVIII wrote:https://www.youtube.com/watch?v=KVni0T7cEOk looks like this, i guess

Thanks for this link to Flashback running on a real Amiga. As Scali noted, Flashback for Amiga used a different graphical mode, so it cannot serve as a reference because we wish to emulate the way the game looked on MS-DOS, do we not? Can we ask this of some real-hardware fellows here at vogons? I can prepare two perfectly scaled versions of the same screen when I get home.
Ant_222
Member
 
Posts: 375
Joined: 2010-7-24 @ 21:29

Re: Full-screen mode

Postby Ant_222 » 2016-8-08 @ 14:30

James-F wrote:I still don't understand why would anyone want to use non 4:3 aspect ratio with dos games.
SNES for example has 256x224 resolution which meant to be shown as 4:3; why would you want to display it in a pixel perfect way?
The game developers worked really hard to create a perfect circle on a 4:3 display with in 256x224 resolution, see what I mean?

That is exactly what I want to achieve by displaying original pixels on the actual LCD monitor not as a n-by-n squares, but as an n-by-m rectangles, where n and m approximate the native pixel aspect ratio of the original game. The advantage of this approach is lack of blur (interpolating output types) and irregular scaling (openglnb). This approach keeps pixel-art and low-resolution raster images as close to the original as they can be—representing them with perfectly sharp, regular rectangles of a fixed size, while the opengnb output, as well as the official aspect-ratio correction, uses varisized pixels.
Ant_222
Member
 
Posts: 375
Joined: 2010-7-24 @ 21:29

Re: Full-screen mode

Postby James-F » 2016-8-08 @ 14:37

Ant_222 wrote:This approach keeps pixel-art and low-resolution raster images as close to the original as they can be...

This is where I believe you are wrong.
The game developers worked on a 4:3 displays in all kind of funky resolutions.
Taking this in mind they created perfect geometrical shapes like circle or square on a "stretched" (non-pixel perfect) image.
SNES, Genesis 320x200, etc... they all meant to be displayed on a 4:3 display.

So, on a 1:1 display interpolation is unavoidable.
They higher resolution the destination display, the smaller the interpolated area is.

I would REALLY like to have normal4x and normal5x scaling options in the SVN built, but that's up to the devs.
User avatar
James-F
Oldbie
 
Posts: 1428
Joined: 2015-11-30 @ 04:10

Re: Full-screen mode

Postby Scali » 2016-8-08 @ 19:55

I think we have to distinguish between aspect ratio and effective resolution here.
That is, you can reprogram CGA/EGA/VGA/Hercules in a number of ways, some of which include merely changing the visible window.
The aspect ratio is not dictated by the visible window, but rather by the actual scanline width (interval between hsync pulses) and actual number of total scanlines (interval between vsync pulses), and the pixel clock.
What I see here is people trying to use the active window size to derive the aspect ratio. This is flawed.

Eg, I could set up a tweaked mode in VGA derived from 320x200, which uses a 200x200 window in the center of the screen. The aspect ratio is still the same as 320x200.
Scali
l33t
 
Posts: 3546
Joined: 2014-12-13 @ 14:24

Re: Full-screen mode

Postby Ant_222 » 2016-8-08 @ 20:12

Scali wrote:What I see here is people trying to use the active window size to derive the aspect ratio. This is flawed.
Eg, I could set up a tweaked mode in VGA derived from 320x200, which uses a 200x200 window in the center of the screen. The aspect ratio is still the same as 320x200.

Can such a window be technically called a separate graphical mode? I thought it would still be a 320x200 mode with the software writing within a 200x200 subregion? Is it the reason that DOSBox reports a unity aspect ratio for 256x224 Flashback—does that game use a "window"?
Ant_222
Member
 
Posts: 375
Joined: 2010-7-24 @ 21:29

Re: Full-screen mode

Postby Ant_222 » 2016-8-08 @ 20:43

James-F wrote:
Ant_222 wrote:This approach keeps pixel-art and low-resolution raster images as close to the original as they can be...

This is where I believe you are wrong.
The game developers worked on a 4:3 displays in all kind of funky resolutions.
Taking this in mind they created perfect geometrical shapes like circle or square on a "stretched" (non-pixel perfect) image.
SNES, Genesis 320x200, etc... they all meant to be displayed on a 4:3 display.

I think ours is a disagreement in terms only. By stretching you refer to the analog operation of displaying the digital image on a CRT screen in such a way as to fill its full area. It produces agreeable results because the pixels are displayed as equivalent rectangles, which are as sharp as the CRT cells allow—and that is good enough.

What I call stretching is the digital operation, performed by software and employing interpolation (bilinear, nearest neighbor, &c), that transforms an original two-dimensional array of pixels into another of a larger size and generally with a different aspect ratio (the ratio of width to height), which is then displayed on an LCD screen. This latter operation is lossy and requires special care to keep low-res pixelated images beautiful.

Please, bear with me, and I will explain my algorithm with a simple example. An MS-DOS game working in the 320x200 graphical mode and "stretched" to the size of a standard 4/3 CRT display will have its pixels shown as rectangles with the following aspect ratio:
Code: Select all
w_p = 4/3 * 200/320 = 5/6

i.e. each pixel on the CRT will be displayed as a rectangle 6 units high a 5 wide.
Now, if you were to run such a game (say, Lure of the Temptress in the patched DOSBox on a 1920x1200 monitor, it would upscale the image horizontally by factor of 5 and vertically by a factor of 6—producing a 1600x1200 image with black bars at the sides. Notice that
Code: Select all
1600/1200 = 4/3

i.e. the original aspect ratio is fully preserved and the scaling is pixel-perfect: no smoothing or other artefacts.
James-F wrote:So, on a 1:1 display interpolation is unavoidable. They higher resolution the destination display, the smaller the interpolated area is.

In the example above the original aspect ratio was preserved and no interpolation employed.
James-F wrote:I would REALLY like to have normal4x and normal5x scaling options in the SVN built, but that's up to the devs.

Why? My algorithm is intended to deprecate the normal scalers completely so that people should no longer need to ask the developers to implement a umpteenth normalkx after a larger display resolution has become available.

If you think that with my patch some game looks wrong, or worse than in the standard DOSBox, post screenshots from both and we will sort it out.
Ant_222
Member
 
Posts: 375
Joined: 2010-7-24 @ 21:29

PreviousNext

Return to DOSBox Patches

Who is online

Users browsing this forum: No registered users and 1 guest