-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
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
Small feedback on the new trilinear filtering support #1394
Comments
Thank you for your feedbacks. 👍
Yes, mipmapping is a quick-and-dirty solution to get a better downscale quality, but it is definitely not the best: #40 (comment) But implementing another solution in GPU would require to write fragment shaders manually instead of relying on SDL renderers. If the target was only OpenGL (on Linux), I would probably do that (and I would had a better control on what to draw). But since other renderers (direct3d, metal, vulkan, etc.) must still be supported, it's complicated (I would like to avoid several totally different rendering code paths). And even with only OpenGL, writing shaders compatible with all OpenGL versions on all the platforms is quite a lot of work (we do that on VLC).
Without mipmapping, the quality is very low when the device definition is far higher than the scrcpy window. Therefore, maybe increasing the (negative) bias is a better compromise? diff --git a/app/src/screen.c b/app/src/screen.c
index 0af8de8..f91afb5 100644
--- a/app/src/screen.c
+++ b/app/src/screen.c
@@ -193,7 +193,7 @@ create_texture(struct screen *screen) {
// Enable trilinear filtering for downscaling
gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
GL_LINEAR_MIPMAP_LINEAR);
- gl->TexParameterf(GL_TEXTURE_2D, GL_TEXTURE_LOD_BIAS, -.5f);
+ gl->TexParameterf(GL_TEXTURE_2D, GL_TEXTURE_LOD_BIAS, -1.f);
SDL_GL_UnbindTexture(texture);
} |
I missed the detailed comparison on the first issue, thanks for relinking it. The -1 LOD bias looks quite close to bicubic and overall improved against the original bilinear (older default?) to my eyes, but from the thread it seems up to the viewer. Maybe let it rock and then change it - I feel like the feature will be missed by many. From my rounds within the emulation crowd multiplat support feels like a demon, there's iffy support from all sides. Diving on it alone while people ask you for clients and stuff isn't something I would choose :P |
I will probably do some tests again, and I might set lod bias to -1 by default instead of 0.5 (I would like to avoid adding a command line option for that, which would be too obscure for users). @cjxgm What do you think about -1 by default? |
-1 has a little bit of sharpening artifact, but ordinary users may prefer such look. Just like TVs. They always default to an over-sharpened look and that's probably because people like it better. |
Mipmapping caused too much blurring. Using a LOD bias of -1 instead of -0.5 seems a better compromise to avoid low-quality downscaling while keeping sharp edges in any case. Refs <#1394> Refs <#40 (comment)>
I set LOD bias to -1 in ac4c8b4. 🚀 |
Didn't saw the release and didn'i want do post on a closed issue, so sorry in advance @rom1v
The feature works as expected with
--render-driver=opengl
, taking quite a toll on an 530 iGPU and with slight perceptible but easily ignobable lag on my laptop's 960M.As expected there's a fair ammount of blurring on small details such as fonts but images/videos are more tolerant, even improved by less artifacts. Since gaming seems to be very popular use-case for scrcpy it might be very useful, as long as the computer can push the frames, but for general usage I found better to stick to the original.
While toying with OBS I found bicubic downsampling sharper without noticeable image degradation, when comparing side-by-side with its bilinear implementation.
Just some ramblings I had in mind when trying it, feel free to adress as you like. Here's some simple prints I made while testing in 1080p. Left is ogl-trilinear and right is default, both on 1.13. Hope compression doesn't kill it.
Excellent work as always, much appreciated.
The text was updated successfully, but these errors were encountered: