VIDEO Patch for pixel-perfect scaling (SDL1)

Here you can discuss the development of patches.

Re: VIDEO Patch for pixel-perfect scaling (SDL1)

Postby appiah4 » 2019-9-05 @ 10:13

Ant_222 wrote:
KainXVIII wrote:@ant_222, here you go, btw, screenshots from latest ScummVM build (aspect correction on, 1080p)
Bad news: both the screenshots use nearest-neighbor interpolation and have irregular pixel magnification, which means that the ScummVM developers not only have failed to implement pixel-perfect scaling, but also are deceiving their users by calling nearest-neighbor interpolation to the correct aspect ratio "pixel-perfect":
Code: Select all
320x200 --[4.0x4.8]--> 1280x960
—only the horizontal scale is integral, whereas the vertical one is a fractional. It makes no sense.

Edit: To clarify—the rows in the "pixel-perfect scaling" screenshot are magnified with alternating scales of 4 and 5 in a ratio of 1 to 4: 4, 5, 5, 5, 5, 4, 5, 5, 5, 5, ... yielding an average vertical scale of 24/5, or 4.8.


Wouldn't pixel-perfect scaling of 320x200 using square pixel flat panels result in wrong aspect ratios? The resolution may be 4:4.8 but it was displayed on a 4:3 monitor.. ScummVM may be doing the right kind of scaling then adjusting it to correct aspect ratio?
A500:Rev6|+512K|ACA500+|C1084S
i386:Am386SX25|4M|GD5402|ES688|MuntPi3
i486:U5S33|8M|GD5428|YMF719|DB-S2
i586:P133|32M|T64+/MX2|V1|CT3980/32M
i686:K6-2/400|128M|V2/SLI|CT4520/32M
S370:P3-1200|384M|GF4-4200|MX300
S754:A3700+|2G|X1950PRO|SB0350
User avatar
appiah4
l33t
 
Posts: 4044
Joined: 2017-2-19 @ 07:36

Re: VIDEO Patch for pixel-perfect scaling (SDL1)

Postby Ant_222 » 2019-9-05 @ 10:21

appiah4 wrote:Wouldn't pixel-perfect scaling of 320x200 using square pixel flat panels result in wrong aspect ratios?
It is possible but not necessary. My patch, for example, will try to keep the right aspect ratio or at least to minimise the error. It can use 4:5 scaling (with a 4% error is aspect ratio) or 5:6 scaling (with an exact aspect ratio).
appiah4 wrote:The resolution may be 4:4.8 but it was displayed on a 4:3 monitor..
It is not a resolution, but the horizontal and vertical scaling factors.
appiah4 wrote:ScummVM may be doing the right kind of scaling then adjusting it to correct aspect ratio?
If so, it should not call this mode "pixel-perfect". In my experience and opinion, small errors in the aspect ratio are hardly noticeable, whereas irregular pixels and other scaling artefacts always look nasty.
Ant_222
Member
 
Posts: 478
Joined: 2010-7-24 @ 21:29

Re: VIDEO Patch for pixel-perfect scaling (SDL1)

Postby appiah4 » 2019-9-05 @ 10:34

Ant_222 wrote:If so, it should not call this mode "pixel-perfect". In my experience and opinion, small errors in the aspect ratio are hardly noticeable, whereas irregular pixels and other scaling artefacts always look nasty.


That is your opinion. I find wrong aspect ratio to be terribly jarring, for example. Playing a 8:5 (320x200) pixel ratio game designed for a 4:3 aspect ratio CRT monitor implies 5:4 pixels. Pixel-perfect 5:4 aspect ratio displayed on a fixed square pixel panel means everything would look 6,66% taller, basically.

You may prefer that look, but it'd basically be showing you anything BUT how it should normally look. I prefer ScummVM's method, as it shows me an accurate representation of how it should actually look, which is the goal here.
A500:Rev6|+512K|ACA500+|C1084S
i386:Am386SX25|4M|GD5402|ES688|MuntPi3
i486:U5S33|8M|GD5428|YMF719|DB-S2
i586:P133|32M|T64+/MX2|V1|CT3980/32M
i686:K6-2/400|128M|V2/SLI|CT4520/32M
S370:P3-1200|384M|GF4-4200|MX300
S754:A3700+|2G|X1950PRO|SB0350
User avatar
appiah4
l33t
 
Posts: 4044
Joined: 2017-2-19 @ 07:36

Re: VIDEO Patch for pixel-perfect scaling (SDL1)

Postby Ant_222 » 2019-9-05 @ 10:55

appiah4 wrote:That is your opinion.
The misleading use of the term pixel-perfect for something that is not so, is not a matter of opinion. The term pixel-perfect refers to sharp, regular pixels of identical size undistorted by any interpolation.
appiah4 wrote:I find wrong aspect ratio to be terribly jarring, for example. Playing a 8:5 (320x200) pixel ratio game designed for a 4:3 aspect ratio CRT monitor implies 5:4 pixels.
No, it implies 5:6 pixels:
Code: Select all
320x200 (8:5) --[5x6]--> 1600x1200 (4:3)
appiah4 wrote:Pixel-perfect 5:4 aspect ratio displayed on a fixed square pixel panel means everything would look 6,66% taller, basically.
That depends on how you display it. My patch can approximate the target PAR (pixel aspect ratio) by displaying each pixel as a 4:5 or 5:6 rectangle. In the latter case there is no distortion at all.
appiah4 wrote:You may prefer that look, but it'd basically be showing you anything BUT how it should normally look. I prefer ScummVM's method, as it shows me an accurate representation of how it should actually look, which is the goal here.
Your concept of how it should actually look is rather fuzzy. Notice that we are talking about two kinds of error: a) the error of aspect ratio and b) the error of interpolation. Neither corresponds to how it should actually look. You just seem to prefer blurry and irregular pixels to a small error in the aspect ratio, whereas the general opinion among retro-gaming enthusiasts is that any interference with the fine structure of the image is a crime against pixel-art.

Edit: CRT emulation on high-resolution LCD displays is another matter because it keeps the pixels regular. The artefacts of CRT emulation are not side-effects of keeping the right aspect ratio but rather intentional and accurate enhancements.
Ant_222
Member
 
Posts: 478
Joined: 2010-7-24 @ 21:29

Re: VIDEO Patch for pixel-perfect scaling (SDL1)

Postby KainXVIII » 2019-9-05 @ 11:16

Ant_222 wrote:
KainXVIII wrote:@ant_222, here you go, btw, screenshots from latest ScummVM build (aspect correction on, 1080p)
Bad news: both the screenshots use nearest-neighbor interpolation and have irregular pixel magnification, which means that the ScummVM developers not only have failed to implement pixel-perfect scaling, but also are deceiving their users by calling nearest-neighbor interpolation to the correct aspect ratio "pixel-perfect":
Code: Select all
320x200 --[4.0x4.8]--> 1280x960
—only the horizontal scale is integral, whereas the vertical one is a fractional. It makes no sense.

Edit: To clarify—the rows in the "pixel-perfect" screenshot are magnified with alternating scales of 4 and 5 in a ratio of 1 to 4: 4, 5, 5, 5, 5, 4, 5, 5, 5, 5, ... yielding an average vertical scale of 24/5, or 4.8.

Interesting, still looks good to me (screenshots were taken in opengl graphics mode)
Here is screenshot in Normal (no scaling) graphics mode.
Снимок экрана (173).png


I need to pick another game though, preferably EGA with heavy dithering where all scaling artifacts can be seen clearly :cool:
You do not have the required permissions to view the files attached to this post.
User avatar
KainXVIII
Member
 
Posts: 331
Joined: 2015-5-20 @ 15:04
Location: Yaroslavl

Re: VIDEO Patch for pixel-perfect scaling (SDL1)

Postby Ant_222 » 2019-9-05 @ 11:37

KainXVIII wrote:Interesting, still looks good to me (screenshots were taken in opengl graphics mode)
Here is screenshot in Normal (no scaling) graphics mode.
Снимок экрана (173).png
It has some extremely rude glitches in the vertical direction. Just compare it with the original. Look, for example, at the "Options" gemstone in the lower-left corner. Its 45-digree sides are raggedy in your screenshot.
Ant_222
Member
 
Posts: 478
Joined: 2010-7-24 @ 21:29

Re: VIDEO Patch for pixel-perfect scaling (SDL1)

Postby KainXVIII » 2019-9-05 @ 14:39

Ant_222 wrote:
KainXVIII wrote:Interesting, still looks good to me (screenshots were taken in opengl graphics mode)
Here is screenshot in Normal (no scaling) graphics mode.
Снимок экрана (173).png
It has some extremely rude glitches in the vertical direction. Just compare it with the original. Look, for example, at the "Options" gemstone in the lower-left corner. Its 45-digree sides are raggedy in your screenshot.

Yes, OpenGl mode looks much better.
User avatar
KainXVIII
Member
 
Posts: 331
Joined: 2015-5-20 @ 15:04
Location: Yaroslavl

Re: VIDEO Patch for pixel-perfect scaling (SDL1)

Postby ZakMcKracken » 2019-9-08 @ 17:01

Ant_222 wrote:
citrixscu wrote:Are there any builds for OSX that has this patch included? It’s awesome on Windows.
I am very glad you like it, but don't know of any OS X build with my patch. Currently I see three ways to pixel-perfect display in DOSBox:
  1. A pixel shader for pixel-perfect scaling,
  2. BladeSk's patch, and
  3. My patch.
I suggest that you contact the maintainer of an OS X build with a proposal to implement one of the listed solutions. I can help with the generic algorithm of aspect-ratio approximation because some people don't make it right the fist time.


Also there was/is someone who implemented hq2x for SDL1 https://www.syntax-k.de/projekte/sdl-opengl-hq/ , SDL sources are way over my head, but would it be possible to implement this in SDL itself and leave dosbox alone ?
The current version of SDL is VERY stale, would be good to know if dosbox is transitioning to SDL2 at all before touching SDL, just to make sure.
As I understand the lib it only scales surface?/overlay output and falls back to normal opengl if opengl output is detected, I dont know how easy it is to replace SDL libs in other OSes than linux , have to try this one out and see if its still working.
User avatar
ZakMcKracken
Newbie
 
Posts: 16
Joined: 2005-4-30 @ 23:46

Re: VIDEO Patch for pixel-perfect scaling (SDL1)

Postby Ant_222 » 2019-9-09 @ 19:45

ZakMcKracken,

No, I don't think that such a specific scaler is within the scope of the generic library that is SDL. It should be implemented in DOSBox, preferably as a pixel shader.

Upgrading to the latest SDL seems to me a task of medium difficulty. By the way, the new SDL supports hardware-accelerated pixel-perfect scaling via the SDL_RenderSetScale function, but the new openglpp mode in my patch already resolves any performance problems with the current SDL 1.2. .
As I understand the lib it only scales surface?/overlay output and falls back to normal opengl if opengl output is detected
I don't understand this sentence or question. As far as I know, SDL does not implement this fall-back logic, nor does it support the scaling of software surfaces. The normalNx scalers in stock DOSBox and the surface-based modes added by my patch are all performed in the CPU in a single thread.

The availability of the latest SDL not a problem. Migrating DOSBox to it, however, is. But this subject is off-topic here...
Ant_222
Member
 
Posts: 478
Joined: 2010-7-24 @ 21:29

Re: VIDEO Patch for pixel-perfect scaling (SDL1)

Postby ZakMcKracken » 2019-9-12 @ 14:46

Yes, normal SDL does not scale , this is a custom patched SDL that scales non opengl surfaces according to the authors site using similar algorithms to hq2x, thats why threw the question in the room if your scaling could be implemented in SDL itself.
User avatar
ZakMcKracken
Newbie
 
Posts: 16
Joined: 2005-4-30 @ 23:46

Re: VIDEO Patch for pixel-perfect scaling (SDL1)

Postby KainXVIII » 2019-10-16 @ 08:15

Strange situation about Spellcasting 101 and its EGA resolution(640x350), i somehow prefer openglnb mode aspect ratio despite garbled pixels :confused:
Openglnb
openglnb.png

vs Openglpp
openglpp.png

console
dosboxconsole.PNG
You do not have the required permissions to view the files attached to this post.
User avatar
KainXVIII
Member
 
Posts: 331
Joined: 2015-5-20 @ 15:04
Location: Yaroslavl

Re: VIDEO Patch for pixel-perfect scaling (SDL1)

Postby Ant_222 » 2019-10-18 @ 20:43

KainXVIII wrote:Strange situation about Spellcasting 101 and its EGA resolution (640x350), i somehow prefer openglnb mode aspect ratio despite garbled pixels
The situation is not favourable for the patch: the game's resolution is relatively large(640x350), the pixel aspect ratio (1.37) highly incommensurable, and your display resolution (1920x1080) not very large. The traditional question is—what would you expect the patch to do?

Edit: I was wrong about the high incommensurability of the original PAR. A 1920x1400 display will allow for excellent pixel-perfect scaling:
Code: Select all
1.37 ~ 4/3
640x350 --[3x4]--> 1920x1400
Ant_222
Member
 
Posts: 478
Joined: 2010-7-24 @ 21:29

Previous

Return to DOSBox Patches

Who is online

Users browsing this forum: Ringding and 1 guest