best upscaling algorithm in VirtualDub for retro games

The place for all discussion on gaming hardware
Post Reply
User avatar
FinalBaton
Posts: 4475
Joined: Sun Mar 08, 2015 10:38 pm
Location: Québec City

best upscaling algorithm in VirtualDub for retro games

Post by FinalBaton »

Here is the list I got in VirtualDub 1.10.4, which one is the best for upscaling 240p graphics?

Nearest neighbor
Bilinear (interpolation only)
Bicubic (interpolation only)
Precise bilinear
Precise bicubic (A=0.75)
Precise bicubic (A=0.60)
Precise bicubic (A=1.00)
Lanczos3

I know I could render 1 of each and take snapshots and compare, but that would take a good while and if somebody already has the answer to this and don't mind sharing, it would save me a lot of time and efforts.

Thanks!
-FM Synth & Black Metal-
User avatar
Fudoh
Posts: 13044
Joined: Mon Mar 06, 2006 3:29 am
Location: Germany
Contact:

Re: best upscaling algorithm in VirtualDub for retro games

Post by Fudoh »

You do a next neighbour upscale to about 2x your target size (and keep it integer) and then a precise bilinear downscale to your target resolution.
User avatar
FinalBaton
Posts: 4475
Joined: Sun Mar 08, 2015 10:38 pm
Location: Québec City

Re: best upscaling algorithm in VirtualDub for retro games

Post by FinalBaton »

Thanks! Woah I've got a ton of questions now.
Wait : so I need to upscale and then downscale? are you messing with me lol

What is target resolution exactly? the final size I'll be uploading to Youtube? For me that would be 720p (1280x720)
Also, I capture at 720x240p, but linedouble in Amarec. So the file I import in VirtualDub is 720x480

So I should next neighbor upscale 3X integer (2160x1440) and then precise bilinear downscale to 1280x720?
Can I put both these filter in the same rendering process? or should I do them separately
-FM Synth & Black Metal-
User avatar
Fudoh
Posts: 13044
Joined: Mon Mar 06, 2006 3:29 am
Location: Germany
Contact:

Re: best upscaling algorithm in VirtualDub for retro games

Post by Fudoh »

When you're capturing at 720x240 your horizontal sampling isn't perfect anyway, so the result won't be perfect, unless you downscale to the physical resolution first. To do so you're cropping away the overscan first and then do a NN downscale to the physical resolution of your source (e.g. 256 pixels for SNES). Then you upscale using NN and downscale using Prec.BL.

If you're using a codec with reduced color sampling (e.g. 4:2:2) I would do the same for the vertical scaling. If done right you can usually achieve "emu-like" results. The point of using the BL downscale is to give you the best possible result without shimmering that would otherwise occur due to the NN scaling.

You can create the whole processing chain at once. Cropping -> horizontal NN downscale to the exact sample rate -> integer upscale -> Prec.BL downscale.

If you don't mind the vertical underscan and whish to leave it, you can keep the vertical scaling integer all the way.
User avatar
FinalBaton
Posts: 4475
Joined: Sun Mar 08, 2015 10:38 pm
Location: Québec City

Re: best upscaling algorithm in VirtualDub for retro games

Post by FinalBaton »

ok thanks
-FM Synth & Black Metal-
SavagePencil
Posts: 855
Joined: Mon Nov 11, 2013 4:06 pm

Re: best upscaling algorithm in VirtualDub for retro games

Post by SavagePencil »

So that I'm clear, if I were capturing 256-wide PC Engine at 720x240, and uprezzing to 960x720, I would:

* Crop overscan
* NN down to 256x240
* NN upscale to ~1920x240
* Bilinear down to 960x240
* Line triple (NN?) to 960x720

Is that correct?

Are there tools for doing this at runtime (livestream), or is this only as a post process in virtualDub?
User avatar
Fudoh
Posts: 13044
Joined: Mon Mar 06, 2006 3:29 am
Location: Germany
Contact:

Re: best upscaling algorithm in VirtualDub for retro games

Post by Fudoh »

* NN down to 256x240
that can be tricky depending on how your capture card sampled the input.

If your final upscale doesn't require a integer width (which 960 pixels don't), then you can try to skip this part and focus on the vertical resolution instead.
Are there tools for doing this at runtime (livestream), or is this only as a post process in virtualDub?
you might be able to integreate Avisynth into your livestream graph and use the filters there.
SavagePencil
Posts: 855
Joined: Mon Nov 11, 2013 4:06 pm

Re: best upscaling algorithm in VirtualDub for retro games

Post by SavagePencil »

Fudoh wrote:
* NN down to 256x240
that can be tricky depending on how your capture card sampled the input.

If your final upscale doesn't require a integer width (which 960 pixels don't), then you can try to skip this part and focus on the vertical resolution instead.
I'm using an XCapture-1 over RGB (720x240). If I'm reading you right, you're saying:
1. Crop out overscan
2. NN to 256 (or 320 or 512 or whatever that particular PCE game uses)
3. Use a bilinear to 960, or an NN to 960?
4. Line triple to 720 lines
Fudoh wrote:you might be able to integreate Avisynth into your livestream graph and use the filters there.
All roads lead to AviSynth, it seems :)

Other questions I could use help on:
a. When I crop out overscan from the 720 image, I was expecting to have exactly 80 pixels of overscan (720 - 80 = 640 = 4:3). I have less than 80. Is that normal? Should I preserve all of the color?
b. Does it matter that I have the card set to a 4:3 aspect ratio *AND* my capture software (either AmaRec or vDub) set to 4:3? Should I leave one of these at 1:1 instead?
User avatar
Fudoh
Posts: 13044
Joined: Mon Mar 06, 2006 3:29 am
Location: Germany
Contact:

Re: best upscaling algorithm in VirtualDub for retro games

Post by Fudoh »

2. NN to 256 (or 320 or 512 or whatever that particular PCE game uses)
as said, that's harder than it sounds. Did you try it ? You have to check a horizontally scrolling game if your cropping and down sizing is able to restore the original resolution. If you can't do it, leave it at 720 pixels and just crop.
a. When I crop out overscan from the 720 image, I was expecting to have exactly 80 pixels of overscan (720 - 80 = 640 = 4:3).
no, since you don't have square pixels that doesn't work out.
SavagePencil
Posts: 855
Joined: Mon Nov 11, 2013 4:06 pm

Re: best upscaling algorithm in VirtualDub for retro games

Post by SavagePencil »

Fudoh wrote:
2. NN to 256 (or 320 or 512 or whatever that particular PCE game uses)
as said, that's harder than it sounds. Did you try it ? You have to check a horizontally scrolling game if your cropping and down sizing is able to restore the original resolution. If you can't do it, leave it at 720 pixels and just crop.
I tried it on a screenshot in Paint.Net just to make sure I had my math correct and could iterate a little faster.
a. When I crop out overscan from the 720 image, I was expecting to have exactly 80 pixels of overscan (720 - 80 = 640 = 4:3).
no, since you don't have square pixels that doesn't work out.
Makes sense. Will telling the card/software what aspect ratio to expect change what comes across in the 720x240 image? Is it OK to have both of them set to 4:3?
User avatar
Fudoh
Posts: 13044
Joined: Mon Mar 06, 2006 3:29 am
Location: Germany
Contact:

Re: best upscaling algorithm in VirtualDub for retro games

Post by Fudoh »

I tried it on a screenshot in Paint.Net just to make sure I had my math correct and could iterate a little faster.
you need the scrolling test, so you have to do it in the editing suite. A static screenshot can look good, but you might get artefacts once your have scrolling.
Will telling the card/software what aspect ratio to expect change what comes across in the 720x240 image? Is it OK to have both of them set to 4:3?
doesn't matter, since you do postprocessing anyway.
SavagePencil
Posts: 855
Joined: Mon Nov 11, 2013 4:06 pm

Re: best upscaling algorithm in VirtualDub for retro games

Post by SavagePencil »

Fudoh wrote:
I tried it on a screenshot in Paint.Net just to make sure I had my math correct and could iterate a little faster.
you need the scrolling test, so you have to do it in the editing suite. A static screenshot can look good, but you might get artefacts once your have scrolling.
Makes sense. I'm guessing the fastest way to iterate here is to do a short capture and then play with AviSynth scripts to view the results in the vDub editor. Time to dive into AviSynth!

Thanks, btw!
Post Reply