Log in

View Full Version : New plugin: WAverage


AVIL
11th February 2009, 21:28
Hi:

This is my first plugin. Is not optimized and probably buggy. But perhaps could be useful for anyone.

Edited:

This first version not run. Get it three post ahead

Fizick
11th February 2009, 22:47
what it does? :)

AVIL
11th February 2009, 23:03
Sorry, my first intention was to reproduce the help in the post but I forgot it (problems of a novel).

It averages some clips using another clips as weighting masks. An example of use is given in the thread:

http://forum.doom9.org/showthread.php?t=144943

Anyway the help states:


**** Weighted Average by AVIL ****

Usage

WAverage(clip Cbase, clip Clip1, clip Mask1, clip Clip2, clip Mask2,....,int base)

Description:

This plugin make weighted averages of the input clips according to the value of the parameter base.

.- Base > 0:

Calculates a clip whose pixels are the wheighted average of the pixels in the input clips.
The weights are picked from the collocated pixel in the next mask clips except for the clip Cbase that use parameter base as wheight.

Result = ( Cbase * base + sum(clipx * maskx)) / (base + sum(maskx))

x=1..N
N=Number of mask clips

.- Base = 0:

Same as base>0 excepting that clip Cbase is not used (must be present, but you can replicate any of the others)

Result = sum(clipx * maskx) / sum(maskx)

x=1..N
N=Number of mask clips

.- Base <0 (Default for base is -1)

Calculates another weight average similar to mt_merge function but extensible to more than trhee clips:

Result = ( Cbase * (N*255 - sum(maskx)) + sum(clipx * maskx)) / (N*255)

x=1..N
N=Number of mask clips

If N=1 the formula above leads to:

Result = (Cbase *(255-mask) + clip*mask)/255 which is the familiar merge formula.

McCauley
13th February 2009, 22:08
Hi AVIL,

thanks for this. I wanted to try it, but i can't load the Plugin.
Doesn't work with autoload nor LoadPlugin...
Is the problem on my side?!
WinXP SP3, Avisynth 2.5.7 MT

Regards
McCauley

AVIL
14th February 2009, 03:24
Hi,

I'm investigating the problem but my skills are very limitated. I can tell that the problem not is the XP SP3 nor the version of Avisynth. The plugin is compilated with visual c++ 2008 express edition and could be your system lacks of any runtime library. Moreover, the plugin is compilated in mode "debug" and must be compilated in mode release.

Then you can:

- Reload the plugin, now compilated in release mode
- Test it. If don't load then install the c++ runtime libraries:

http://www.microsoft.com/downloads/details.aspx?familyid=A5C84275-3B97-4AB7-A40D-3802B2AF5FC2&displaylang=en

Thanks for your interest and good luck.

McCauley
19th February 2009, 21:22
Hi AVIL,

thanks the latest version works for me!

Regards
McCauley