Skip to content
Snippets Groups Projects

qt: leverage premultiplied color for blending without pipeline state change and get rid of layering in player background

Merged Fatih Uzunoğlu requested to merge fuzun/vlc:qt/homoblend into master

Premultiplied color enables us using different blending modes without adjusting the pipeline state (while keeping the default source-over blending the pipeline uses). I first started doing this in the noise item where we needed additive blending !6574 (merged) (before I realized this, I had to come up with a special node that adjusts pipeline state for additive blending).

As long as the color is grayscale, we can also do multiply/screen blending. If the color is not grayscale, we need to change the pipeline state.

The main advantage of that is we eliminate the extra framebuffer (layering) used to manually blend. That frame buffer is naturally very large in player background, so I expect this to reduce the VRAM usage (#26908).

There is more information regarding premultiplied alpha here that I can recommend to interested people: https://github.com/dtrebilco/PreMulAlpha and blending modes: https://en.wikipedia.org/wiki/Blend_modes.

I also considered using colorization of MultiEffect, but decided to not use it because it is not really alpha compositing in itself but rather linear interpolation (uses mix()). And that is not available before Qt 6.5 as well. It needs further investigation if mix() can be used to achieve the same effect so that we don't even need an additional node (when MultiEffect is available), maybe with RGB(0.5, 0.5, 0.5) as used here would be fine with mix().

Request review @chub.

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
Please register or sign in to reply
Loading