<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://www.avisynth.nl/index.php?action=history&amp;feed=atom&amp;title=STMedianFilter</id>
	<title>STMedianFilter - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://www.avisynth.nl/index.php?action=history&amp;feed=atom&amp;title=STMedianFilter"/>
	<link rel="alternate" type="text/html" href="http://www.avisynth.nl/index.php?title=STMedianFilter&amp;action=history"/>
	<updated>2026-09-01T08:41:49Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.46.0</generator>
	<entry>
		<id>http://www.avisynth.nl/index.php?title=STMedianFilter&amp;diff=6765&amp;oldid=prev</id>
		<title>Raffriff42: link fix</title>
		<link rel="alternate" type="text/html" href="http://www.avisynth.nl/index.php?title=STMedianFilter&amp;diff=6765&amp;oldid=prev"/>
		<updated>2015-11-08T04:46:40Z</updated>

		<summary type="html">&lt;p&gt;link fix&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw-interface=&quot;&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 06:46, 8 November 2015&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{FilterCat4|External_filters|Plugins|Restoration_filters|&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Spatio&lt;/del&gt;-&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;temporal_denoisers&lt;/del&gt;}}&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{FilterCat4|External_filters|Plugins|Restoration_filters|&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Spatial&lt;/ins&gt;-&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Temporal_Denoisers&lt;/ins&gt;}}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{Filter3&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{Filter3&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|{{Author/Tom Barry}}, {{Author/Fizick}}&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|{{Author/Tom Barry}}, {{Author/Fizick}}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Raffriff42</name></author>
	</entry>
	<entry>
		<id>http://www.avisynth.nl/index.php?title=STMedianFilter&amp;diff=5506&amp;oldid=prev</id>
		<title>Reel.Deal: STMedianFilter</title>
		<link rel="alternate" type="text/html" href="http://www.avisynth.nl/index.php?title=STMedianFilter&amp;diff=5506&amp;oldid=prev"/>
		<updated>2015-03-31T04:03:07Z</updated>

		<summary type="html">&lt;p&gt;STMedianFilter&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{FilterCat4|External_filters|Plugins|Restoration_filters|Spatio-temporal_denoisers}}&lt;br /&gt;
{{Filter3&lt;br /&gt;
|{{Author/Tom Barry}}, {{Author/Fizick}}&lt;br /&gt;
|v.0.1.0.3&lt;br /&gt;
|[http://web.archive.org/web/20130207143129/http://neuron2.net/trbarry/STMedianFilter.zip STMedianFilter.zip]&lt;br /&gt;
|Spatio-temporal denoisers&lt;br /&gt;
|[http://www.gnu.org/licenses/gpl-2.0.txt GPLv2]&lt;br /&gt;
|6=&lt;br /&gt;
[http://forum.doom9.org/showthread.php?t=56107 Doom9 Thread]&lt;br /&gt;
[http://forum.doom9.org/showthread.php?t=89211 Doom9 Thread 2]}}&lt;br /&gt;
== Description ==&lt;br /&gt;
STMedianFilter is a (slightly motion compensated) spatial/temporal median filter. It fairly very fine grained, using only adjacent pixels in space and time, so it looks at the adjacent 26 locations to filter each location.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Requirements ==&lt;br /&gt;
* AviSynth 2.5.8 or later &lt;br /&gt;
* Supported color formats: [[YUY2]], [[YV12]]&lt;br /&gt;
&lt;br /&gt;
* [[SSE]] / [[MMX]] compatible CPU&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== [[Script variables|Syntax and Parameters]] ==&lt;br /&gt;
:{{Template:FuncDef|STMedianFilter (clip, int, int, int, int)}}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::{{Par2| |clip| }}&lt;br /&gt;
:::Input clip; only luma will be processed.&lt;br /&gt;
&lt;br /&gt;
::{{Par2| |int| }}&lt;br /&gt;
:::&amp;lt;tt&amp;gt;&amp;#039;&amp;#039;&amp;#039;S_FilterThreshHold&amp;#039;&amp;#039;&amp;#039;&amp;lt;/tt&amp;gt;: don&amp;#039;t spatial filter pixel if it would change it more than this. Larger values may cause loss of fine line detail but it&amp;#039;s not extremely sensitive.&lt;br /&gt;
&lt;br /&gt;
::{{Par2| |int| }}&lt;br /&gt;
:::&amp;lt;tt&amp;gt;&amp;#039;&amp;#039;&amp;#039;S_EdgeThreshHold&amp;#039;&amp;#039;&amp;#039;&amp;lt;/tt&amp;gt;: don&amp;#039;t spatial filter pixel if on an edge where vals change more than this. It seems fairly forgiving, so it can be raised a lot if desired.&lt;br /&gt;
&lt;br /&gt;
::{{Par2| |int| }}&lt;br /&gt;
:::&amp;lt;tt&amp;gt;&amp;#039;&amp;#039;&amp;#039;T_FilterThreshHold&amp;#039;&amp;#039;&amp;#039;&amp;lt;/tt&amp;gt;: don&amp;#039;t temporal filter pixel if it would change it more than this. Large values will cause ghosting. Don&amp;#039;t set over 5-10 to avoid ghosting.&lt;br /&gt;
&lt;br /&gt;
::{{Par2| |int| }}&lt;br /&gt;
:::&amp;lt;tt&amp;gt;&amp;#039;&amp;#039;&amp;#039;T_MotionThreshHold&amp;#039;&amp;#039;&amp;#039;&amp;lt;/tt&amp;gt;: don&amp;#039;t temporal filter pixel if uncompensated motion vals change more than this. Don&amp;#039;t set over about 10 to avoid ghosting.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::*S and T above stand for spatial and temporal, respectively.&lt;br /&gt;
::*Valid values for each are from 0 to 255. Larger values cause more filtering but more artifacts.&lt;br /&gt;
::*&amp;#039;&amp;#039;&amp;#039;Note:&amp;#039;&amp;#039;&amp;#039; all parameters are unnamed and do not have a default so they must be specified.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Examples ==&lt;br /&gt;
A good starting point:&lt;br /&gt;
 [[AviSource]](&amp;quot;Blah.avi&amp;quot;)&lt;br /&gt;
 STMedianFilter(8,15,4,7) # (S_FilterThreshHold, S_EdgeThreshHold, T_FilterThreshHold, T_MotionThreshHold) &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Method of Operation==&lt;br /&gt;
But if I understand it right a simple median filter is just a clipping step where a value is set to not extend past the high and low of its neighbors. &lt;br /&gt;
&lt;br /&gt;
For instance, if you had 3 pixels in a row that had the values &amp;lt;5,8,7&amp;gt; you could clip the center one to not be outside the low of 5 or the high of 7,so you would set it to 7. &lt;br /&gt;
&lt;br /&gt;
Now imagine you had a small 3x3 video screen, like one surface of a Rubik&amp;#039;s cube. Imagine the previous frame was the bottom layer of the cube, the current frame was the middle layer, and the next frame was the top. &lt;br /&gt;
&lt;br /&gt;
Then the current center pixel would be right in the center of the Rubik&amp;#039;s cube and there would be 13 ways you could draw a line through it and a pair of two nearest neighbors. &lt;br /&gt;
&lt;br /&gt;
What I did was to compare each of those pairs of neighbors to see which pair was most agreeing on value. I used that pair to clip the value of the center pixel.  &lt;br /&gt;
&lt;br /&gt;
I also clipped the pixel value only if both: &lt;br /&gt;
&lt;br /&gt;
#It would not change the pixel value by more then the FilterThreshold parm value, and &lt;br /&gt;
# The amount of &amp;#039;uncompensated motion&amp;#039; (agreement on value by neighbors) was less than the MotionThreshHold parm value.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== Changelog ==&lt;br /&gt;
 Version       Date            Changes&amp;lt;br&amp;gt;&lt;br /&gt;
 v0.1.0.3      2004/08/19      - [http://avisynth.nl/users/fizick/stmedian/stmedian.html Released by Fizick 2005/01/30]&lt;br /&gt;
                               - Fixed bug with spatial filter radius for YV12&lt;br /&gt;
 v0.1.0.2      2004/08/10      - by Fizick  - not public&lt;br /&gt;
                               - Fix one main bug (for both YUY2 and YV12 modes):&lt;br /&gt;
                                 in all previous versions light pixels were not filtered,&lt;br /&gt;
                                 both S_EdgeThreshHold and T_MotionThreshHold did not work also.&lt;br /&gt;
 v0.1.0.1      2003/06/22      - Fix bug affecting YV12 only&lt;br /&gt;
 v0.1.0.0      2003/01/22      - Remove chroma filtering again. Add YV12 support. Use Pluginit2&lt;br /&gt;
                               - Also remove Horizontal parms, add them to spatial.&lt;br /&gt;
                               - Hopefully fix purple tint.					&lt;br /&gt;
 v0.0.3.0      2002/08/03      - Add some chroma filtering&lt;br /&gt;
 v0.0.2.0      2002/08/03      - Bugs, Split out spatial, Temporal, Horizontal user parms&lt;br /&gt;
 v0.0.1.0      2002/08/02      - Initial test release &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Archived Downloads ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;; width=&amp;quot;600px&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!!width=&amp;quot;100px&amp;quot;| Version&lt;br /&gt;
!!width=&amp;quot;150px&amp;quot;| Download&lt;br /&gt;
!!width=&amp;quot;150px&amp;quot;| Mirror&lt;br /&gt;
!!width=&amp;quot;150px&amp;quot;| Mirror 2&lt;br /&gt;
|-&lt;br /&gt;
!v0.0.1.3&lt;br /&gt;
|[http://web.archive.org/web/20130207143129/http://neuron2.net/trbarry/STMedianFilter.zip STMedianFilter.zip]&lt;br /&gt;
|[http://avisynth.nl/users/fizick/stmedian/stmedianfilter0103.zip stmedianfilter0103.zip]&lt;br /&gt;
|[http://avisynth.org.ru/stmedian/stmedianfilter0103.zip stmedianfilter0103.zip]&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== External Links ==&lt;br /&gt;
*[http://web.archive.org/web/20110627220738/http://neuron2.net/trbarry/Readme_STMedianFilter.txt Archive.org] -  Original archived documentation.&amp;lt;br&amp;gt;&lt;br /&gt;
*[http://avisynth.org.ru/docs/english/externalfilters/stmedianfilter.htm avisynth.org.ru] - STMedianFilter documentation, [http://avisynth.org.ru/docs/russian/externalfilters/stmedianfilter.htm Russian].&lt;br /&gt;
*[http://forum.doom9.org/showthread.php?t=55266 Doom9 Forum] - Simple Temporal Median Filter.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
-----------------------------------------------&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Back to [[External_filters#Spatio-Temporal_Denoisers| External Filters]] &amp;amp;larr;&amp;#039;&amp;#039;&amp;#039;&lt;/div&gt;</summary>
		<author><name>Reel.Deal</name></author>
	</entry>
</feed>