MaskTools/MaskedMerge
From Avisynth wiki
MaskedMerge (clip base_clip, clip overlay_clip, clip mask_clip)
Plugin: MaskTools
This filter applies the clip overlay_clip on the clip base_clip, considering the clip mask_clip. More precisely, with bc, oc and mc the values of three pixels taken respectively on base_clip, overlay_clip and mask_clip, the result will be :
v = ((256 - mc) * bc + mc * oc + 128) / 256
128 is here in order to reduce the error due to the rounding of the integer division.
So, if the mask is 255, the pixel will be the pixel from the overlay_clip, if the mask is 0, the pixel will be from the base_clip, and in between, it will be blended between both clips.
Back to MaskTools.