Mathematical Scaling Filter

Jademalo

New Member
I have a large number of sources and filters designed for my old retro consoles.
Due to the way I capture them to preserve sharp pixels, I need to apply a very specific aspect ratio correction in OBS. This is a mathematical function that varies from console to console. For example, the SNES requires (H * (8/7)), and the GameCube requires (H * (10/11)).

The issue arises when starting to account for overscan.
For the GameCube, some games are 660x480, some 640x480, some 660x448, and some 640x448. In addition, some games have a 16:9 option.
This means that I need 8 different filters - One for each aspect ratio of each resolution. In addition, this means that should I need to use a different crop for whatever reason, I have to make yet another scaling filter.


Ideally, I'd like a mathematic scaling filter with separate boxes for Horizontal scaling and Vertical scaling.
This means instead of having 8 filters, 4 for 4:3 and 4 for 16:6, I can make two filters that are something like this;

Code:
1.5x Scaling 4:3
H Filter = Bilinear
V Filter = Point
H = (H*(10/11))*1.5
V = V*1.5

1.5x Scaling 16:9
H Filter = Bilinear
V Filter = Point
H = ((H*(10/11))*1.5)*(4/3)
V = V*1.5


This would mean that no matter what resolution the input is cropped to, it will scale to the correct size for the respective input. It would save me having to use a ton of filters for each different crop, and everything would guarantee being scaled correctly.

If it's not too complicated, being able to use separate scaling filters for Horizontal and Vertical would also be extremely useful.
In the case of the SNES for example, I want to scale vertically 3x using Point scaling to preserve hard edges, but Horizontally (H*(8/7))*3 using bilinear scaling to blend cleanly. This is fairly easy to do using two separate filters, one for horizontal and one for vertical, but it's not super ideal.


I've attempted to make this myself, but I've got nowhere near enough experience in shader languages to even know where to start. It doesn't have to be a full addon, a LUA script that loads a shader with configurable options would be enough.
If someone would be willing to either take this on or point me in the direction of someone who would be willing, I would hugely appreciate it. I'm not expecting this for free either, I'd be more than willing to compensate for the time spent.


Thanks!
 
Top