Skip to content

Add Video Super Resolution#1567

Open
linckosz wants to merge 1 commit intomoonlight-stream:masterfrom
linckosz:master
Open

Add Video Super Resolution#1567
linckosz wants to merge 1 commit intomoonlight-stream:masterfrom
linckosz:master

Conversation

@linckosz
Copy link
Copy Markdown

@linckosz linckosz commented Apr 16, 2026

Video Super Resolution (VSR) for Moonlight Android

Video Super Resolution (VSR) brings to video what DLSS/FSR bring to real-time 3D rendering.

This PR introduces high-quality spatial upscaling on Android using a highly optimized two-pass OpenGL ES 3.1 pipeline powered by Snapdragon Game Super Resolution (SGSR).

Mobile devices, Android TVs, and Android-based gaming handhelds can greatly benefit from receiving a lower-resolution video stream while reconstructing a sharper final image locally on-device.
This approach significantly reduces bandwidth usage, lowers decoder workload, and minimizes latency, while preserving excellent visual quality at the device's native resolution.

image

Technical Overview

Due to Android hardware decoding constraints, MediaCodec outputs frames to a samplerExternalOES texture, which is incompatible with standard 2D upscaling shaders.

To address this limitation, this PR introduces GlesPassthroughBridge, an efficient GPU-based two-pass pipeline:

  1. Pass 1 – Blit (OES → 2D):
    The hardware-decoded samplerExternalOES texture is rendered into a standard 2D texture using a Framebuffer Object (FBO).

  2. Pass 2 – Upscaling & Sharpening:
    The SGSR shader (sgsr1_shader_mobile_edge_direction) is applied to the 2D texture, producing a sharpened and upscaled image rendered to the display.


Performance & Optimizations

Mobile GPUs are extremely sensitive to overhead, so this implementation includes several aggressive optimizations:

  • Compile-Time Constant Folding
    Stream resolution parameters are injected directly into GLSL via #define macros.
    This eliminates per-frame computations and allows the compiler to fully optimize resolution-dependent math.

  • Vertex-Level Precomputation
    The vertex shader precomputes texture coordinates across the quad.
    These values are interpolated by the GPU hardware, effectively providing per-fragment data at zero cost.

  • Zero Added VSync Latency
    EGL VSync is explicitly disabled (eglSwapInterval(eglDisplay, 0)) to avoid introducing additional frame latency in the streaming pipeline.


Results

400% Zoom

Before
Zoom_Original

After
Zoom_Upscaled

Original

FreeboxTV_ORI

Video Super Resolution

FreeboxTV_VSR

Tests

This implementation was tested on two different classes of Android devices to evaluate performance across GPU tiers:

📱 Mobile – Realme Note 60 (Unisoc T612 / Mali-G57)

  • Baseline latency: 9 ms
  • With VSR: 12 ms
  • Impact: ~+3 ms

Performance on mobile is excellent, with very smooth rendering and minimal latency overhead.
This demonstrates that mid-range mobile GPUs can handle SGSR upscaling efficiently in real-time.


📺 TV – Xiaomi TV F 32 (2026) (Cortex-A55 / Mali-G31 MP2)

  • Baseline latency: 12 ms
  • With VSR: 26 ms
  • Impact: ~2x increase

On lower-end TV GPUs, the performance impact is significantly more pronounced.
Despite SGSR1 being one of the lightest and most optimized reconstruction upscalers available for mobile, entry-level GPUs such as the Mali-G31 struggle to sustain real-time performance without noticeable overhead.


These results highlight that while VSR is highly suitable for modern mobile GPUs, performance on low-end or TV-class hardware may vary and require further tuning or optional fallback strategies.

Other VSR Implementations

VSR is also available in other Moonlight ports:

This commit introduces a high-quality upscaling pipeline for Android
using the Snapdragon Game Super Resolution (SGSR) v1 algorithm.

- Implement OpenGL ES 3.1 capability check to unlock VSR features.
- Add a user preference (checkbox) to toggle between SGSR and standard rendering.
- Introduce a Two-Pass rendering pipeline using Framebuffer Objects (FBO)
  to convert OES textures to standard 2D textures, optimizing shader performance.
- Integrate a modified SGSR1 fragment shader with edge-direction logic
  tailored for mobile GPUs.
- Ensure the Moonlight performance overlay remains visible post-processing.

Ref: https://github.com/SnapdragonGameStudios/snapdragon-gsr/tree/main/sgsr/v1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant