Log in

View Full Version : I want a little plugin for SmoothCurve


gispos
30th January 2021, 23:29
Did anyone want to write a little plugin for SmoothCurve?
Only a string has to be returned.
I could probably write it myself, but I haven't written a plugin yet and that's why it takes time and annoyance. :)

sCurve(int int1, ... ,int IntN, string "name")
return str (int1) + '-' + str (int2) + ';' + ... etc

My goal is to control SmoothCurve with AvsPmod sliders and to freely determine the number of curves.
So far I've been using this here. And it is already included in the database.
Save this in an avsi file.

function SmoothCurveC3(Clip clp, string "Ycurve", int "Y_Low", int "y_a1", int "y_a2", int "y_b1", int "y_b2", int "y_c1", int "y_c2", int "Y_High",
\ string "Ucurve", int "U_Low", int "u_a1", int "u_a2", int "u_b1", int "u_b2", int "u_c1", int "u_c2", int "U_High",
\ string "Vcurve", int "V_Low", int "v_a1", int "v_a2", int "v_b1", int "v_b2", int "v_c1", int "v_c2", int "V_High",
\ int "mode", bool "debug")
{
mode = default(mode, 100)
debug = default(debug, False)
clp
SmoothCurve(Ycurve=SCurve3("Ycurve", Y_Low, y_a1, y_a2, y_b1, y_b2, y_c1, y_c2, Y_High),
\ Ucurve=SCurve3("Ucurve", U_Low, u_a1, u_a2, u_b1, u_b2, u_c1, u_c2, U_High),
\ Vcurve=SCurve3("Vcurve", V_Low, v_a1, v_a2, v_b1, v_b2, v_c1, v_c2, V_High),
\ screenW=clp.Width(), screenH=clp.Height(), mode=mode, debug=debug)
}

then call in AvsPmod 'SmoothCurveC3' and you get sliders
/**avsp_filter
SmoothCurveC3
*/

And I have this too. Save this in an avsi file

function SCurve3(string "name", int "low", int "a1", int "a2", int "b1", int "b2", int "c1", int "c2", int "high")
{
name = default(name, "curve")
low = default (low, 0)
a1 = default(a1, 64)
a2 = default(a2, 64)
b1 = default(b1, 128)
b2 = default(b2, 128)
c1 = default(c1, 168)
c2 = default(c2, 168)
high = default(high, 255)
return "0-"+string(low)+";" +string(a1)+"-"+string(a2)+";" +string(b1)+"-"+string(b2)+";" +string(c1)+"-"+string(c2)+ ";255-"+string(high)
}

AvsPmod function definition (it is not yet included in the database)

Name: SCurve3
(
string "name"="curve",
int "low"=0 (0 to 254),
int "a1"=68 (1 to 254),
int "a2"=68 (1 to 254),
int "b1"=128 (1 to 254),
int "b2"=128 (1 to 254),
int "c1"=168 (1 to 254),
int "c2"=168 (1 to 254),
int "high"=255 (0 to 255)
)

Then call like this (We now have sliders)

/**avsp_filter
YCurve=SCurve3(name="Ycurve", low=0, a1=68, a2=68, b1=128, b2=128, c1=168, c2=168, high=255)
UCurve=SCurve3(name="Ucurve", low=0, a1=68, a2=68, b1=128, b2=128, c1=168, c2=168, high=255)
VCurve=SCurve3(name="Vcurve", low=0, a1=68, a2=68, b1=128, b2=128, c1=168, c2=168, high=255)
SmoothCurve(Ycurve=YCurve, Ucurve=UCurve, Vcurve=VCurve, debug=False)
*/


Or is there another solution in avisynth (arrays)?

Edit:
I just see that I changed SmoothCurveC3. So SCurve3 is also required for this.
So SmoothCurveC3 and SCurve3 must be available as a function in the avsi file.