-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nearest Neighbour filtering #1486
Conversation
So you want host-side nearest-neighbour upscaler? Then maybe it's better to simply use dedicated game upscaler like https://github.com/Blinue/Magpie. Adding it as processing option is basically a work multiplier, since we have to implement (and support) it across every platform and capture method. Just my two cents. |
Yes, thank you for the hint! Maybe it's actually better solution. |
If we stick to texture sampler scaling, which already doesn't work that well (any amount of image downscaling produces chroma artifacts because paired with 4:2:0 subsampling it results in >2x downscaling ratio). And with kernel-base scaling, nearest-neighbour will require different kernel of different size. It's certainly possible, but it will require more work, probably sooner than later. |
Oh, well, I see - things are actually more complicated and not so universal to be public change, though it works good for my case. |
Perhaps this idea might have still have merit in the specific case where the client resolution is evenly divisible by the host resolution? Here's a quick proof of concept: nightly...psyke83:nearest_scaling This should improve clarity when the host and client resolution are matched, but there is additional benefit when the client resolution is a multiple of the host. Consider my use case:
Streaming Moonlight at 1360x768 with current Sunshine nightly:
Streaming Moonlight at 2720x1536 (2x panel res) with current Sunshine nightly:
Streaming Moonlight at 1360x768 with nearest scaling branch:
Streaming Moonlight at 2720x1536 (2x panel res) with nearest scaling branch:
Granted this may be an odd use case, but I can envison the same benefit for standard resolutions (1080p panel with Moonlight @ 1080p to 1080p host, as well as 1080p panel with Moonlight @ 4K to 4K or 1080p host, etc.). |
@psyke83 thanks for the details. It seems there are definitely some possible benefits for image quality, with a potential for a small performance hit. If this is an option that can be disabled, then I see little harm in adding it. |
Nearest neighbour filtering should involve less overhead than bilinear filtering, but it's unlikely to cause any real performance change. The important part to stress is that having a simple on/off toggle as seen in this PR is not optimal. To illustrate, looking at my setup, enabling "point filtering" from this PR would do the following:
I know this is a niche setup, but the behaviour will replicate for standard resolutions (1080P and 4K, 1440P and 720P resolutions pairs) as well as OP's 960x544 & doubled resolution. The only sensible user configuration (if at all needed) would be an Auto/Off toggle, where Auto will only use nearest filtering when the client resolution is divisible by the host (i.e. my example branch) and Off to preserve the old behaviour for users that prefer the softer look provided by bilinear filtering for all resolutions. |
@psyke83 Our chroma shader relies on linear texture sampler for some math / texture fetch optimizations. |
It looks like this PR has been idle for 90 days. If it's still something you're working on or would like to pursue, please leave a comment or update your branch. Otherwise, we'll be closing this PR in 10 days to reduce our backlog. Thanks! |
@RomaRogov Thank you for the PR. Unfortunately at this time, we have decided not to accept this change. In order to re-consider this PR the comments by @ns6089 would need to be addressed. |
Description
Hello!
I've implemented new lever in config to control resize algorithm for textures with captured screen. This allows to get high-resolution pixel perfect stream video for some retro games or just low resolution which can be doubled.
For example, I'm using this with my Abernic RG505 device which has PlayStation Vita screen (960x544px), which has artifacts when stream has native resolution. But if I double stream resolution with nearest neighbour scaling I'm getting pixel-perfect image without any compression artifacts. May be also useful for PS Vita users.
Also now I can play retro games with 1080p streaming on high resolution devices and they are not blurry at all. So, this lever, as I think, definitely has a few applications.
I'm not very used to C++, so please give feedback if my changes should be refactored before merge. Thanks in advance!
Screenshot
Type of Change
.github/...
)Checklist
Branch Updates
LizardByte requires that branches be up-to-date before merging. This means that after any PR is merged, this branch
must be updated before it can be merged. You must also
Allow edits from maintainers.