Log in

View Full Version : Miscellaneous filters to test


Myrsloik
10th September 2016, 18:11
GitHub and downloads (https://github.com/vapoursynth/miscfilters)

I decided to do some more filter cleanup and see what could be improved and what was still missing. These are kinda useful functions but not useful enough for me to put them into the core so I just turned them into a lump.

Hysteresis (clipa clip;clipb clip;planes int[] opt) - the leftover from genericfilters that got dropped and some people still miss, based on HolyWu's pull request
SCDetect (clip clip;threshold float opt) - substitute for the scd.Detect function, internally implemented by using planestats (which won't be optimized until the next vs release)
AverageFrames ("clips clip[];weights float[];scale float opt;scenechange int opt;planes int[] opt") - a replacement for temporalsoften, temporalsoften is only ever used to average frames with or without different weights so this is more elegant, currently not optimized

For example misc.AverageFrames(singleclip, [1, 1, 1, 1, 1]) will replace temporalsoften with radius2 and max threshold (just blend)

version 4 (https://dl.dropboxusercontent.com/u/73468194/miscfilter4.7z)

Myrsloik
11th September 2016, 17:07
Fixed the Hysteresis bug and that AverageFrames would always ignore the scale argument and use the default. Link in first post.

Myrsloik
27th September 2016, 21:53
Version 3 is recompiled so maybe hysteresis will work for everyone now. Also fixes a few tiny argument checks and some coding style stuff. I consider everything in it done apart from maybe doing more optimizations.

Note that SCDetect will be a lot faster in the new VS release when planestats (which is used internally) is properly optimized.

Myrsloik
15th October 2016, 20:52
Update to version 4 if you're using this, I fixed plenty of issues and actually tested things this time.

feisty2
30th December 2016, 14:16
Guess it's better off to merge fix telecined fades into this misc stuff than to leave it as a standalone plugin, what do you say?

Myrsloik
30th December 2016, 14:28
Guess it's better off to merge fix telecined fades into this misc stuff than to leave it as a standalone plugin, what do you say?

I'll take a look at it. Maybe it'd fit into vivtc if I convert it to C and make it take integer input. Seems simple and useful. Maybe introduce a threshold so it leaves all pixels unmodified unless the change would be meaningful.

This is probably a bug in your code (https://github.com/IFeelBloated/Fix-Telecined-Fades/blob/master/Source.cpp#L144)

feisty2
30th December 2016, 14:44
This is probably a bug in your code (https://github.com/IFeelBloated/Fix-Telecined-Fades/blob/master/Source.cpp#L144)

I kinda copied that from the "invert" example

if (d.enabled < 0 || d.enabled > 1) {
vsapi->setError(out, "Invert: enabled must be 0 or 1");
vsapi->freeNode(d.node);
return;
}


something wrong with it?

Myrsloik
30th December 2016, 15:06
I kinda copied that from the "invert" example

if (d.enabled < 0 || d.enabled > 1) {
vsapi->setError(out, "Invert: enabled must be 0 or 1");
vsapi->freeNode(d.node);
return;
}


something wrong with it?

YES! IT IS NOT A COPY! C DOESN'T HAVE DESTRUCTORS!

FixFadesData (the equivalent) is allocated on the stack and doesn't need to be freed. Obviously you want something like
if (d->mode < 0 || d->mode > 2) {
vsapi->setError(out, "FixFades: mode must be 0, 1, or 2!");
delete d;
return;
}

feisty2
30th December 2016, 15:14
YES! IT IS NOT A COPY! C DOESN'T HAVE DESTRUCTORS!

FixFadesData (the equivalent) is allocated on the stack and doesn't need to be freed. Obviously you want something like
if (d->mode < 0 || d->mode > 2) {
vsapi->setError(out, "FixFades: mode must be 0, 1, or 2!");
delete d;
return;
}

oops, thought releasing "d" itself would be fixfadesFree()'s job(which was the reason I made node a null pointer after freeNode() so it won't be released twice.)

feisty2
30th December 2016, 15:21
anyways, it's now corrected:o