View Full Version : Continuity Fixer for VapourSynth
MonoS
14th February 2015, 20:03
I ported Continuity fixer to vapousynth about a month ago.
For those who don't know this avs filter, it help repairing damaged borders of video frames, often used for inverse kernel downscaling when you have some dead pixel at the borders.
I moved the code to github just because, you'll find all the information there.
https://github.com/MonoS/VS-ContinuityFixer
Thanks
Mirkosp, JEEB, HolyWu, jackoneill and Myrsloik
jackoneill
14th February 2015, 22:31
You ported your first plugin! Congratulations!
Here are some things I noticed:
* The double negative (!!) will turn your filter's parameters into either 0 or 1. The Avisynth filter doesn't behave that way.
* The parameters "left", "top", "right", and "bottom" are not optional. VapourSynth will throw an error if any of them is not passed. In that case, continuityCreate is not executed, therefore "err" is always 0:
d.bottom = !!vsapi->propGetInt(in, "bottom", 0, &err);
if (err)
{
vsapi->setError(out, "ContinuityFixer: no bottom parameter");
vsapi->freeNode(d.node);
return;
}
* The registerFunc call can look like this too:
registerFunc("ContinuityFixer",
"clip:clip;"
"left:int;"
"top:int;"
"right:int;"
"bottom:int;"
"radius:int:opt;"
, continuityCreate, 0, plugin);
The compiler will concatenate that into a single string. It's much easier to read.
* The default value for "radius" is 0 in the Avisynth filter (https://github.com/sekrit-twc/EdgeFixer/blob/master/EdgeFixer/avsplugin.cpp#L125). I wonder why you chose
d.radius = !!vsapi->propGetInt(in, "radius", 0, &err);
if (err)
{
d.radius = d.vi->height < d.vi->width ? d.vi->height : d.vi->width;
}
?
* For 16 bit input, you need larger data types in "least_squares", to prevent overflow. Maybe in other places, too. I didn't look too closely.
* You have some unused variables.
MonoS
15th February 2015, 01:08
* The double negative (!!) will turn your filter's parameters into either 0 or 1. The Avisynth filter doesn't behave that way.
That's actually explain a lot of things, copypasta from the example plugin, having tested the plugin with only little border i didn't noticed that bug.
* The parameters "left", "top", "right", and "bottom" are not optional. VapourSynth will throw an error if any of them is not passed. In that case, continuityCreate is not executed, therefore "err" is always 0
Then i'll remove the 4 checks
* The registerFunc call can look like this too
A LOOOOOOOOOT nicer, i'll do it
* The default value for "radius" is 0 in the Avisynth filter. I wonder why you chose
I chose this following mirkosp explanation on an italian forum
di default usa il lato pił corto come radius (quindi, generalmente, l'altezza)
Translated: by default it use the shortest side as the radius (generally the height)
He created the first version so i think he is right, also cause a radius of 0 will probably interpolate nothing.
* For 16 bit input, you need larger data types in "least_squares", to prevent overflow. Maybe in other places, too. I didn't look too closely.
This is a reason for not port plugin at 3AM, i completely forgot about the squaring and multiplication, i'll try larger type and see if the artifact disappear.
* You have some unused variables.
Some leftover, i'll delete them [but the compiler should delete it anyway]
Thanks you a lot for the tips, i'll try to address all of those ASAP [probably tomorrow] :)
MonoS
16th February 2015, 12:27
v2 released
-fixed some "i can't write proper code" bug
-Added some optimization in the compile script
-Removed some unused variables
v3 should come in the future with 16bit support, i hope
MonoS
18th February 2015, 19:46
v3 released
16bit support, yay(??)
For v4 i plan to extend the plugin to work on all the planes in a single call or maybe to port ReferenceFixer [JEEB already wrote, is only a matter of integrating it], we will see.
jackoneill
18th February 2015, 20:34
v3 released
16bit support, yay(??)
For v4 i plan to extend the plugin to work on all the planes in a single call or maybe to port ReferenceFixer [JEEB already wrote, is only a matter of integrating it], we will see.
That looks like you only support 16 bit now. You can have both with C++ templates (and C macros, but that's uglier).
MonoS
18th February 2015, 21:04
That looks like you only support 16 bit now. You can have both with C++ templates (and C macros, but that's uglier).
Yes, as i said i don't care and i prefer to use my time implement useful things than fighting with the template system :p
jackoneill
19th February 2015, 15:04
Yes, as i said i don't care and i prefer to use my time implement useful things than fighting with the template system :p
There is no need to fight. It's a very simple use of templates: https://gist.github.com/dubhater/b9670397036c353664f5/revisions
MonoS
24th February 2015, 12:27
V4 released
8 and 16bit support [maybe also intermediate bitdepth] thanks to jackoneill
Next version all plane processing in one call, maybe.
MonoS
24th February 2015, 15:18
I moved the code to github cause i had some spare time
MonoS
1st April 2015, 12:10
New version, now the plugin seems to behave like the original [at least for 8bit clips].
MonoS
6th April 2015, 00:29
Two version and finally the plugin got multiplane processing in a single call, now the user can process the plane of Baator and Carceri in the same call if he/she wants :D
Also solved a bug in the saturating procedure.
Keiyakusha
15th June 2016, 21:28
Hey guys. I'm trying to use latest github release of this plugin with VS R32. First of all, it doesn't work at all unless I'll put "libgcc_s_dw2-1.dll" near it. This doesn't look correct to me.
And then while it does work, it barely makes any difference, unlike its avisynth version (with equivalent settings). Is there anything that can be done about it?
MonoS
15th June 2016, 23:02
Hey guys. I'm trying to use latest github release of this plugin with VS R32. First of all, it doesn't work at all unless I'll put "libgcc_s_dw2-1.dll" near it. This doesn't look correct to me.
And then while it does work, it barely makes any difference, unlike its avisynth version (with equivalent settings). Is there anything that can be done about it?
Hi Keiyakusha, if i'm not mistaken you are using the 32 bit version, am i right? the lack of this dll is due to the fact that i compiled the dll without including other libraries, AFAIK this does not cause any missing dll on the 64bit build.
This version was never properly tested because i don't have an x86 vapoursynth installation.
Can you try this script?
down = core.fmtc.bitdepth(src, bits=8).fmtc.bitdepth(bits=16)
fixed = core.edgefixer.ContinuityFixer(down, [10,10,10], [10,10,10], [10,10,10], [10,10,10], [10,10,10])
stacked = core.fmtc.nativetostack16(fixed)
if the filter is working you'll see some gibberish at the edge of the bottom frame (something like this https://abload.de/img/gibberishxrk46.png ), if you see all green then there is a problem.
I can assure you the 64bit version is working fine, i've used it right now for making the screen i sent you, maybe it's behaving differently than the avisynth version, in this case this is a bug and i should further study this problem (remember that the 16bit version supposedly should work as the original continuity fixer, but i can't be sure).
Thanks for reporting this problem :)
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.