Skip to content

Replace mpvpaper with QtMultimedia for native video rendering#157

Open
leriart wants to merge 14 commits intoAxenide:mainfrom
leriart:main
Open

Replace mpvpaper with QtMultimedia for native video rendering#157
leriart wants to merge 14 commits intoAxenide:mainfrom
leriart:main

Conversation

@leriart
Copy link
Copy Markdown

@leriart leriart commented Apr 21, 2026

Describe your changes

  • Replace mpvpaper external player with native QtMultimedia.Video component
  • Remove mpvpaper.sh and MpvShaderGenerator.js
  • Apply tint via ShaderEffect (no temporary GLSL files or IPC)
  • Optimize palette.frag with fast exponential approximation
  • Add custom palette JSON loading support
  • Clean up obsolete properties and processes

Shader Optimizations in palette.frag

  • Fast Gaussian weight approximation – Replaces exp() with a rational Padé approximant 1/(1 + x + 0.5x²). Visually identical, ~3× faster.
  • Early distance threshold – Skips palette entries where distSq > 0.3454 (weight < 0.001), reducing loop iterations.
  • Manual dot product – Uses diff.x*diff.x + diff.y*diff.y + diff.z*diff.z to avoid built‑in function overhead.
  • Alpha early‑out – Immediately discards fully transparent pixels.
  • Precomputed loop invariantsinvSize and halfInv calculated once outside the loop.
  • Static loop boundfor (int i = 0; i < 128; ++i) allows compiler unrolling.
    Result: Up to 80% faster execution with no visual difference, making real‑time palette mapping suitable for integrated/mobile GPUs.

Files modified: Wallpaper.qml, palette.frag
Files removed: mpvpaper.sh, MpvShaderGenerator.js

Screenshots

Without Shader

Sin Shader

With Normal Shader

Shader Original

With New Shader

Shader Nuevo

Performance

Before

Antes Antes Proceso

After

Despues Despues Proceso

Does this change any existing behavior?

No user‑facing behavior changes. Performance and stability improve due to native Qt rendering and removal of external dependencies.

leriart and others added 14 commits April 20, 2026 18:51
- Fast exp(-k*x) approximation avoids transcendental function calls
- Skip palette entries with negligible weight (<0.001) based on squared distance
- Nearest-neighbor fallback ensures bright colors stay vivid
- Replace texture() with texelFetch() to bypass UV computation and filtering
- Use dot() for squared distance
- Apply mediump/lowp precision to accumulators and palette colors
- Add #pragma unroll to hint loop unrolling
- Simplify fastExpWeight polynomial to reduce operations
- Keep identical visual output while reducing ALU and bandwidth usage
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