-
-
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
Low quality display #40
Comments
What is the result of:
(especially the SDL version) What operating system do you use? Could you provide a screenshot in 1:1 (pixel-perfect) (press |
OK, so it seems the local resize is not filtered correctly.
Very recent, great. Could you try again with this change, please? --- a/app/src/screen.c
+++ b/app/src/screen.c
@@ -19,7 +19,7 @@ SDL_bool sdl_init_and_configure(void) {
atexit(SDL_Quit);
// Bilinear resizing
- if (!SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "1")) {
+ if (!SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "2")) {
LOGW("Could not enable bilinear filtering");
}
|
is there a chance to include that in a built windows package? |
I have no access to a Windows machine right now. You don't need to build the server (so no need for gradle), just use the prebuilt server. |
I have the same issue and tried rebuilding from source with the bilinear filtering patch above. It still looks grainy in resize to fit mode (ctrl+x). |
I just had this issue.
|
I actually solved it myself. scrcpy.exe > Properties > Compatibility > Change high DPI settings > Override high DPI scaling behavior > Scaling performed by: Application. It was the buggy Windows 10 that could not do it properly. Hope ths will help someone else. |
I would also like to thank you for a great software. |
I am facing a similar issue with a specific phone, I tried changing bitrate and DPI settings as mentioned above but none of those things worked. I see the same problem when using other screen mirroring software like Vysor. If I press Ctrl&g, the image is great quality, but the window is way too big to use. Any advice? This software looks like a much better alternative to the free version of Vysor so would love to use it. |
So the problem is related to the resize on the computer, it should not depend on the phone. Does it? |
If I use a different device, the quality is great at pretty much whatever size window it displays in, so it is specific to the phone. |
I hope this video helps explain what I am saying bit better: https://drive.google.com/file/d/1Ee349uUZ0QmzdTeygfrBlF_m0z1gJAd4/view?usp=sharing |
Thank you. Your first device size is 1080x2280. The quality decrease when you resizes down the device. Your second device size is 480x848, so in fact you don't resizes it down a lot (it's like you already pressed Ctrl+g), that's probably why the quality does not drop a lot. Resizing the window is done on the client side, so in theory when it is broken, it should not depend on the device. |
Is there anything I else I can try to fix the problem? |
You could try to compile without hidpi support:
|
If you use v1.9 and replace SDL2.dll by the one from v1.8, does it work better? |
I am using OSX 🙃 |
@acadet Ah yes, of course. I'm not sure this is the same problem as this issue. Is the quality better if you press Your problem is more likely a hidpi setting (each pixel takes 2×2 pixel). |
|
So it's definitely a hidpi issue. Is there a setting similar to #40 (comment) on macOS? |
Thank you so much, sorry for my stupidity. |
@cjxgm I guess we should implement the libswscale approach as an option too, at least for Windows and macOS (OpenGL mipmapping is only available on Linux on scrcpy concretely). I did a quick test, the performance seems ok (but to work properly the changes are quite intrusive, in particular, we must manually resize on window resize, create a texture on target size change instead of frame size change (but only if this option is enabled), reinit SwsContext when necessary, etc.). |
use --encoder parameter and encoder available example: --encoder OMX.google.h264.encoder |
I am working on supporting swscale filters. Here is a WIP branch you could test: scrcpy --window-height=400 --scale-filter=none
scrcpy --window-height=400 --scale-filter=trilinear # mipmap, which is the current default if supported
# swscale filters:
scrcpy --window-height=400 --scale-filter=bilinear
scrcpy --window-height=400 --scale-filter=bicubic
scrcpy --window-height=400 --scale-filter=x
scrcpy --window-height=400 --scale-filter=point
scrcpy --window-height=400 --scale-filter=area
scrcpy --window-height=400 --scale-filter=bicublin
scrcpy --window-height=400 --scale-filter=gauss
scrcpy --window-height=400 --scale-filter=sinc
scrcpy --window-height=400 --scale-filter=lanczos
scrcpy --window-height=400 --scale-filter=spline Thank you for your feedbacks 😉 cc @cjxgm |
However, for perfect responsiveness, the swscaling should be executed from a separate thread. I need to change that. |
Is there a binary build for the swscale branch? I'm on Windows so installing mingw64 is not trivial. |
@char101 Sorry, there isn't, and it requires to update the Windows build script to add a dependency to libswscale, so I will do that later once I get a proper implementation with scaling out of the main thread. |
Thanks. By the way, would it be possible to use |
Asynchronous swscaling brings too much complexity. In bulk (probably not exhaustive):
In any case, swscaling adds a lot of latency (and consumes a lot of CPU). For my 1440x3120 device, bicubic swscaling takes between 20ms and 60ms (depending on the target window size). Bilinear swscaling a bit less, but still a lot. I'm not sure it's worth it. The complexity would necessarily add bugs for things which work correctly now, and make the whole thing difficult to maintain. An alternative is to keep a synchronous version (like here, but it is not finished). The complexity is acceptable, but dozens of milliseconds on the UI thread is less acceptable. The real performant solution would be to enable mipmapping (which is sufficient and solves the problem) for renderers other than OpenGL. But SDL does not provide this possibility, and writing and maintaining shaders manually for all platforms is not conceivable (not enough time/resources).
In theory, yes, and the performance would be even better (with a smaller device size). However, in practice, on my devices, it does not work well, because it breaks the UI of apps (and even the system, the navigation bar is quite broken, the home screen and lock screen are a bit broken too…). |
This worked perfectly for me. My Android display is no longer pixelated when I set Windows 11 DPI compatibility to If you'd like to automate this configuration step on Windows 11, you can use the following PowerShell command. This assumes that
|
Add a windows manifest to set the DPI awareness by default: <https://docs.microsoft.com/en-us/windows/win32/hidpi/setting-the-default-dpi-awareness-for-a-process> Refs #40 <#40> Fixes #2865 <#2865>
I am not sure what happened, but on the latest Windows 11 dev preview build (22523.1000) with the latest NVIDIA driver 511.09, the text on the screen appears pixelated again. This is happening even though I set the If I press Any ideas how I can get sharp text back with the smaller window size?
Screenshot of PixelizationScaling Option SettingPixel Perfect Mode (looks sharp) |
What's the device size ("Initial texture" in the console) and the window size? What if you start with your device in landscape orientation? |
The quality of the text and graphics looks a lot better in landscape mode.
|
OK, so it's just that the device screen is rendered on a surface 3040 pixels height, and downscaled by a significant factor to your monitor height. There are two causes of bad quality related to this issue:
For the second issue, mipmapping reduces the problem: #1284 You could enable OpenGL renderer on Windows, but drivers are often slow/buggy: scrcpy --render-driver=opengl https://github.com/Genymobile/scrcpy/blob/master/FAQ.md#the-quality-is-low |
Yeah I already tried the OpenGL renderer, based on the document you linked to. It is still rather low quality text though. Both methods are kinda low quality compared to the landscape mode or OpenGL
OpenGL (no mipmaps)
|
Could you please test this binary (replace in v1.21): #2865 (comment) |
I downloaded it and enabled the Application-based DPI scaling on the binary. It's still pixelated. EDIT: Hmmmm, actually when I run that binary from my |
@pcgeek86 Use the official v1.21 release (not scoop or other), then replace |
I have Xiaomi Redmi 4 Pro and I get low quality display
The text was updated successfully, but these errors were encountered: