dyne / frei0r

A large collection of free and portable video plugins
https://frei0r.dyne.org/
GNU General Public License v2.0
437 stars 91 forks source link

Speed up premultiply with 0 alpha #88

Closed rosslagerwall closed 4 years ago

rosslagerwall commented 4 years ago

Skip the multiplications if the alpha channel is 0 to speed up cases where the image is mostly fully transparent. perf showed this function to be a hotspot when compositing a mostly transparent image onto a video at 4K resolution.

Timings in ms with a (best-case) fully transparent 3840x2160 image:

    Before       After

-02 8.7 5.1 -03 8.7 4.1

ddennedy commented 4 years ago

Thanks!