View Full Version : More performant median averaging filter/plugin/script?


WalkyrieVanguard
30th July 2026, 17:28
Still using the classic median plugin, but it's rather dog slow in terms of plugins and well behind what's going on in VS. Does anyone know of any modern methods for achieving median of clips that's a bit more performant?

Plugin I'm currently using below:

http://avisynth.nl/index.php/Median

https://web.archive.org/web/20251121124338/http://avisynth.nl/index.php/Median

wonkey_monkey
30th July 2026, 18:02
Expr is about 4-5x faster on YUV444P8:

Expr(clip1, clip2, clip3, "x y min x y max z min max")

(not rigorously tested and may not work properly with chroma)

WalkyrieVanguard
30th July 2026, 20:24
Seems to work great, performance increase is stellar. Thank you!!

wonkey_monkey
30th July 2026, 23:06
A dedicated AVX plugin might get another 50% over that, if anyone wants to write one (or enough people want me to do so).

DTL
31st July 2026, 05:47
For SIMD accelerated fast median of 3 (up to AVX2 ?) there are already MedianBlurTemporal by pinterf - https://github.com/pinterf/MedianBlur2
For very close to median of 4 and more up to AVX512 - vsTTempSmooth(pmode=1) - https://github.com/Asd-g/AviSynth-vsTTempSmooth (if input number of clips is even - duplicate one of the clips and it will get a bit more weight in selection. With enough many clips this skew expected to be small enough).

To use with separated clips - Interleave(all) + median + SelectEvery(center).

Reel.Deel
31st July 2026, 09:04
I vote wonkey :) - plus the plugin could use HBD, only RGB64 was added and not optimized

WalkyrieVanguard
3rd August 2026, 16:11
A dedicated AVX plugin might get another 50% over that, if anyone wants to write one (or enough people want me to do so).

I'd certainly be interested (Ideally with AVX1 and 2 support)

DTL
3rd August 2026, 20:40
When Asd-g refuses to support an even number of frames in vsTTempSmooth pmode=1 I start to do an AveragePlus() filter https://github.com/DTL2020/AveragePlus with a vector of clips input. Some of the average algorithms support any number of input sources - not only odd numbers (as some of the median average implementations).

So to make a pure median with up to AVX2 someone may take the start of the AveragePlus() filter with vector of clips input and combine with the pinterf implementation of MedianBlur2 filter (median compute engine). It is a simple combination because it only replaces frames fetching from a single input clip to frames fetching from a list of input clips and all other complex median engine parts remain unchanged.

There are lots of different averaging modes planned (from single plane single sample level via many planes same sampling position samples values set to larger logical units averabing like intra frame block based and inter frame frame based). Each averaging unit size mode can support many similarity measurement modes (where applicable depending on unit size/type) and averaging algorithms. For example block-sized median may use SAD/SSIM/VIF type of similarity measurement.