Fix mask start/apply corruption by intermediate filters #940
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When using mask_start and mask_apply, filters between them can corrupt the mask. This patch stores the mask on the clone frame so that intermediate filters can not corrupt it. The cloned frame mask is inverted and the composite is reversed to achieve the same effect.
Originally reported here:
https://forum.shotcut.org/t/beta-version-23-04-now-available-to-test/38269/125
Blur: Gaussian and Blur: Box do not work with Mask: Start and Mask: Apply because they apply the blur operation to the alpha mask that was generated by Mask: Start. Blur: Low Pass and Blur Exponential work just fine because they do not operate on the alpha mask. I did not take an inventory of what other filters are able to corrupt the alpha mask.
This patch is one idea I had to solve this problem for all filters. Maybe there are potential side effects I am not thinking of. Another idea I had is to add an option to Blur: Gaussian and Blur: Box to let the user tell the filter to not operate on the alpha channel. This option would have to be added to any filter that operates on alpha.