#8249 closed patch (fixed)
Aspect-ratio correction (alternative method)
Reported by: | eriktorbjorn | Owned by: | fingolfin |
---|---|---|---|
Priority: | normal | Component: | Graphics |
Version: | Keywords: | ||
Cc: | Game: |
Description
This patch has previously lived as a comment to cigaes's patch #670437, but I think it has now matured to the point where it deserves a tracker item of its own.
The way I see it, the main advantage of this one over the old one is that this can be combined with any scaler, thus producing a smoother image.
The actual stretching algorithm is currently a stupid "double every fifth line" kind of thing, but I imagine it could be replaced with a bilinear filter or something. I've added some comments about how I think this can be done.
The patch only updates the normal SDL backend. Some work may have to be done on the OpenGL backend as well.
Ticket imported from: #757827. Ticket imported from: patches/354.
Attachments (5)
Change History (19)
by , 21 years ago
Attachment: | aspect-ratio.diff added |
---|
comment:1 by , 21 years ago
I forgot to say how to activate it:
Ctrl-Alt-a toggles it on/off The --aspect-ratio command-line option turns it on It can be set to on with "aspect_ratio=true" in the config file
It won't affect all games -- not COMI and presumably not Zak256.
comment:2 by , 21 years ago
Some tweaks and fix for ctrl-alt-a in the GL backend (which the original patch broke).
comment:3 by , 21 years ago
The previous patch had problem preventing it from compiling sdl_gl.cpp. Fixed. Also unified the aspect code in the GL backend a bit more with the one now in sdl-common.cpp (this way the config file / command line settings for aspect ratio work in the GL backend, too).
I also added a simple "bilinear" scaling, marked by #if/#endif, to stretch200To240. There are two variants, one exact (with coefficients 0/5, 1/5, 2/5, 3/5, 4/5, 5/5) and one which is not exact but slightly faster (0/4, 1/4, 2/4, 3/4, 4/4). Both look about the same to my eyes. That is, IMHO they look better than the pixel duplication code originally used, but aren't exactly great.
by , 21 years ago
Attachment: | aspect_old.png added |
---|
comment:4 by , 21 years ago
I'll attach two PNGs that show the difference. The filter is advmame2x in both shots. The "blurring" of the new method is less notiable when using e.g. 2xsai since that filter already applies some blurring by itself. Still, with the smoothing, the aspect adjusted graphics look pretty good on my screen.
comment:5 by , 21 years ago
Cool, I'll have to try it out later today.
One question: Is the "if (srcPtr == dstPtr) break;" check still valid with the bilinear filter? I'll need to think about that one...
comment:6 by , 21 years ago
Ender, any concerns regarding this? Otherwise, if erik agrees, too, I'd say we should check this in: 1) It looks very good to me 2) Speed seems no issue on my system 3) Even if on some systems speed is an issue: in non-aspect mode, there is 0 overhead compared to the current system. I.e. if you don't like it or if it's too slow: simply don't turn it on
So, I see no reasons *against* it, but good reasons for it. If you can think of any negative points, I'd like to hear 'em, so we can work them out.
comment:7 by , 21 years ago
Owner: | set to |
---|
comment:8 by , 21 years ago
If it works, go for it.
I would like to see an improved "Video Options" launcher config making it easier to select these settings, however.
comment:9 by , 21 years ago
Owner: | removed |
---|
comment:10 by , 21 years ago
Well yea, "Video Options" in the GUI would be nice - but that's kind of orthogonal to this patch, of course, we don't have any such thing at all right now.
What I really wonder about before applying this is the three "modes" possible with the code: pixel duplication, approximate bilinear , exact bilinear. Right now you can "choose" between them via some #ifdefs. We could maybe add a ctrl-alt-b switch to turn on/off exact biliniear mode, like the GL backend. What do you think, folks?
comment:11 by , 21 years ago
Thinking about this a little longer: maybe we should just always use the bilinear mode: * it looks vastly better than the pixel duplication when it comes to fonts, IMHO, unless you sit so close to your screen to notice the anti-aliasing effect * ctrl-alt-b is not going to work orthogonal; more precisely, if aspect adjustment is off, then it'll have no effect at all. this would be a bit odd to users, wouldn't it?
Of course, there is one thing against it: speed. Well, all I can see, on my 500 Mhz iBook, aspect+bilinear works just fine as using no aspect correction at all.
comment:12 by , 21 years ago
Owner: | set to |
---|---|
Resolution: | → fixed |
Status: | new → closed |
comment:14 by , 6 years ago
Component: | → Graphics |
---|
Patch against a June 20 CVS snapshot