<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://avisynth.nl/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://avisynth.nl/index.php?action=history&amp;feed=atom&amp;title=MaskTools2%2Fmt_expand</id>
		<title>MaskTools2/mt expand - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://avisynth.nl/index.php?action=history&amp;feed=atom&amp;title=MaskTools2%2Fmt_expand"/>
		<link rel="alternate" type="text/html" href="http://avisynth.nl/index.php?title=MaskTools2/mt_expand&amp;action=history"/>
		<updated>2026-04-25T12:45:26Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.19.24</generator>

	<entry>
		<id>http://avisynth.nl/index.php?title=MaskTools2/mt_expand&amp;diff=12490&amp;oldid=prev</id>
		<title>Reel.Deal: mt_expand documentation</title>
		<link rel="alternate" type="text/html" href="http://avisynth.nl/index.php?title=MaskTools2/mt_expand&amp;diff=12490&amp;oldid=prev"/>
				<updated>2021-12-09T11:37:35Z</updated>
		
		<summary type="html">&lt;p&gt;mt_expand documentation&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{FilterCat4|External_filters|Plugin_functions|Other_filters|Support_filters}}&lt;br /&gt;
-----------------------------------------------&lt;br /&gt;
'''Back to [[MaskTools2#Filters|MaskTools2]] &amp;amp;larr;'''&lt;br /&gt;
-----------------------------------------------&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Description ==&lt;br /&gt;
'''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.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== [[Script variables|Syntax and Parameters]] ==&lt;br /&gt;
:{{Template:FuncDef|mt_expand (clip, float &amp;quot;thY&amp;quot;, float &amp;quot;thC&amp;quot;, string &amp;quot;mode&amp;quot;, float &amp;quot;Y&amp;quot;, float &amp;quot;U&amp;quot;, float &amp;quot;V&amp;quot;, string &amp;quot;chroma&amp;quot;, int &amp;quot;offX&amp;quot;, int &amp;quot;offY&amp;quot;, int &amp;quot;w&amp;quot;, int &amp;quot;h&amp;quot;, int &amp;quot;sse2&amp;quot;, bool &amp;quot;sse3&amp;quot;, bool &amp;quot;ssse3&amp;quot;, bool &amp;quot;sse4&amp;quot;, bool &amp;quot;avx&amp;quot;, bool &amp;quot;avx2&amp;quot;, float &amp;quot;A&amp;quot;, string &amp;quot;alpha&amp;quot;)}}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2| |clip| }}&lt;br /&gt;
:::Input clip.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|thY|float|255.0}}&lt;br /&gt;
::{{Par2|thC|float|255.0}}&lt;br /&gt;
:::{{Template:FuncDef3|thY}} and {{Template:FuncDef3|thC}} are used to limit the change of a pixel. &lt;br /&gt;
:::For example, if the original pixel luma value is 50, and after applying {{Template:FuncDef3|mt_expand}} it becomes 125. If {{Template:FuncDef3|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 {{Template:FuncDef3|thY}}. {{Template:FuncDef3|thC}} is the same limiter for chroma.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|mode|string|&amp;quot;square&amp;quot;}}&lt;br /&gt;
:::Select the local neighbourhood. It can take the values :&lt;br /&gt;
:::*&amp;lt;code&amp;gt;&amp;quot;square&amp;quot;&amp;lt;/code&amp;gt; : 3x3 square neighbourhood.&lt;br /&gt;
:::*&amp;quot;&amp;lt;code&amp;gt;horizontal&amp;quot;&amp;lt;/code&amp;gt; : 3x1 horizontal neighbourhood.&lt;br /&gt;
:::*&amp;quot;&amp;lt;code&amp;gt;vertical&amp;quot;&amp;lt;/code&amp;gt; : 1x3 horizontal neighbourhood.&lt;br /&gt;
:::*&amp;quot;&amp;lt;code&amp;gt;both&amp;quot;&amp;lt;/code&amp;gt; : a 3-long cross ( &amp;quot;horizontal&amp;quot; + &amp;quot;vertical&amp;quot; ) neighbourhood.&lt;br /&gt;
:::*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.&amp;lt;br&amp;gt; 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. &amp;lt;br&amp;gt; The official documentation here says that &amp;quot;0 0 -1 0 1 0&amp;quot; is equivalent to &amp;quot;horizontal” but in reality – it’s much slower. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|Y|float|3}}&lt;br /&gt;
::{{Par2|U|float|1}}&lt;br /&gt;
::{{Par2|V|float|1}}&lt;br /&gt;
::{{Par2|A|float|1}}&lt;br /&gt;
:::These three values describe the actual processing mode that is to be used on each plane / channel. Here is how the modes are coded :&lt;br /&gt;
::::*x = -255...0 : all the pixels of the plane will be set to -x.&lt;br /&gt;
::::*x = 1 : the plane will not be processed. That means the content of the plane after the filter is pure garbage.&lt;br /&gt;
::::*x = 2 : the plane of the first input clip will be copied.&lt;br /&gt;
::::*x = 3 : the plane will be processed with the processing the filter is designed to do.&lt;br /&gt;
::::*x = 4 : the plane of the second input clip will be copied.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|chroma|string|&amp;quot;&amp;quot;}}&lt;br /&gt;
::{{Par2|alpha|string|&amp;quot;&amp;quot;}}&lt;br /&gt;
:::When defined, the value contained in this string will overwrite the {{Template:FuncDef3|U}} and {{Template:FuncDef3|V}} processing modes.&lt;br /&gt;
:::This is a nice addition proposed by mg262 that makes the filter more user friendly. Allowed values for chroma are:&lt;br /&gt;
::::*&amp;quot;process&amp;quot; : set u = v = 3.&lt;br /&gt;
::::*&amp;quot;copy&amp;quot; or &amp;quot;copy first&amp;quot; : set u = v = 2.&lt;br /&gt;
::::*&amp;quot;copy second&amp;quot; : set u = v = 4.&lt;br /&gt;
::::*&amp;quot;xxx&amp;quot;, where xxx is a number : set u = v = -xxx.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|offX|int|0}}&lt;br /&gt;
::{{Par2|offY|int|0}}&lt;br /&gt;
:::{{Template:FuncDef3|offX}} and {{Template:FuncDef3|offY}} are the top left coordinates of the box where the actual processing shall occur. Everything outside that box will be garbage.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2|w|int|-1}}&lt;br /&gt;
::{{Par2|h|int|-1}}&lt;br /&gt;
:::{{Template:FuncDef3|w}} and {{Template:FuncDef3|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.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Examples ==&lt;br /&gt;
mt_expand with default settings:&lt;br /&gt;
 mt_expand(clip, thY=255, thC=255, Y=3, U=1, V=1, chroma=&amp;quot;&amp;quot;, w=-1, h=-1)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
-----------------------------------------------&lt;br /&gt;
'''Back to [[MaskTools2#Filters|MaskTools2]] &amp;amp;larr;'''&lt;br /&gt;
-----------------------------------------------&lt;/div&gt;</summary>
		<author><name>Reel.Deal</name></author>	</entry>

	</feed>