dyne / frei0r

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

rgbsplit0r is clearing the alpha channel #78

Closed ddennedy closed 5 years ago

ddennedy commented 5 years ago

See https://github.com/dyne/frei0r/blob/master/src/filter/rgbsplit0r/rgbsplit0r.c#L227

       // No need to save alpha because it will distort the resulting image

@namikiri Why? Now, if you use the effect in any scenario where there is compositing, the clip does not show up. If the effect does not affect or use the alpha channel, it should keep it as-is and not clear it!

ddennedy commented 5 years ago

The alpha channel does need to be affected in some way because this effect translates (spatially repositions) the RGB channels. For example, melt qtext: text=hello -attach frei0r.rgbsplit0r 0=0.2 1=0.2 (white text on black) produces: image It was not obvious or simple what to do with the channel. However, as described when compositing, nothing appears. Ideally, the alpha channel is the union of the alpha channel when translated by the each of the RGB channels' new positions. Or, if there is some difficulty, opaque or passed through.

ddennedy commented 5 years ago

Also, this filter is not thread-safe because its update function needlessly stores temporary color values in its private instance object instead of simply making them variables on the stack. I have a fix for that.

ddennedy commented 5 years ago

Here is how it looks now composited over noise using melt noise: -track qtext: text=hello -attach frei0r.rgbsplit0r 0=0.2 1=0.2 -transition frei0r.cairoblend image

namikiri commented 5 years ago

Hello! I'm sorry for being absent while this discussion as I wasn't able to take enough time for it.

Thank you @ddennedy for fixing the alpha-channel issue in my plugin. The reason was breaking the entire object in Kdenlive, I tested the plugins in it.