Description

mt_expand expands the mask / the video. For every pixel compute the local maximum value. Expand refers to maximum; makes your picture brighter and it's usually used on masks to make covered areas wider, but can also be applied to video clips.

 Syntax and Parameters

mt_expand (clip, float "thY", float "thC", string "mode", float "Y", float "U", float "V", string "chroma", int "offX", int "offY", int "w", int "h", int "sse2", bool "sse3", bool "ssse3", bool "sse4", bool "avx", bool "avx2", float "A", string "alpha")

clip   =
Input clip.

float  thY = 255.0
float  thC = 255.0
thY and thC are used to limit the change of a pixel.
For example, if the original pixel luma value is 50, and after applying mt_expand it becomes 125. If thY is set to 25, the result value will be 75. In other words, each value in the output clip cannot be greater than original value plus thY. thC is the same limiter for chroma.

string  mode = "square"
Select the local neighbourhood. It can take the values :
• `"square"` : 3x3 square neighbourhood.
• "`horizontal"` : 3x1 horizontal neighbourhood.
• "`vertical"` : 1x3 horizontal neighbourhood.
• "`both"` : a 3-long cross ( "horizontal" + "vertical" ) neighbourhood.
• A custom mode, where you give a list of coordinates. Each pair of values is relative coordinate of a pixel, which will be taken into calculation.
First value is X offset, second is Y. So “0 0” means the current pixel, “1 0” – one pixel to the right, “-1 0” – one pixel to the left.
The official documentation here says that "0 0 -1 0 1 0" is equivalent to "horizontal” but in reality – it’s much slower.

float  Y = 3
float  U = 1
float  V = 1
float  A = 1
These three values describe the actual processing mode that is to be used on each plane / channel. Here is how the modes are coded :
• x = -255...0 : all the pixels of the plane will be set to -x.
• x = 1 : the plane will not be processed. That means the content of the plane after the filter is pure garbage.
• x = 2 : the plane of the first input clip will be copied.
• x = 3 : the plane will be processed with the processing the filter is designed to do.
• x = 4 : the plane of the second input clip will be copied.

string  chroma = ""
string  alpha = ""
When defined, the value contained in this string will overwrite the U and V processing modes.
This is a nice addition proposed by mg262 that makes the filter more user friendly. Allowed values for chroma are:
• "process" : set u = v = 3.
• "copy" or "copy first" : set u = v = 2.
• "copy second" : set u = v = 4.
• "xxx", where xxx is a number : set u = v = -xxx.

int  offX = 0
int  offY = 0
offX and offY are the top left coordinates of the box where the actual processing shall occur. Everything outside that box will be garbage.

int  w = -1
int  h = -1
w and h are the width and height of the processed box. -1 means that the box extends to the lower right corner of the video. That also means that default settings are meant to process the whole picture.

 Examples

mt_expand with default settings:

```mt_expand(clip, thY=255, thC=255, Y=3, U=1, V=1, chroma="", w=-1, h=-1)
```